Jump to content

Login Screen for Shopping Cart


leighhobson89

Recommended Posts

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! :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.