june_c21 Posted March 15, 2008 Share Posted March 15, 2008 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>"; } Quote Link to comment Share on other sites More sharing options...
l0ve2hat3 Posted March 15, 2008 Share Posted March 15, 2008 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>"; } Quote Link to comment Share on other sites More sharing options...
june_c21 Posted March 15, 2008 Author Share Posted March 15, 2008 SELECT title FROM drawings WHERE gf='gf1' LIKE'%oko%' . it display all the data. how to write a query where gf=gf1 && text='user input' ? Quote Link to comment Share on other sites More sharing options...
l0ve2hat3 Posted March 15, 2008 Share Posted March 15, 2008 replace $USERINPUT with a name from your search field SELECT title FROM drawings WHERE gf='gf1' AND text='$USERINPUT' Quote Link to comment Share on other sites More sharing options...
june_c21 Posted March 15, 2008 Author Share Posted March 15, 2008 SOLVED !! Thanks l0ve2hat3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.