PDA

View Full Version : Searching database



newuser
05-04-2008, 05:39 AM
Hi I have create a database and i wish to read and display the contents base on a specific field can i do the following?


<?
include("dbase.php");
$numresults = mysql_query("SELECT * FROM mytable WHERE
city LIKE '%{$search}%' AND
state LIKE '%{$search1}%'");
while ($data=mysql_fetch_array( $numresults )) {
if ($data['city'] == 'search' and $data['state']=='state');
echo $data['name']."<br />".$data['address']."<br/>".$data['city']."<br />"."<br />";

} else {
echo "no data found";
}

?>