leighhobson89 Posted March 16, 2007 Share Posted March 16, 2007 Hi all, I have this bit of code here. It is supposed to call someones name out of the database when the variable is echo'd at the bottom, but instead, the variable $username2 is echoing out the whole SQL statement. Does anyone know what i'm doing wrong. I want the value of 'custFirstname' to be the word that echoes out. It is being used for a login screen/shopping cart. ??? Here's the code... $username2 = "SELECT custFirstname from lptCustomerrecord WHERE userName = ".$_SESSION['username']; if(!$resultusername = mysql_query($username2,$connection)) echo "ERROR. SQL is '".$username2."'\n"; else { $Row6 = mysql_fetch_array($resultusername); } echo "<p>Welcome ".$Row6['custFirstname'].", you just chose the following product. To add it to your cart, click the Add to Cart button below, otherwise click No Thanks, to return to the shopping screen without adding the item to your cart.</p>"; I hope someone can help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.