Can't take back a field from database and put it into o variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • elen
    New Member
    • Sep 2008
    • 4

    Can't take back a field from database and put it into o variable

    hello!
    i have the below problem.I have a form wich works fine but my php script doesn't do it's work.Well i'm trying to insert the data from my form to my database(this works,i've tested it).Further more i want to take the id where name=$POST[nameval] from my table and then print in my screen the value of the id(my table is:eleni(id int auto_increment primary key,name varchar(20)).Th e result that i'm taking back is Resource id #3 and is always the same!!!
    Can somebody help me?Thank you!

    [PHP]$sql = mysql_query("IN SERT INTO elen VALUES ('','$_POST[nameval]')");
    $res_id=mysql_q uery("SELECT id FROM elen WHERE name='$_POST[nameval]'"); /*Here is the problem*/
    echo $res_id;[/PHP]
    Last edited by Atli; Sep 14 '08, 04:29 PM. Reason: Added [code] tags.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    The manual would explain why that happens.

    P.S.
    Please post you code examples in [code] tags.

    Comment

    Working...