473,472 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

123 New Member
how can i fix these error and what does it mean
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in C:\wamp\www\test_php\log\search\result.php on line 8

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. @mysql_connect('localhost','user2','point')or die('could not connect');
  4. @mysql_select_db('files') or die('could not select database');
  5.  
  6. $term = $_GET['term'];
  7. $sql = mysql_query("SELECT * FROM user WHERE Fname LIKE %term%");
  8. while ($row = mysql_fetch_array($sql))
  9. {
  10. echo 'Fname : '.$row ['Fname'];
  11. echo '<br/>Lname :'.$row ['Lname'];
  12. echo '<br/>Address : '.$row ['Address'];
  13. echo '<br/>phone no: '.$row ['phone no'];
  14. echo '<br/>Email: '.$row ['Email'];
  15. echo '<br/><br/>';
  16. }
  17. ?>
  18.  
Dec 19 '08 #1
4 1719
dumm
10 New Member
When you have a mysql error, you can output the error by echoing mysql_error() after the query has been sent.

example:
Expand|Select|Wrap|Line Numbers
  1. $sql = mysql_query("SELECT * FROM user WHERE Fname LIKE '%term%'");
  2. if(!$sql)
  3. echo mysql_error();
  4.  
In your query you must put %term% between quotes.

Expand|Select|Wrap|Line Numbers
  1. $sql = mysql_query("SELECT * FROM user WHERE Fname LIKE '%term%' ");
  2.  
Dec 19 '08 #2
Dormilich
8,658 Recognized Expert Moderator Expert
actually, what is %term% (or did you mean $term or %$term%)?
Dec 19 '08 #3
ak1dnar
1,584 Recognized Expert Top Contributor
Hi Simon,
I changed the original thread title (how can i fix this error) with the existing one.
while posting threads there are some rules/guidelines that everybody should read and follow.Please be good enough to have a look here. good luck.
Posting Guidelines

MODERATOR

The meaning of that error is, there is no "result set" after executing that query. may be your SQL statement is in correct.
Dec 20 '08 #4
Markus
6,050 Recognized Expert Expert
You get this because your query is returning no results. You should check using mysql_num_rows(), and, as mentioned before, it is very good practice to use the mysql_error() function on any query you do.

http://bytes.com/topic/php/answers/6...gging-messages
Dec 20 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: josh dismukes | last post by:
i recieve this error from this part of the code: mysql_fetch_array(): supplied argument is not a valid mysql result resource it's returning a long text from the database which is about 200...
3
by: Pratchaya | last post by:
Hi Everyone ============================================================== About PHP::: Error/Problem PHP Warning: mysql_fetch_array():...
2
by: 00webman | last post by:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/html/scripts/07/view_users.php on line 15 Can anyone spot my error?!? Thanks. <?php # Script 7.6 -...
3
by: petemaxi | last post by:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\tockholes\includes\menu.inc.php on line 9 <div class="left"> <div class="menu">...
1
by: myaashik | last post by:
Hello! All I have a Error message saying that: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/rocks/public_html/colorado3.php on line 32 I have...
4
by: Ryanlawrence1 | last post by:
Heya, I get these 2 errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 20 You have not entered all the...
1
by: lsmamadele | last post by:
I am getting the following error messages in my search: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mamadele/public_html/BESTPLAYS/search.php on...
11
by: Breana | last post by:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/breana/public_html/category.php on line 88 ------------------------------------------- It does this...
2
by: poreko | last post by:
I am connecting to my database using Object oriented PHP. My query is returning results but at the end of my table,at the bottom of the page I keep having this error when I run my program: Warning:...
11
by: chemlight | last post by:
I'm having a problem. I'm sure I'm going to kick myself over the answer... I have a table that stores vendors and their languages. This table starts out blank. I am querying the table to see if a...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.