Page 1 of 1

Missing Search Results

Posted: Fri Sep 07, 2007 7:25 am
by cs1h
Hi,

I have this php search script, but when I run it I just get this
country:
type:
Abstract:
This is the right layout but it is not filling it with results.
The php code is

Code: Select all

<?php 

// Connects to your Database 
mysql_connect("localhost", "adder", "clifford") or die(mysql_error()) ; 
mysql_select_db("real") or die(mysql_error()) ;

$country = isset($_POST['menuFilesDMA']) ? preg_replace('/[^a-zA-Z0-9\ ]/', '', $_POST['menuFilesDMA']) : ''; 
$type = isset($_POST['Type']) ? preg_replace('/[^a-zA-Z0-9\ ]/', '', $_POST['Type']) : ''; 
$Abstract = isset($_POST['keyword']) ? preg_replace('/[^a-zA-Z0-9\ ]/', '', $_POST['keyword']) : ''; 

if ($country) { 
     $where[] = "country='$country'"; 
} 
if ($type) { 
     $where[] = "type='$type'"; 
} 
if ($Abstract ) { 
     $where[] = "Abstract LIKE '%$Abstract%'"; 
} 
if ($where) { 
     $sql = "SELECT * FROM items WHERE " . implode(' AND ', $where); 
     // query and display results 
} 

 
{ 

//Outputs the image and other data
Echo "<b>country:</b> ".$info['country'] . "<br> "; 
Echo "<b>type:</b> ".$info['type'] . " <br>"; 
Echo "<b>Abstract:</b> ".$info['Abstract'] . " <hr>"; 
} 
?>
Any help would be much appriciated,

Thanks,
Colin

Posted: Fri Sep 07, 2007 9:19 am
by josa
Is this all of the code? I don't see any mysql_query($sql) for example. You build the query but you don't run it against the database. and the $info array seems to be empty.

/josa