Forum Moderators: coopster

Message Too Old, No Replies

trouble displaying contentsmy pages in....?id=

dynamic pages, php

         

tausi

1:46 am on Aug 23, 2005 (gmt 0)

10+ Year Member



I have 2 files. One which creates the list, has the code (directory.php) and another one to display the details of each link (profile.php)

This is my php code from directory.php, it works fine. I get a list of Names as a link and I am able to click and get to the page www......org/profile.php?id=num for each link
/RETRIEVE DATA
$query = "SELECT * FROM `registration` ORDER BY `Lname`, `Fname`";
$result = mysql_query( $query ) or die( "Trouble getting information from the database: " . mysql_error() );
while( $myrow = mysql_fetch_array( $result ) )
{
// Display the List of Alumni sorted by Last Name
$id = $myrow["id"];
$Lname = $myrow["Lname"];
$Fname = $myrow[Fname];
$mInitial = $myrow[mInital];
echo("<a href= \"profile.php?id=".$myrow[id]."\"> $Lname, $Fname $mInitial.<br></a>");

}
?>

My second file profile.php ( it must be the source of the problem):

$result = mysql_query("SELECT * FROM registration WHERE $id=id");
$myrow = mysql_fetch_array($result);
echo "First Name: ".$myrow['Fname'];
echo "<br>Last Name: ".$myrow['Lname'];
echo "<br>Title : ".$myrow["title"];
echo "<br>Email : ".$myrow["email"];
echo "<br>Address: ".$myrow["address"];

all the labels are displayed , but the data itself, is nothing. I am a new bie, i have being on this the whole day...I will appreciate any help.

Thanks

bibby

5:47 am on Aug 23, 2005 (gmt 0)

10+ Year Member



Change this ( in profile.php):

$result = mysql_query("SELECT * FROM registration WHERE $id=id");

to this
$result = mysql_query("SELECT * FROM registration WHERE id='$id'");

tausi

1:58 pm on Aug 23, 2005 (gmt 0)

10+ Year Member



I have change that, the output hasn't changed, thanks

dreamcatcher

3:10 pm on Aug 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try:

$result = mysql_query("SELECT * FROM registration WHERE id='".$_GET['id']."'");

dc

tausi

3:21 pm on Aug 23, 2005 (gmt 0)

10+ Year Member



THANK YOU. It is finally working using your method. This forum great.

dreamcatcher

6:02 pm on Aug 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No problem tausi, it was a register globals issue. More info here:

[uk.php.net...]

dc