can't find my error need fresh eyes

This is a discussion on can't find my error need fresh eyes within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/smith/public_html/addressbook/ab_functions.php on line ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-20-2007
gagal
 
Posts: n/a
Default can't find my error need fresh eyes

Warning: mysql_query(): supplied argument is not a valid MySQL-Link
resource in /home/smith/public_html/addressbook/ab_functions.php on
line 87
Query failed:

function adminApprovalNeeded ($connect, $db_table4)
{
$sql = "SELECT * FROM $db_table4 WHERE 'approved' = '0'";
87 --> $result = mysql_query ($sql, $connect) or die ('Query failed:
' .mysql_error());
$approved = mysql_num_rows($result);
echo "Address Book - You have $approved entries waiting for
approval.";
}

Reply With Quote
  #2 (permalink)  
Old 07-20-2007
Rik
 
Posts: n/a
Default Re: can't find my error need fresh eyes

On Fri, 20 Jul 2007 09:23:00 +0200, gagal <lynettesmith@gmail.com> wrote:

> Warning: mysql_query(): supplied argument is not a valid MySQL-Link
> resource in /home/smith/public_html/addressbook/ab_functions.php on
> line 87
> Query failed:
>
> function adminApprovalNeeded ($connect, $db_table4)
> {
> $sql = "SELECT * FROM $db_table4 WHERE 'approved' = '0'";
> 87 --> $result = mysql_query ($sql, $connect) or die ('Query failed:
> ' .mysql_error());
> $approved = mysql_num_rows($result);
> echo "Address Book - You have $approved entries waiting for
> approval.";
> }


The error is earlier, in the connection or the assigning it to $connect
itself. $connect does not hold a valid mysql-resource.
--
Rik Wasmus
Reply With Quote
  #3 (permalink)  
Old 07-20-2007
Michael Fesser
 
Posts: n/a
Default Re: can't find my error need fresh eyes

..oO(Rik)

>On Fri, 20 Jul 2007 09:23:00 +0200, gagal <lynettesmith@gmail.com> wrote:
>
>> Warning: mysql_query(): supplied argument is not a valid MySQL-Link
>> resource in /home/smith/public_html/addressbook/ab_functions.php on
>> line 87
>> Query failed:
>>
>> function adminApprovalNeeded ($connect, $db_table4)
>> {
>> $sql = "SELECT * FROM $db_table4 WHERE 'approved' = '0'";
>> 87 --> $result = mysql_query ($sql, $connect) or die ('Query failed:
>> ' .mysql_error());
>> $approved = mysql_num_rows($result);
>> echo "Address Book - You have $approved entries waiting for
>> approval.";
>> }

>
>The error is earlier, in the connection or the assigning it to $connect
>itself. $connect does not hold a valid mysql-resource.


Additionally, if that's the real code, the query will never return
anything, because 'approved' will never be equal to '0' ...

Micha
Reply With Quote
  #4 (permalink)  
Old 07-20-2007
Rik
 
Posts: n/a
Default Re: can't find my error need fresh eyes

On Fri, 20 Jul 2007 10:33:28 +0200, Michael Fesser <netizen@gmx.de> wrote:
> .oO(Rik)
>> On Fri, 20 Jul 2007 09:23:00 +0200, gagal <lynettesmith@gmail.com>
>> wrote:
>>> Warning: mysql_query(): supplied argument is not a valid MySQL-Link
>>> resource in /home/smith/public_html/addressbook/ab_functions.php on
>>> line 87
>>> $sql = "SELECT * FROM $db_table4 WHERE 'approved' = '0'";
>>> 87 --> $result = mysql_query ($sql, $connect) or die ('Query failed:

>>
>> The error is earlier, in the connection or the assigning it to $connect
>> itself. $connect does not hold a valid mysql-resource.

>
> Additionally, if that's the real code, the query will never return
> anything, because 'approved' will never be equal to '0' ...


He, indeed, sharp eye. Backticks, single quotes, aargh :-)
--
Rik Wasmus
Reply With Quote
  #5 (permalink)  
Old 07-20-2007
gagal
 
Posts: n/a
Default Re: can't find my error need fresh eyes

On Jul 20, 4:33 am, Michael Fesser <neti...@gmx.de> wrote:
> .oO(Rik)
>
>
>
> >On Fri, 20 Jul 2007 09:23:00 +0200, gagal <lynettesm...@gmail.com> wrote:

>
> >> Warning: mysql_query(): supplied argument is not a valid MySQL-Link
> >> resource in /home/smith/public_html/addressbook/ab_functions.php on
> >> line 87
> >> Query failed:

>
> >> function adminApprovalNeeded ($connect, $db_table4)
> >> {
> >> $sql = "SELECT * FROM $db_table4 WHERE 'approved' = '0'";
> >> 87 --> $result = mysql_query ($sql, $connect) or die ('Query failed:
> >> ' .mysql_error());
> >> $approved = mysql_num_rows($result);
> >> echo "Address Book - You have $approved entries waiting for
> >> approval.";
> >> }

>
> >The error is earlier, in the connection or the assigning it to $connect
> >itself. $connect does not hold a valid mysql-resource.

>
> Additionally, if that's the real code, the query will never return
> anything, because 'approved' will never be equal to '0' ...
>
> Micha


Yes, it is real code. After you said it wouldn't work, I went back
and tried again. It works this time (no 0 return). I still don't
understand why I am getting the error:

Warning: mysql_query(): supplied argument is not a valid MySQL-Link
resource in /home/smith/public_html/addressbook/ab_functions.php on
line 95
Query failed:

I am using the same code in another functions page and it works. This
one works:

function adminApprovalNeeded ($connect, $db_table8)
{
$sql = "SELECT * FROM $db_table8 WHERE approved != '1'";
$result = mysql_query ($sql, $connect) or die ('Query failed:
' .mysql_error());
$approved = mysql_num_rows($result);
echo "Directory - You have $approved entries waiting for approval.";
}

This one doesn't work:

function adminApprovalNeeded ($connect, $db_table4)
{
$sql = "SELECT * FROM $db_table4 WHERE 'approved' != '1'";
$result = mysql_query ($sql, $connect) or die ('Query failed:
' .mysql_error());
$approved = mysql_num_rows($result);
echo "Address Book - You have $approved entries waiting for
approval.";
}

They are on seperate pages so they do not cause conflict with each
other. Please help!

Reply With Quote
  #6 (permalink)  
Old 07-20-2007
gagal
 
Posts: n/a
Default Re: can't find my error need fresh eyes

Thanks. I finally found my very stupid error and fixed it. I still
have 1 question. Why are my posts delayed by several hours? It used
to be only a few minutes.

Reply With Quote
  #7 (permalink)  
Old 07-20-2007
Rik
 
Posts: n/a
Default Re: can't find my error need fresh eyes

On Fri, 20 Jul 2007 17:01:17 +0200, gagal <lynettesmith@gmail.com> wrote:
> Thanks. I finally found my very stupid error and fixed it. I still
> have 1 question. Why are my posts delayed by several hours? It used
> to be only a few minutes.


Don't use Google Groups. It was crap to begin with, and even shittier the
last several days. Use a real NNTP server & client, and the speed & user
comfort will be amazing.

Then again, delays are part of usenet.
--
Rik Wasmus
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:01 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0