Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
|
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 15th, 2004, 02:03 PM
Authorized User
 
Join Date: Apr 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default php code to revealing levels of data

What I want is to display levels of data as one to navigate through my webpage. In other words, I want to show data in a database that links to other pages that displays more data so that the page can be organize in to a interface that displays categories and navigates through a database. I can actually get the data to display, but I cannot get the data to display data that is linked to a specific row.

Here is the data that through php:
<?php
require_once ('mysql_connect.php'); // connecting to database.

// Im making the query.
$query = "SELECT CONCAT(Id) AS Id, (Name) AS Name, (Description) AS Des, DATE_FORMAT(Date, '%M %d, %Y') AS dr FROM AddTable1 WHERE Description IS NOT NULL ORDER BY Date ASC";
$result = @mysql_query ($query) OR die; // Run the query.
$num = mysql_num_rows ($result); // How many codes are there?

if ($num >0)
{ // If it ran ok

    // Display numbers
    echo "<p><big><b>These are the current number of entries: $num</b></big></p>";



    // Display headers
    echo '<table align="center" border="2" cellspacing="2" cellpadding="2">
    <tr><td align="left"><b>Id</b></td><td align="left"><b>Name</b></td><td align="left"><b>Category</b></td><td align="left"><b>Date</b></td><td></td><td align="left"><b>Click edit to update</b><td align="left"><b>Show the table</b></td></td></tr>';

    // Fetch the data
    while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
        echo "<form name=method='post' action='Show.php'>";
        echo "<tr><td align=\"left\">".stripslashes($row[0])."</td><td>$row[1]</td><td align=\"left\"><a href='edit.php?=".edit."'>$row[2]</a></td><td align=\"left\">$row[3]</td><td align=\"left\"><a href='edit.php?=".edit."'>$row[4]</a></td><td><a href='edit.php?=".edit."'>".edit."</a><br></td><td><input type='submit' name='Code' value='".$result[Code]."Show'></td></tr>\n";
        }

        echo '</table>';
        mysql_free_result ($result); // free up resources.

        } else { // If it didnt run OK.
            echo
            '<p>there are no codes in this query</p><p>' .mysql_error() . '</p>';
            }

mysql_close(); // Close the database.


include ('WSfooter.inc'); // footer included.
?>

Now here is the page that is supose to show that data that is linked to that to the above listing of data:

<?php
// This page is to get the sql query to show the table being selected
// The title and header
$page_title = 'Show information';
include ('WSheader.inc');

// Variable Declaration with if statement

$c = $_Get['Code'];



// Query time - for selection of data
require_once ('mysql_connect.php'); // I am making a connection to database

// Variable Declaration with if statement

// This query should show the data from agenda section
$result = mysql_query("SELECT Code FROM AddTable2 WHERE Code=" . $c);

if (!$result) {
    die ("<p>Error performing query: " . mysql_error() . "</p>");
}
else {
    echo ('<p> '.$result.'.</p>');
}

mysql_close(); // Close the database.

include ('WSfooter.inc'); //Showing footer

?>

I cannot get this one to display someone anyone please help me.

 
Old April 16th, 2004, 03:56 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Hi Alex, could you make a greater effort to make this code readable? I don't really have the extra time to sift through sloppy code to find your mistakes.

Enclose your code in [code] [/code] forum tags so that it doesn't wrap in the window.

Format and indent your code to a commonly accepted convention: http://p2p.wrox.com/topic.asp?TOPIC_ID=11967

-Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
 
Old April 17th, 2004, 12:30 PM
Authorized User
 
Join Date: Apr 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey richard don't worry about it. I've fount the answer to my problem. But at least it isn't english grammar. If you think my coding is bad, you ought to see my essay paper, wooo. Anyway, Say in touch though because I may need you in the future.






Similar Threads
Thread Thread Starter Forum Replies Last Post
levels for the small stars crmpicco Forum and Wrox.com Feedback 2 December 5th, 2006 05:33 AM
Re-Odering levels Brendan Bartley Access 5 November 16th, 2006 12:41 PM
Isolation Levels - Locking SQLScott SQL Server 2005 6 May 24th, 2006 11:59 AM
To tables combined to two levels jzac HTML Code Clinic 2 October 20th, 2004 04:20 PM
user levels dazednconfused Beginning PHP 3 July 8th, 2003 04:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.