Hey all,
i’m trying to have a small search thing on a site where you can search a database.
code is:
<?
$name=$_GET[‘name’];
$company=$_GET[‘company’];
$address=$_GET[‘address’];
$phone=$_GET[‘phone’];
$email=$_GET[‘email’];
$web=$_GET[‘web’];
mysql_pconnect("host","random","random") or die ("didn't connect to mysql");
mysql_select_db("database") or die ("no database");
$query = “SELECT * FROM table_name WHERE (Name, Company, Address, Phone, Email, Web) = (’$name’, ‘$company’, ‘$address’, ‘$phone’, ‘$email’, ‘$web’)”;
$result = mysql_query( $query ) or die (“didn’t query”);
$num = mysql_num_rows( $result );
//echo ($num);
if ($num == 1){
while ($line=mysql_fetch_array($result)) {
$profile = “name_show=” . $line[‘Name’];
$profile = “company_show=” . $line[‘Company’];
$profile = “address_show=” . $line[‘Address’];
$profile = “phone_show=” . $line[‘Phone’];
$profile = “email_show=” . $line[‘Email’];
$profile = “web_show=” . $line[‘Web’];
}
print $profile;
} else {
print “error=Sorry, but I can’t show results”;
}
?>
the problem lies in there (“didn’t query”) is the error i get, im not too advanced in mysql but any help on this problem and improvements would be awesome.
Thanks in advanced ppl’s!
:toad::toad: