473,405 Members | 2,187 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,405 software developers and data experts.

same mysql query doesn't always return a result

We have no access to a mysql NG on my provider's server, so we ask here:

We have a long query (long in text) with a UNION between 2 select.

We have been informed that some times the query doesn't return any result.
We have tried on our server and we always get a result. BUT, trying on the
hosting server, many times the query doesn't return any result and doesn't
get any error.

Any idea ? does Union have any problem ? how to check if the query failed ?
My hoster said that sometimes the table can be locked (if the server is
overloaded) and then mysql doesn't return any result, but this seems to me
an aberration.

the query takes about 0.0050 sec to execute when it doesn't return any
result, and 0.030 when I get results

Please help !

Sep 9 '05 #1
4 3473
Bob Bedford said the following on 09/09/2005 08:04:
We have no access to a mysql NG on my provider's server, so we ask here:

We have a long query (long in text) with a UNION between 2 select.

We have been informed that some times the query doesn't return any result.
We have tried on our server and we always get a result. BUT, trying on the
hosting server, many times the query doesn't return any result and doesn't
get any error.

Any idea ?


What is the query?
--
Oli
Sep 9 '05 #2
Do you mean the query string is long, or the result set is? How long are we
talking?

Some things to try:

Right after executing the query if you don't get a result, do an "echo
mysql_error();" This will tell you if there was an error message.

Check MySQL's "max_allowed_packet" variable. This can cause problems with
long queries (although you should get an error).

Is it possible that the result of your query really is empty (i.e., the
WHERE or HAVING clauses aren't satisfied)?

- Kevin

"Bob Bedford" <be******@notforspammershotmail.com> wrote in message
news:43**********************@news.sunrise.ch...
We have no access to a mysql NG on my provider's server, so we ask here:

We have a long query (long in text) with a UNION between 2 select.

We have been informed that some times the query doesn't return any result.
We have tried on our server and we always get a result. BUT, trying on the
hosting server, many times the query doesn't return any result and doesn't
get any error.

Any idea ? does Union have any problem ? how to check if the query failed
?
My hoster said that sometimes the table can be locked (if the server is
overloaded) and then mysql doesn't return any result, but this seems to me
an aberration.

the query takes about 0.0050 sec to execute when it doesn't return any
result, and 0.030 when I get results

Please help !

Sep 9 '05 #3
Hello Kevin, thanks for the reply,
Do you mean the query string is long, or the result set is? How long are
we talking? The query itself, it must return 2 results quite shorts.
Some things to try:

Right after executing the query if you don't get a result, do an "echo
mysql_error();" This will tell you if there was an error message.

Check MySQL's "max_allowed_packet" variable. This can cause problems with
long queries (although you should get an error).

Is it possible that the result of your query really is empty (i.e., the
WHERE or HAVING clauses aren't satisfied)?

No, as the query is ALWAYS the same and no changes are made on the database
(no new records, no changes at all).
There is no error, that's the strangest thing.

It's like the query wouldn't return any result, but when done again, then it
returns a result. The behaviour is quite random. It may work 5 times and
then not 2 times then work again once then not 6 times....

very strange.
Sep 14 '05 #4
Hello Oli,

thanks for reply,

"Oli Filth" <ca***@olifilth.co.uk> a écrit dans le message de news:
Dv***********@newsfe7-win.ntli.net...
Bob Bedford said the following on 09/09/2005 08:04:
We have no access to a mysql NG on my provider's server, so we ask here:

We have a long query (long in text) with a UNION between 2 select.

We have been informed that some times the query doesn't return any
result.
We have tried on our server and we always get a result. BUT, trying on
the
hosting server, many times the query doesn't return any result and
doesn't
get any error.

Any idea ?


What is the query?


it something like (select x,y,z from 3 tables, with 10 left and inner join)
union (same thing than first query)

It shouldn't change anything, since the real problem is that sometimes it
works and sometimes it doesn't.

Bob
Sep 14 '05 #5

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

Similar topics

2
by: Jim Hatfield | last post by:
I'm using: "select min(objid) from table_name where objid > $objid" to select the next row in a sequence where there may be gaps. It works fine unless the where clause results in an empty set. ...
0
by: Phil Powell | last post by:
The table already has a fulltext index and from there I can use the MySQL fulltext search query to get results as well as the relevancy score. The problem I have is that MySQL has a default...
2
by: chuy08 | last post by:
Basically I am using PHP 5.1.2 with Apache 2.0.5 on a FreeBSD 5.4 box with Mysql 4.1.1 running. I am attempting to write information to a Mysql table called Jabber. I can connect successfully,...
7
by: Ivan Marsh | last post by:
Hey Folks, I'm having a heck of a time wrapping mind around AJAX. Anyone know of a simple, straight-forward example for pulling a simple query from mysql with PHP using AJAX? As I...
2
by: paranic | last post by:
Hi there i suppose we have the following class file database.php class InSQL { function query($query, $link_identifier=null) { global $query_totals;
10
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
15
by: harvey | last post by:
How do I make PHP create a database for mysql please? I can see how to make tables and I have read all the documents I can find but I don't understand how to make the database itself. All...
2
by: =?iso-8859-1?B?Sm/jbyBNb3JhaXM=?= | last post by:
Hi there guys, My doubt is related to PHP and MySQL usage, and it's related to check if performed queries are performed with success, since we know that: Each time we perform an sql query,...
21
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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,...
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
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
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...

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.