473,466 Members | 1,349 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MySql_fetch_array() error in PHP

1 New Member
In config.php line 28 I have written the following lines.
$query = "SELECT * FROM `users` WHERE username = '".$uname."' AND password = '".$pword."'";
# set a query

$online = mysql_fetch_array(mysql_query($query));

Using MYSQL and PHP in a remote linux server I am getting the following error.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/india/public_html/xxxxx/auth/config.php on line 28

Can anybody advice , why I am getting the error.
Nov 21 '06 #1
3 9438
ronverdonk
4,258 Recognized Expert Specialist
It most likely means you have an error in the mysql_select because no object was created. Statement of warning: do never nest mysql queries, like you do here, because you can't get to the error that caused it. Instead display the errors and continue depending on the result, like in the following sample:[php]$query = "SELECT * FROM `users` WHERE username = '$uname' AND password = '$pword';
$res = mysql_query($query)
or die("Error in select: " . mysql_error());
if (mysql_num_rows > 0)
$online = mysql_fetch_array($res);
else
echo 'No records available';[/php]
Ronald :cool:
Nov 21 '06 #2
Nert
64 New Member
hi Sir Ronald,

i just edited something on your post at the line "if(mysql_num_rows > 0)". (^_^)

[php]
$query = "SELECT * FROM `users` WHERE username = '$uname' AND password = '$pword';
$res = mysql_query($query)
or die("Error in select: " . mysql_error());
if (mysql_num_rows($res) > 0)
$online = mysql_fetch_array($res);
else
echo 'No records available';[/php]


--nert
Nov 22 '06 #3
ronverdonk
4,258 Recognized Expert Specialist
hi Sir Ronald,

i just edited something on your post at the line "if(mysql_num_rows > 0)". (^_^)

[php]
$query = "SELECT * FROM `users` WHERE username = '$uname' AND password = '$pword';
$res = mysql_query($query)
or die("Error in select: " . mysql_error());
if (mysql_num_rows($res) > 0)
$online = mysql_fetch_array($res);
else
echo 'No records available';[/php]


--nert
You are right, thanks.

Ronald :cool:
Nov 22 '06 #4

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

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
5
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information...
1
by: Aravind | last post by:
we have two files: 1. rc4.c (defines one function "create_pin()") 2. MyImpl.c(calling the function "create_pin()"),This implements JNI method. 1.When I am trying to create .dll file with one...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
5
by: yashu0209 | last post by:
I have an error occurring when i try to compile the program and the error is: D:\Program Files\visual studio 6.0\MSDev98\MyProjects\GLEnabledView\GLNew.cpp(164) : error C2653: 'CGLEnabledView' :...
2
by: randa zaghdan | last post by:
Hi I have a problem with my program in vc 2008 When I compile it, the following errors are listed. I try to resolve it but no hope Does any one can help me ? thanks . Linking......
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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 ...

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.