Jump to content

Filling variables from SQL


Suchy

Recommended Posts

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


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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.