[PHP-DB] not a valid MySQL result

2003-08-01 Thread Lee Templeton
I'm trying to do a full text search to a MySQL database and have a problem
being able to read the results:

here is my code:
---
$query = SELECT name,title,branch,section_one,section_two,MATCH
(section_header,section_one,section_two,section_footer) AGAINST
('.$searchCriteria.') AS score FROM pages WHERE MATCH
(section_header,section_one,section_two,section_footer) AGAINST
('.$searchCriteria.' IN BOOLEAN MODE) HAVING score  0.2 ORDER BY score
DESC;;
 $results = mysql_query($query, $database) or die(mysql_error());
 $num_rows = mysql_num_rows($results);

 for($i=0;$i$num_rows;$i++)
 {
  $row = mysql_fetch_object( $results);
   $body = substr($row-section_one, 0, 150);
  $results .= bra
href=\index.php?page=.$row-name.\.$row-title./a
(.$row-branch.)br.$body.brbr;
 }

Here is the results:
---
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result
resource in C:\Inetpub\wwwroot\ymca\index.php on line 19

Notices:
--
Line 19 = $row = mysql_fetch_object( $results);

$num_rows returns a value of 8;

The first row retrieved from the results list works and returns the row with
Resource id #3 prefixed to the prinouts.  After the first row all futher
retrievals fail.

Configuration:
--
I am using MySQL 4.0.12 and PHP 4.3.2



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] not a valid MySQL result

2003-08-01 Thread Jason Wong
On Saturday 02 August 2003 11:48, Lee Templeton wrote:

 The first row retrieved from the results list works and returns the row
 with Resource id #3 prefixed to the prinouts.  After the first row all
 futher retrievals fail.

The variable $results is stressed by being forced to do two different jobs. 
Try using another variable to help it out.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
There are two kinds of pedestrians... the quick and the dead.
-- Lord Thomas Rober Dewar
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] not a valid MySQL result

2002-09-06 Thread Wilmar Perez

Hello guys

This is my first posting to the list, even though I've had some experience 
with C++, these are my first steps with php and mysql.

Well, the thing is that I'm getting the following message:

Warning: Supplied argument is not a valid MySQL result resource 
in /var/www/bva/new/main/colecciones.php on line 35

The code is shown below:

$query_cat = select author_names || ' ' || author_surnames 
  from author, author-cat
  where author_cat.cat_code = $code
  and author.author_code = author-cat.author_code;


$result_cat = mysql_query($query_cat);

$num_results_cat = mysql_num_rows($result_cat);  //This is line 35


I did the same with a simpler select sentence and it worked alright, so I 
guess there's a problem with the select sentence but haven't been able to 
find it.

Does anyone have an idea?

Thanks a lot for your help.

***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105145
University of Antioquia
   Medellín - Colombia
  2002
***
 
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] not a valid MySQL result

2002-09-06 Thread bbonkosk

Hello,

It's always good practice to put some error detection in your code, i.e. 
$result = mysql_query($query)
or die(mysql_error());

I think your problem is the mysql does not like your query, but you are not 
catching it until PHP tries to figure out the number of rows returned by the 
query.  

HTH
-Brad
 

 Hello guys
 
 This is my first posting to the list, even though I've had some
experienc e 
 with C++, these are my first steps with php and mysql.
 
 Well, the thing is that I'm getting the following message:
 
 Warning: Supplied argument is not a valid MySQL result resource 
 in /var/www/bva/new/main/colecciones.php on line 35
 
 The code is shown below:
 
 $query_cat = select author_names || ' ' || author_surnames 
 from author, author-cat
 where author_cat.cat_code = $code
 and author.author_code = author-cat.author_code;
   
   
 $result_cat = mysql_query($query_cat);
   
 $num_results_cat = mysql_num_rows($result_cat);  //This is line 35
 
 
 I did the same with a simpler select sentence and it worked alright, so
I  
 guess there's a problem with the select sentence but haven't been able
to  
 find it.
 
 Does anyone have an idea?
 
 Thanks a lot for your help.
 
 ***
  Wilmar Pérez
  Network Administrator
Library System
   Tel: ++57(4)2105145
 University of Antioquia
Medellín - Colombia
   2002
 ***
  
  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] not a valid MySQL result

2002-09-06 Thread Peter Lovatt

Hi

Couple of points, you probably have an SQL error,

I use

echo $query;
echo 'br'.mysql_error();

which shows the query and the error

you use 'author-cat' in the table name
and 'author_cat' and 'author-cat' in the where clause which will throw an
error.

HTH

Peter



---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
tel. 0121-242-1473
---

-Original Message-
From: Wilmar Perez [mailto:[EMAIL PROTECTED]]
Sent: 06 September 2002 16:51
To: php-db mailing list
Subject: [PHP-DB] not a valid MySQL result


Hello guys

This is my first posting to the list, even though I've had some experience
with C++, these are my first steps with php and mysql.

Well, the thing is that I'm getting the following message:

Warning: Supplied argument is not a valid MySQL result resource
in /var/www/bva/new/main/colecciones.php on line 35

The code is shown below:

$query_cat = select author_names || ' ' || author_surnames
  from author, author-cat
  where author_cat.cat_code = $code
  and author.author_code = author-cat.author_code;


$result_cat = mysql_query($query_cat);

$num_results_cat = mysql_num_rows($result_cat);  //This is line 35


I did the same with a simpler select sentence and it worked alright, so I
guess there's a problem with the select sentence but haven't been able to
find it.

Does anyone have an idea?

Thanks a lot for your help.

***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105145
University of Antioquia
   Medellín - Colombia
  2002
***



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] not a valid MySQL result

2002-09-06 Thread Wilmar Perez

Hi guys

Thanks for your help.  Peter was right I had an error in the sentence, I 
worked it out but still the same error came up.  The mysql_error() function 
doesn't return any thing.

Any idea?

Thanks a lot.

Hi

Couple of points, you probably have an SQL error,

I use

echo $query;
echo 'br'.mysql_error();

which shows the query and the error

you use 'author-cat' in the table name
and 'author_cat' and 'author-cat' in the where clause which will throw an
error.

***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105145
University of Antioquia
   Medellín - Colombia
  2002
***
 
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] not a valid MySQL result

2002-09-06 Thread Jim Hunter

Change your query to be:

$query_cat = select concat(author_names, ' ', author_surnames) as 
somenewcolname from author, author-cat
where author_cat.cat_code = $code
and author.author_code = author-cat.author_code;

Change somenewcolname to whatever you want the column to be called or leave
the as somenewcolname part off if you don't care what the column name is.
This should help.

Jim



---Original Message---

From: Wilmar Perez
Date: Friday, September 06, 2002 12:16:28
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] not a valid MySQL result

Hi guys

Thanks for your help. Peter was right I had an error in the sentence, I 
worked it out but still the same error came up. The mysql_error() function 
doesn't return any thing.

Any idea?

Thanks a lot.

Hi

Couple of points, you probably have an SQL error,

I use

echo $query;
echo 'br'.mysql_error();

which shows the query and the error

you use 'author-cat' in the table name
and 'author_cat' and 'author-cat' in the where clause which will throw an
error.

***
Wilmar Pérez
Network Administrator
Library System
Tel: ++57(4)2105145
University of Antioquia
Medellín - Colombia
2002 
*** 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

.


Re: [PHP-DB] not a valid MySQL result

2002-09-06 Thread Jim Hunter

Oops, you have one more error that I see, one one line you reference
author-cat as a table name and on another you refer to it as author_cat.
Make the appropriate change and try it again. One of the table references is
wrong and will generate a missing table error.

Jim

---Original Message---

From: Wilmar Perez
Date: Friday, September 06, 2002 09:57:48
To: php-db mailing list
Subject: [PHP-DB] not a valid MySQL result

Hello guys

This is my first posting to the list, even though I've had some experience 
with C++, these are my first steps with php and mysql.

Well, the thing is that I'm getting the following message:

Warning: Supplied argument is not a valid MySQL result resource 
in /var/www/bva/new/main/colecciones.php on line 35

The code is shown below:

$query_cat = select author_names || ' ' || author_surnames 
from author, author-cat
where author_cat.cat_code = $code
and author.author_code = author-cat.author_code;


$result_cat = mysql_query($query_cat);

$num_results_cat = mysql_num_rows($result_cat); //This is line 35


I did the same with a simpler select sentence and it worked alright, so I 
guess there's a problem with the select sentence but haven't been able to 
find it.

Does anyone have an idea?

Thanks a lot for your help.

***
Wilmar Pérez
Network Administrator
Library System
Tel: ++57(4)2105145
University of Antioquia
Medellín - Colombia
2002 
*** 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

.


RE: [PHP-DB] Not a valid MySQL result resource

2001-11-09 Thread matt stewart

don't you need it to be SELECT login, password...
lowercase first letter? - if you're comparing the columns user.login and
user.password.

-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: 09 November 2001 01:34
To: MPropre
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Not a valid MySQL result resource


 ?php
 //.../... first part of the code is to connect to the right DB on a MySQL
 server. It works fine
 //This code to show the query. It runs well under MySQL and gives 1 result
:
  $query=SELECT Login, Password FROM `user` WHERE user.login=''$login''
and
 user.password=''$password'';
 //This var should contain a query result ressource:
  $result_query=mysql_query($query);
 //Here's my error message after executing:
 // Supplied argument is not a valid MySQL result resource in this line:
  $result_table=mysql_fetch_array($result_query);
 // I thought that this var ($result_table) should contain the row of 2
