PHP get session help

Iv been working on this for a while and cant figure out why its not working

$userid = mysql_query(“SELECT * FROM members username = $_SESSION[‘myusername’]”);

that’s the query

<?php if($userid['location']==1)echo "Order"; ?>

You need to quote text values in a query and to use the array either concatenate or use braces:

[php]$query = “SELECT * FROM members username = ‘{$_SESSION[‘myusername’]}’”;[/php]

Beyond that, you haven’t shown any code or debugging attempts.

this is what I put in.

$userid = mysql_query(“SELECT * FROM members username = ‘{$_SESSION[‘myusername’]}’”);

<?php if($userid['location']==1)echo "Order" ?>

echo $userid[‘location’];

Nothing works not even the echo $userid[‘location’];

That’s not even close. Stop using mysql and look at mysqli or PDO. Example for mysqli:“”

after reading up on it I got it working perfect for 1 part but I`m not really strong at merging PHP and HTML i can do a little bit but i got a REALLY complicated one

<?php if($test['location']==1)echo ">order"; ?>

if tried different ways on typing it in but for some odd reason it keeps giving me multiple errors im gonna keep trying at it but so far hit a wall lol, sorry im still getting used to html and php working together probally something im over looking.

if your wondering about the echo $rows[‘part’] its so i can pull the data off on the next page that then shoots an email off to my parts department :smiley: found it to be the simples way so techs don’t have to type in the part its like a quick order button click don’t type anything and walk away no more to it :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service