How would I get all of the fields data from a search result? as right now the code i'm using seems to only give me the field that it found the search term in.
This is the code i'm using
$query = mysql_query("SELECT title, description FROM $table WHERE title like '%$word%' OR description LIKE '%$word%' ORDER BY viewed DESC LIMIT $startRow,$endRow");
$query2 = mysql_num_rows($query);
if($query2<=0)
{
return "&error=" . mysql_error();
} else {
$counter = 0;
while ($row = mysql_fetch_array($query)){
$counter ++;
echo "&title"."$counter=".$row['title'];
echo "&description"."$counter=".$row['description'];
echo "&url"."$counter=".$row['link'];
echo "&viewed"."$counter=".$row['viewed'];
echo "&date"."$counter=".$row['date'];
echo "&id"."$counter=".$row['index'];
}
$title is returned correctly, but all the other fields come back as error msgs something like "undefined index xxx" etc.
Any ideas?
boombanguk