By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

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

elen
P: 4
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)).The 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("INSERT INTO elen VALUES ('','$_POST[nameval]')");
$res_id=mysql_query("SELECT id FROM elen WHERE name='$_POST[nameval]'"); /*Here is the problem*/
echo $res_id;[/PHP]
Sep 14 '08 #1
Share this Question
Share on Google+
1 Reply


Atli
Expert 5K+
P: 5,058
Hi.

The manual would explain why that happens.

P.S.
Please post you code examples in [code] tags.
Sep 14 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.