473,732 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Warning: mysql_fetch_arr ay(): supplied argument is not a valid MySQL result source

33 New Member
Expand|Select|Wrap|Line Numbers
  1. I'm having a problem. I'm sure I'm going to kick myself over the answer...
  2.  
  3. I have a table that stores vendors and their languages. This table starts out blank. I am querying the table to see if a vendor has been added to the table yet. The problem is, if they haven't been added, I can't seem to get the script to realize that. here is what I am trying to do.
  4.  
  5. $testvend = SELECT language FROM vendor_details WHERE id = $vendorid
  6.  
  7. if(!$testvend){
  8. //script to add vendor to list, with supplied language
  9. }else{
  10. while($row = mysql_fetch_array($testvend)){
  11. //script to get vendor language and display vendor langauge
  12. }
  13. }
The result I get is:

Warning: mysql_fetch_arr ay(): supplied argument is not a valid MySQL result source in (script name) on line (line with mysql_fetch_arr ay)

*NOTE: I did try searching bytes.com and the web. The search on bytes.com returns a blank page. The web showed my method above, as well as the option to add "or die" after the query. adding or die didn't do anything either. I've also tried manually adding information to the table, so that the script is not working off of a blank table, but I still get the same result if the vendor does not exist. Also, I apologize that the title isn't very clear. I realized after I posted it I should have put a problem description in the title...
Mar 5 '09
11 4747
TheServant
1,168 Recognized Expert Top Contributor
lol, didn't realize it worked like this but it makes sense. mysql_fetch_arr ay() will fetch an array as the name suggests. If the array is empty and you count it, it counts 1 empty array, returning 1. So mysql_num_rows( ) is the way to go.
Mar 6 '09 #11
Markus
6,050 Recognized Expert Expert
Glad we could be of help. It's always smarter to stick to methods that are there for a specific purpose (using mysql_* functions for mysql related stuff, etc.)

- Mark.
Mar 6 '09 #12

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

Similar topics

4
7834
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 fields Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 34 Sorry You failed to enter the correct old password I was wondering if anyone could help me, I have...
2
16929
by: techjohnny | last post by:
Error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/jplane/certcent/phpweb/quiz/index.php on line 20 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/jplane/certcent/phpweb/quiz/index.php on line 21 PHP CODE:
1
2709
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 line 113 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mamadele/public_html/BESTPLAYS/search.php on line 127 My code is below. Any help would be much appreciated. ...
11
3597
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 when there is no result "empty table" how can i do a quick fix to say No Results... row 88: if ($myrow = mysql_fetch_array($result)) { do { if ($rowcolor == 1) {
4
5029
by: fisherd | last post by:
When i run this code, i keep getting this message; Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\checklogin.php on line 26 i use this code to check login details. Here is the code for the pages that i used. main_login.php <html> <body>
4
2297
by: kalyanip14 | last post by:
Hi I am new to Php.I am trying to read My sql database data from table to php. I am getting this warning Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource and my code is <?php
2
2198
by: perhapscwk | last post by:
When I run my site from localhost, no error, but when I move it to webhosting, it show below error, why? Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/asi50080/public_html/onlineadv/category.php on line 143 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/asi50080/public_html/onlineadv/category.php on line 155
0
5621
Atli
by: Atli | last post by:
What to discuss: What is a "MySQL resource". What causes the error. How to fix it. Common Newbie Pitfalls This article is the second installment in a series of (hopefully) many, following Markus' first installment: 1: Headers Already Sent.
1
1933
by: kmacc | last post by:
Hi, I'm getting this error on a page after changing server host, the error did not happen on my old host. I'm thinking it is to do with a new MySQL version and more strict coding. Can anyone help? Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xxxx/public_html/propview.php on line 78 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in...
0
8944
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8773
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9445
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9180
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6030
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3259
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 we have to send another system
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.