I am making a profile system and I want to make it where when someone types [url]www.mysite.com/profile.php?id=2
so I set up the stuff and I came out with this code
[code=php]
<?
session_start();
if(isset($_GET[‘id’])){
$sqlconn = “localhost”;
$sqluser = “username”;
$sqlpass = “password”;
$sqldb = “database”;
$id = $_GET[‘id’];
$conn = mysql_connect($sqlconn, $sqluser, $sqlpass);
if(!$conn) {
die(“Could not connect to: “.$sqlconn.”:.:”.mysql_error());
}
mysql_select_db($sqldb, $conn)
or die(“Could not select:.:”.$sqldb.” – “.mysql_error());
$querytxt = “SELECT * FROM users WHERE id=’$id'”;
$selectquery = mysql_query($querytxt);
$row = mysql_num_rows($selectquery);
echo $querytxt.”<p>”;
echo $selectquery.”<p>”;
echo “username: “.$row[‘username’];
}
?>
which [b]SHOULD
[code]SELECT * FROM users WHERE id=’2′
Resource id #3
username:
Just that, and of course, I set GET[‘id’] to 2 in the url there, and there is a user with id number 2, but it just returns that resource Id # 3 and I am not sure why. All help is appreciated, Thanks.