473,408 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

mysql errors

Hi,
I've run a php script that uses mysql databases without problems
on one server, but then I changed web hosts and installed it the same
way buy I get a lot of errors which are all derived from the
script not being able to interact with the database.
It finds the database and connects, but then can't do anything else.
When it uses a database on a different server, things work fine,
so I'm guessing it's just a mysql error and not the fault of the script.

I'd appreciate any suggestions on how to deal with this.

thank you,
David

Jul 17 '05 #1
4 1923
"David Bruno" <we*******@lowestdomains.info> writes:
I've run a php script that uses mysql databases without problems
on one server, but then I changed web hosts and installed it the same
way buy I get a lot of errors which are all derived from the
script not being able to interact with the database.
What are the errors? Saying "I get a lot of errors" doesn't give
us much to analyze.
It finds the database and connects, but then can't do anything else.
How do you know the connection is successful? Does the code do
error checking? Is PHP configured to send errors to the browser?
If not, are you looking in the web server's error logs? See what
happens when you add the following lines to your script before
connecting to the database:

error_reporting(E_ALL);
ini_set('display_errors', True);

Errors can reveal Interesting Things to Bad Guys, so when you're
finished debugging it's usually a good idea to set display_errors
to False.
When it uses a database on a different server, things work fine,
so I'm guessing it's just a mysql error and not the fault of the script.
Possibly. Have you verified that you have permission to connect
to the database and that you have the necessary privileges once
connected?
I'd appreciate any suggestions on how to deal with this.


Please post the exact error messages and the code that caused them.
That'll probably tell us what's wrong.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #2
> What are the errors? Saying "I get a lot of errors" doesn't give
us much to analyze.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in /home/webzero/public_html/skijumping/global.inc.php on line 35

Warning: mysql_free_result(): supplied argument is not a valid MySQL result
resource in /home/webzero/public_html/skijumping/global.inc.php on line 36
How do you know the connection is successful? Does the code do
error checking? Is PHP configured to send errors to the browser?
Errors appear in the browser. Script has as setup.php file which
displays that is has connected to the database, but then
can't write any tables to it.
Possibly. Have you verified that you have permission to connect
to the database and that you have the necessary privileges once
connected?

I just have virtual hosting with cpanel 8.5. I create the database and
that's it. The script does all the set-up. How can I verifty or change
permissions.
Everything is chmod as the installation instructions say.

Thank you very much for your help.
-David
Jul 17 '05 #3
"David Bruno" <we*******@lowestdomains.info> writes:
What are the errors? Saying "I get a lot of errors" doesn't give
us much to analyze.


Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in /home/webzero/public_html/skijumping/global.inc.php on line 35

Warning: mysql_free_result(): supplied argument is not a valid MySQL result
resource in /home/webzero/public_html/skijumping/global.inc.php on line 36


It looks like mysql_query() is failing but the code isn't checking
for that failure. Modify your code to look like this:

$result = mysql_query($sql)
or die("mysql_query() failed: " . htmlentities(mysql_error()));

For production you might want to handle the error more gracefully.

The message from mysql_error() should tell you what's wrong. If
you still can't figure out the problem, then please post some code
so we can see exactly what you're doing.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #4
"Michael Fuhr" <mf***@fuhr.org> wrote in message
news:3f**********@omega.dimensional.com...
"David Bruno" <we*******@lowestdomains.info> writes:
What are the errors? Saying "I get a lot of errors" doesn't give
us much to analyze.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/webzero/public_html/skijumping/global.inc.php on line 35
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/webzero/public_html/skijumping/global.inc.php on line

36
It looks like mysql_query() is failing but the code isn't checking
for that failure. Modify your code to look like this:

$result = mysql_query($sql)
or die("mysql_query() failed: " . htmlentities(mysql_error()));

Do what michael says here. Also:
echo the query to screen right before you run it. Read it to see if it's
right. Maybe copy it and paste it into phpmyadmin or whatever else you use
to interact with the dB. Might yield more specific info
Jul 17 '05 #5

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

Similar topics

16
by: Angelos | last post by:
I've seen this in php.net $r=@mysql_query($query,$MySQL); and I do not understand what would be the difference of this : $r=mysql_query($query,$MySQL); I mean what is the purpose of " =@ " ?...
0
by: Lenz Grimmer | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, MySQL 4.0.14, a new version of the popular Open Source/Free Software Database, has been released. It is now available in source and binary...
1
by: jlee | last post by:
I'm pretty much a newbie on mysql, and I need some help. I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4 (i386) on a server hosting an active website. The site's developer...
0
by: Bill Bevis | last post by:
I'm trying to set up PHP 5.1.3 to run under Apache2, and talk to a MySQL 5.0.21 database, and have been banging my head against a tough install for days. I'm getting a slough of errors like this: ...
4
by: Vanessa | last post by:
Hi there I am an Access developer, and I have written applications for a 30 telephone call center, using the standard multiuser jet engine, it all works fine, but I want to move our systems onto...
1
by: mpar612 | last post by:
Hi everyone, I'm not sure if this is asking too much or not. I am trying to get the following PHP code to work on my website. It utilizes PHP 5, MySQL 4.1 and the PEAR DB module. I am...
110
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst...
0
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to...
3
by: menzies | last post by:
Hi, I"m new to this forum, but I have been trying all day to install DBD::mysql onto my Intel MacBook. I've read lots of forums pages and none have gotten me to a successful 'make test' or a...
1
by: swethak | last post by:
hi, when i run a java program for to store data and retrive using mysql datatabse i got the following errors.I think in that one of error is due to set the class path.I placed my...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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...

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.