cells
 //And I expected to read $result_table['login'] or $result_table[0] as the
 first cell of the row...
 // I any of you can help me, poor php newby... :o) Great thanks !!
 ?


=Please check the archives for advice about checking the result of every
mysql_...() call. It's much better to
know/be told by PHP/MySQL than to say I thought that...I expected to ...
=the $query assignment statement contains multiple double-quotes. These
cannot be 'nested'. Use a mixture of
single and double-quotes or 'escape' the inner set(s).
=also (and this may be a function of our email packages not a PHP thing) are
those single quotes around user?

=dn



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Not a valid MySQL result resource

2001-11-08 Thread MPropre

?php
//.../... first part of the code is to connect to the right DB on a MySQL
server. It works fine


//This code to show the query. It runs well under MySQL and gives 1 result :
 $query=SELECT Login, Password FROM `user` WHERE user.login=''$login'' and
user.password=''$password'';

//This var should contain a query result ressource:
 $result_query=mysql_query($query);

//Here's my error message after executing:
// Supplied argument is not a valid MySQL result resource in this line:
 $result_table=mysql_fetch_array($result_query);

// I thought that this var ($result_table) should contain the row of 2 cells
//And I expected to read $result_table['login'] or $result_table[0] as the
first cell of the row...
// I any of you can help me, poor php newby... :o) Great thanks !!

?



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Not a valid MySQL result resource

2001-11-08 Thread Paul DuBois

At 2:04 AM +0100 11/9/01, MPropre wrote:
?php
//.../... first part of the code is to connect to the right DB on a MySQL
server. It works fine


//This code to show the query. It runs well under MySQL and gives 1 result :
  $query=SELECT Login, Password FROM `user` WHERE user.login=''$login'' and
user.password=''$password'';

//This var should contain a query result ressource:
  $result_query=mysql_query($query);

//Here's my error message after executing:

Not so fast.  Where's your error checking to verify that the
query actually succeeded?

if (!$result_query)
{
 die (Gee, I guess error checking is a good thing after all!
  . mysql_error ());
}

// Supplied argument is not a valid MySQL result resource in this line:
  $result_table=mysql_fetch_array($result_query);

// I thought that this var ($result_table) should contain the row of 2 cells
//And I expected to read $result_table['login'] or $result_table[0] as the
first cell of the row...
// I any of you can help me, poor php newby... :o) Great thanks !!

?



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Not a valid MySQL result resource

2001-11-08 Thread DL Neil

 ?php
 //.../... first part of the code is to connect to the right DB on a MySQL
 server. It works fine
 //This code to show the query. It runs well under MySQL and gives 1 result :
  $query=SELECT Login, Password FROM `user` WHERE user.login=''$login'' and
 user.password=''$password'';
 //This var should contain a query result ressource:
  $result_query=mysql_query($query);
 //Here's my error message after executing:
 // Supplied argument is not a valid MySQL result resource in this line:
  $result_table=mysql_fetch_array($result_query);
 // I thought that this var ($result_table) should contain the row of 2 cells
 //And I expected to read $result_table['login'] or $result_table[0] as the
 first cell of the row...
 // I any of you can help me, poor php newby... :o) Great thanks !!
 ?


=Please check the archives for advice about checking the result of every mysql_...() 
call. It's much better to
know/be told by PHP/MySQL than to say I thought that...I expected to ...
=the $query assignment statement contains multiple double-quotes. These cannot be 
'nested'. Use a mixture of
single and double-quotes or 'escape' the inner set(s).
=also (and this may be a function of our email packages not a PHP thing) are those 
single quotes around user?

=dn



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Not a valid MySQL result resource

2001-11-08 Thread Miles Thompson

I'd check for mysql_num_rows( $result_query)  0 as well.
It's entirely possible the user mis-typed the login or password values.
Miles

At 07:26 PM 11/8/01 -0600, Paul DuBois wrote:
At 2:04 AM +0100 11/9/01, MPropre wrote:
?php
//.../... first part of the code is to connect to the right DB on a MySQL
server. It works fine


//This code to show the query. It runs well under MySQL and gives 1 result :
  $query=SELECT Login, Password FROM `user` WHERE user.login=''$login'' and
user.password=''$password'';

//This var should contain a query result ressource:
  $result_query=mysql_query($query);

//Here's my error message after executing:

Not so fast.  Where's your error checking to verify that the
query actually succeeded?

if (!$result_query)
{
 die (Gee, I guess error checking is a good thing after all!
  . mysql_error ());
}

// Supplied argument is not a valid MySQL result resource in this line:
  $result_table=mysql_fetch_array($result_query);

// I thought that this var ($result_table) should contain the row of 2 cells
//And I expected to read $result_table['login'] or $result_table[0] as the
first cell of the row...
// I any of you can help me, poor php newby... :o) Great thanks !!

?



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]