dbTalk Databases Forums  

SELECT * works but SELECT FIELD1,FIELD2.. gives "supplied argument isnot a valid MySQL result"

comp.databases.mysql comp.databases.mysql


Discuss SELECT * works but SELECT FIELD1,FIELD2.. gives "supplied argument isnot a valid MySQL result" in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mig
 
Posts: n/a

Default SELECT * works but SELECT FIELD1,FIELD2.. gives "supplied argument isnot a valid MySQL result" - 09-02-2011 , 09:12 PM






Hello People, here is a problem I donīt know how to solve. I would
appreciate some clue for it.

In all my tables I use normally SELECT FIELD1,FIELD2...FIELDn from
table and never I got a single problem.

But there is a script where I canīt solve this one.

This table has a BLOB field with pictures, so when calling SELECT *
from TABLE it works ok, picture comes and display beautiful.

But when I call SELECT FIELD1..BLOB,..FIELDn from TABLE it produces a
"supplied argument is not a valid MySQL result " at
mysql_fetch_array() command. It shows error exactly that way, with
empty parentheses.

Before you say "probably you didnīt pass all necessary fields" I reply
just am using 4 fields, so its very difficult make mistake here, and
also when you forget some fields MySql doesnīt produces error, instead
giving an empty var.

this piece of code works ok

$Result = Mysql_Query("Select * From produto Where ID = '$XID' Limit 1
",$db);
$Myrow = Mysql_Fetch_Array($Result);
$tamanho=$Myrow["TAMANHO"];
$FOTO = $Myrow["FOTO"];
$LOJA = $Myrow["LOJA"];
$COD = $Myrow["COD"];

but this code gets error

$Result = Mysql_Query("Select TAMANHO,FOTO,LOJA,COD From produto Where
ID = '$XID' Limit 1 ",$db);
$Myrow = Mysql_Fetch_Array($Result);
$tamanho=$Myrow["TAMANHO"];
$FOTO = $Myrow["FOTO"];
$LOJA = $Myrow["LOJA"];
$COD = $Myrow["COD"];


Thanks very much

Mig

Reply With Quote
  #2  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: SELECT * works but SELECT FIELD1,FIELD2.. gives "supplied argumentis not a valid MySQL result" - 09-02-2011 , 10:03 PM






On 9/2/2011 10:12 PM, mig wrote:
Quote:
Hello People, here is a problem I donīt know how to solve. I would
appreciate some clue for it.

In all my tables I use normally SELECT FIELD1,FIELD2...FIELDn from
table and never I got a single problem.

But there is a script where I canīt solve this one.

This table has a BLOB field with pictures, so when calling SELECT *
from TABLE it works ok, picture comes and display beautiful.

But when I call SELECT FIELD1..BLOB,..FIELDn from TABLE it produces a
"supplied argument is not a valid MySQL result " at
mysql_fetch_array() command. It shows error exactly that way, with
empty parentheses.

Before you say "probably you didnīt pass all necessary fields" I reply
just am using 4 fields, so its very difficult make mistake here, and
also when you forget some fields MySql doesnīt produces error, instead
giving an empty var.

this piece of code works ok

$Result = Mysql_Query("Select * From produto Where ID = '$XID' Limit 1
",$db);
$Myrow = Mysql_Fetch_Array($Result);
$tamanho=$Myrow["TAMANHO"];
$FOTO = $Myrow["FOTO"];
$LOJA = $Myrow["LOJA"];
$COD = $Myrow["COD"];

but this code gets error

$Result = Mysql_Query("Select TAMANHO,FOTO,LOJA,COD From produto Where
ID = '$XID' Limit 1 ",$db);
$Myrow = Mysql_Fetch_Array($Result);
$tamanho=$Myrow["TAMANHO"];
$FOTO = $Myrow["FOTO"];
$LOJA = $Myrow["LOJA"];
$COD = $Myrow["COD"];


Thanks very much

Mig
First of all, ALWAYS check the result of a mysql_query() call. You're
just assuming it works - and it isn't.

mysql_query() is most probably returning false - in which case you need
to determine why. mysql_error() is a good place to start.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================

Reply With Quote
  #3  
Old   
mig
 
Posts: n/a

Default Re: SELECT * works but SELECT FIELD1,FIELD2.. gives "suppliedargument is not a valid MySQL result" - 09-02-2011 , 10:30 PM



Hello Sir, thanks very much, I discovered the problem, I think nobody
here thought this would happen, but when you place the BLOB field at
FIRST posicion , aleluhyah IT WORKS! , so the trick is to make SELECT
BLOB,FIELD1,...FIELDn....

Mig

Quote:
First of all, ALWAYS check the result of a mysql_query() call. *You're
just assuming it works - and it isn't.

mysql_query() is most probably returning false - in which case you need
to determine why. *mysql_error() is a good place to start.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck... (AT) attglobal (DOT) net
==================- Hide quoted text -

- Show quoted text -

Reply With Quote
  #4  
Old   
Axel Schwenke
 
Posts: n/a

Default Re: SELECT * works but SELECT FIELD1,FIELD2.. gives "supplied argument is not a valid MySQL result" - 09-03-2011 , 02:04 AM



mig <m02041952 (AT) yahoo (DOT) com> wrote:

Quote:
I discovered the problem, I think nobody
here thought this would happen, but when you place the BLOB field at
FIRST posicion , aleluhyah IT WORKS! , so the trick is to make SELECT
BLOB,FIELD1,...FIELDn....
This is nonsense. It does not matter at which place in the select list
the blob field is located.


XL

Reply With Quote
  #5  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: SELECT * works but SELECT FIELD1,FIELD2.. gives "supplied argumentis not a valid MySQL result" - 09-03-2011 , 07:47 AM



On 9/2/2011 11:30 PM, mig wrote:
Quote:
Hello Sir, thanks very much, I discovered the problem, I think nobody
here thought this would happen, but when you place the BLOB field at
FIRST posicion , aleluhyah IT WORKS! , so the trick is to make SELECT
BLOB,FIELD1,...FIELDn....

Mig


No, that isn't your problem. It makes no difference where the BLOB (or
any other column) is in the list. You probably have a syntax error in
your SELECT statement which you corrected when you rewrote it with the
BLOB column first. It's easy to do.

Also, please don't top post. Thanks.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================

Reply With Quote
  #6  
Old   
The Natural Philosopher
 
Posts: n/a

Default Re: SELECT * works but SELECT FIELD1,FIELD2.. gives "supplied argumentis not a valid MySQL result" - 09-03-2011 , 02:35 PM



Axel Schwenke wrote:
Quote:
mig <m02041952 (AT) yahoo (DOT) com> wrote:

I discovered the problem, I think nobody
here thought this would happen, but when you place the BLOB field at
FIRST posicion , aleluhyah IT WORKS! , so the trick is to make SELECT
BLOB,FIELD1,...FIELDn....

This is nonsense. It does not matter at which place in the select list
the blob field is located.


XL
I suspect a syntax error...

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.