Jump to content

Search Code


june_c21

Recommended Posts

i got error when i run this lines of code.

mysql_fetch_array(): supplied argument is not a valid MySQL result

mysql_num_rows(): supplied argument is not a valid MySQL result

$data = mysql_query("SELECT title FROM drawings WHERE upper($field) LIKE'%$find%'"); 
echo "<table border=3 align=center width=100%>";

while($result = mysql_fetch_array( $data )) 
//And we display the results 
{ 
echo "<tr><td align=center>" . $myrow1[0] . "</td></tr>";
} 

//This counts the number or results - and if there wasn't any it gives them a little message explaining that 
$anymatches =mysql_num_rows($data); 
if ($anymatches == 0) 
{ 
echo "Sorry, but we can not find an entry to match your query<br><br>"; 
} 

Link to comment
Share on other sites

usually you would do something like this

replace "FIELDNAMEHERE" with the field you want to display

and also make sure $field is difined

$result = mysql_query("SELECT title FROM drawings WHERE UPPER($field) LIKE'%$find%'"); 
echo "<table border=3 align=center width=100%>";

while($row = mysql_fetch_array( $result)) 
//And we display the results 
{ 
echo "<tr><td align=center>" . $row['FIELDNAMEHERE'] . "</td></tr>";
} 
//This counts the number or results - and if there wasn't any it gives them a little message explaining that 
$anymatches =mysql_num_rows($result); 
if ($anymatches == 0) 
{ 
echo "Sorry, but we can not find an entry to match your query<br><br>"; 
} 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.