Hi,
Posted a question a few days ago about gathering information from a cookie and using it on the next page to display a welcome message to a user. I have figured out some issues and with a little testing have determined that the cookie has been set and that the output statement works just fine. However the problem seems to be with my sql code.
Could anyone help me fix this?
if (isset($_COOKIE['Username'])) {
echo "Cookie Set!";
$cusername = $_COOKIE['Username'];
}
This returns a "Cookie Set!" statement, so I know the cookie has registered.
This is my line of SQL code:
$querycname = mysql_query("SELECT customers_firstname FROM $tbl_name WHERE customers_username='$cusername'");
The greeting is simply:
<?php echo "Welcome, $querycname !"; ?>
However I used this test:
$count=mysql_num_rows($querycname);
if($count==1){
echo "Row Found!";
}
else {
echo "no rows";
}
and the result returned "Row Found!" ...So I know it must have found the information...Really can't see what I am doing wrong here.
Oh, also when I try and echo the $querycname I just get the output:
"Welcome Resource Id #8!"
Posted a question a few days ago about gathering information from a cookie and using it on the next page to display a welcome message to a user. I have figured out some issues and with a little testing have determined that the cookie has been set and that the output statement works just fine. However the problem seems to be with my sql code.
Could anyone help me fix this?
if (isset($_COOKIE['Username'])) {
echo "Cookie Set!";
$cusername = $_COOKIE['Username'];
}
This returns a "Cookie Set!" statement, so I know the cookie has registered.
This is my line of SQL code:
$querycname = mysql_query("SELECT customers_firstname FROM $tbl_name WHERE customers_username='$cusername'");
The greeting is simply:
<?php echo "Welcome, $querycname !"; ?>
However I used this test:
$count=mysql_num_rows($querycname);
if($count==1){
echo "Row Found!";
}
else {
echo "no rows";
}
and the result returned "Row Found!" ...So I know it must have found the information...Really can't see what I am doing wrong here.
Oh, also when I try and echo the $querycname I just get the output:
"Welcome Resource Id #8!"