Suchy Posted April 21, 2007 Share Posted April 21, 2007 I have a dynamic dropdown menu filled with names of people that posted to the guestbook. When I select a user I want info about that user to show up (ip, when posted...) if(in("show")) { $id = $_POST['info']; $action = "SELECT * FROM entried WHERE id = '$id'"; $result = mysql_query($action); $name_info = ??? $ip_info = ?? } How can I fill in those variables (name_info , ip_info ) with information from SQL (fields are name , ip ...) Link to comment https://forums.phpfreaks.com/topic/48068-filling-variables-from-sql/ Share on other sites More sharing options...
ataria Posted April 21, 2007 Share Posted April 21, 2007 if(in("show")) { $id = $_POST['info']; $action = "SELECT * FROM entried WHERE id = '$id'"; $result = mysql_query($action); $row = mysql_fetch_array($result); $name_info = $row['name']; $ip_info = $row['ip']; } I am not sure what the exact field name is, so I just put in 'name' and 'ip'. change if needed. Link to comment https://forums.phpfreaks.com/topic/48068-filling-variables-from-sql/#findComment-234901 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.