Jump to content

Unwanted warning??


crazylegseddie

Recommended Posts

I have a search script that I have inputted at the home of my site and works correctly but with the following script:
[code]
$sql = "SELECT pd_id, pd_name, pd_more, pd_more2, 
              MATCH(pd_name, pd_more, pd_more2) 
              AGAINST ('$searchstring' IN BOOLEAN MODE) FROM tbl_product
              WHERE MATCH(pd_name, pd_more, pd_more2) 
              AGAINST ('$searchstring' IN BOOLEAN MODE) ORDER BY pd_name DESC";
    }   
    $result = mysql_query($sql) or die (mysql_error());
 
  while($row = mysql_fetch_assoc($result))
    {
      echo "<a href='categories.php?c=0&p=". $row['pd_id']. "'>".stripslashes(htmlspecialchars($row['pd_name'])).'</a><br />';
    }
[/code]

A message saying 'query is empy' is displayed and cancels the rest of my html page. But if i remove 'or die (mysql_error());' then i get the following warning.

'Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result' but the rest of the page now loads correctly.

How do i overcome this problem im having?

Any help will be cool.

Link to comment
https://forums.phpfreaks.com/topic/18091-unwanted-warning/
Share on other sites

it is definately not the connection as I have the connection stored in a config file and is functional over the rest of my site. If I add 'die(mysql_error());' then I just receive 'Query was empty' and the rest of the page after the php script does not load. :(
Link to comment
https://forums.phpfreaks.com/topic/18091-unwanted-warning/#findComment-77549
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.