473,659 Members | 3,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

About PHP::: Error/Problem PHP Warning: mysql_fetch_arr ay():

Hi Everyone

=============== =============== =============== =============== ==
About PHP::: Error/Problem PHP Warning: mysql_fetch_arr ay():
=============== =============== =============== =============== ==

In the past i use my code/script work fine with
Mandrake 9.1 - 10.1 ( + apache ,mysql )

Now i move to redhat EL4 with the same code/script

I got error can't login to my code.
and found error on /var/log/httpd/error_log like this

PHP Warning: mysql_num_rows( ): supplied argument is not a valid MySQL
result resource in /var/www/html/website_in_serv er/showdata.php

or

PHP Warning: mysql_fetch_arr ay(): supplied argument is not a valid
MySQL result resource in /var/www/html/website_in_serv er/showdata.php
I think problem source from php.ini or httpd.conf .

Anyone can help me sir.. ?

thank you for advance

Jul 25 '05 #1
3 3426
On 25 Jul 2005 12:11:19 -0700, "Pratchaya" <pr*******@bana na.co.th> wrote:
============== =============== =============== =============== ===
About PHP::: Error/Problem PHP Warning: mysql_fetch_arr ay():
============== =============== =============== =============== ===

In the past i use my code/script work fine with
Mandrake 9.1 - 10.1 ( + apache ,mysql )

Now i move to redhat EL4 with the same code/script

I got error can't login to my code.
and found error on /var/log/httpd/error_log like this

PHP Warning: mysql_num_rows( ): supplied argument is not a valid MySQL
result resource in /var/www/html/website_in_serv er/showdata.php
This means you did not check whether a previous mysql_* call (probably
mysql_query) was successful, and you continued anyway despite receiving "false"
as the return value.
I think problem source from php.ini or httpd.conf .


No, it's missing error handling in your showdata.php file.

Check for whether the mysql_query call returned false - if it did, use
mysql_error() to display the error.

A simple way of doing this is:

$result = mysql_query($sq l)
or die(mysql_error ());

This is not very user friendly, but it does stop the script going any further
past an error, and tells you what the error is.

Once you've got that sorted you would be better off changing it to present a
more user friendly message rather than the raw underlying error.

If you don't understand the error that the mysql_error() function produces
here, then post that error back again, with a _short_ extract of the code
around the error, and someone here may be able to help you with the actual
problem.

--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
Jul 25 '05 #2
> I got error can't login to my code.
and found error on /var/log/httpd/error_log like this


Have your database login details changed?
Jul 26 '05 #3
No. sir

it same both code and database sir.

Jul 27 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
2197
by: Rod Carrol | last post by:
Hello all, As a beginner I've been exeperiencing lots of errors while building my website, (I'm currently attempting to implement a member login/registration piece for my site using mySQL and PHP) I've read that PHP is secure in that it hides lots of code from hackers and people trying to snoop around on the web site running the PHP scripts - however, one thing I've noticed is that whenever I get a script error, (for example, failure...
15
1816
by: Stat | last post by:
Greetings all. I am writing a profile creator script where a user gets a URL invite in their mail in the form of; http://domain.com/profile-create.php?access_code=Ikd98jadf098asdf Things are working well except for a small annoyance in which someone might have a solution to. In the event that someone accesses profile-create.php without an access_code the script generates a warning. If there is an access_code
11
2257
by: mikey_boy | last post by:
Hello! Curious if anyone could give me a hand. I wrote this PHP script with makes a simple connection to a mysql database called firstdb and just pulls back the results and displays on the webpage. Here is the script. I appreciate any light that could be shed on the script and why I would get the errors. Thank you,
11
1927
by: cwhite | last post by:
i recently upgraded from fedora core 5 to cent os 4.4 with php 4.3 mysql 4.1 and apache 2.0.52, and all of the php scripts i had which called specific entries from mysql are no longer working if i had a link display_story.php?id=334 it would know do display the entry which matched id 334, my code to display the entry looks like this <?php $Host="localhost";
1
3315
by: jenson | last post by:
<?php /* * Created on Apr 13, 2007 * * To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates */ require_once 'init.php'; $con=mysql_connect("localhost","root",""); $dbc=mysql_select_db(test,$con)or die("Database select error:" . mysql_error($con));
11
2309
by: mishrarajesh44 | last post by:
i am facing problem in php session.. my code is giving error.. i am giving my code and error message below.. my code:- <?php if(isset($_POST)) { if(empty($password)){echo "No password specified";}
21
3696
by: bruno_guedesav | last post by:
I've made a function to fetch all results as an array of result- arrays. Getting the result arrays is easy, via mysql_fetch_array, and function itself is quite simple, as follows: function db_query($db, $query) { $result = mysql_query($query, $db); $res_array = array(); if ($result) //it is a search
1
1565
by: BenKen | last post by:
Please I'm trying to delete from the database and I get this error Warning: session_start() : Cannot send session cache limiter - headers already sent (output started at E:\webareas\while\shop\deletebag.php:1) in E:\webareas\while\shopping\deletebag.php on line 2 Warning: Cannot modify header information - headers already sent by (output started at E:\webareas\while\shopping\deletebag.php:1) in E:\webareas\while\shopping\deletebag.php on...
0
8428
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
8851
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...
1
8531
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
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
7359
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...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
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...
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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.