General Community > Scripting Help
Read and Search from SQL
(1/1)
colby2152:
Does anyone have a basic PHP script that is able to read and search from a SQL table? Let's say the sample DB table has five non-ID fields - Name, Address, City, Zip, and State. I would want a form that could search on any number of these criteria and then return the output in some form. The PHP URL would end in the ID. With a working example, I can extrapolate it to what I need. Thanks!
System32Cro:
here is how you can read values from tablice
--- Code: ---$query = mysql_query("SELECT * FROM `your_table` WHERE Something = something") or die(mysql_error());
while($row = mysql_fetch_assoc($query))
{
$zip = $row['ZIP']; //ZIP is name of field!
}
//and you can use
echo $zip;
--- End code ---
Navigation
[0] Message Index
Go to full version