mysql - Getting a Row in PHP -



mysql - Getting a Row in PHP -

i'm having problem getting row table. i'm trying echo id column result in table. think i'm missing simple... //-select database utilize $mydb=mysql_select_db("table"); //-query database table $sql="select * contacts `email`= $email_user"; //-run query against mysql query function $result=mysql_query($sql); //-if email , email_user same if echo id if ($result=$name_user){ echo "hello id " $id; } else{ echo "sorry find user"; } ?>

remember, mysql_query returns query resource handler, not result.

you must phone call mysql_fetch_assoc($queryresource) results.

in example:

//-select database utilize $mydb=mysql_select_db("table"); //-query database table $sql="select * contacts `email`= '$email_user'"; //-run query against mysql query function $queryresource=mysql_query($sql); $result = mysql_fetch_assoc($queryresource); if ($result){ echo "hello id ". $result['id']; } else{ echo "sorry find user"; }

php mysql

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -