I have a database that I want query and pull an users specific details into a "$profile" variable.
the url would be:
"www.website.com/profile.php?id=12345"
Thus, I use the $_REQUEST["id"] to put the id number into a variable and then I query the database using this id number.
The code is below:
<?php
/*OPEN THE DATABASE*/
$con = mysql_connect("localhost","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
/*PULL INFO FROM URL FOR GENERATION OF PUBLIC PROFILE*/
$idnum=$_REQUEST["id"];
/*PULL INFO FROM THE DATABASE*/
[B]$pullprofile="SELECT * FROM 'accounts' WHERE (idnum = '$idnum')";
if(mysql_query($pullprofile,$con))
{
$profile[]=mysql_fetch_array($pullprofile,$con);
echo "Success loading profile!";
echo "Your id number is ".$profile['idnum'];
}
else
{
echo "Profile does not exist...";
}
[/B]
/*CLOSE THE DATABASE*/
mysql_close($con);
?>
For some reason the code keeps on returning the "Profile does not exist..." results, even though I know the profile does exist...
I'm new to PHP/SQL, so what am I doing wrong...?