Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Warning help needed - clueless

 
   Database Help (Home) -> PHP SQL RSS
Next:  TESTING - IGNORE  
Author Message
Earle

External


Since: Apr 27, 2008
Posts: 1



(Msg. 1) Posted: Sun Apr 27, 2008 11:48 am
Post subject: Warning help needed - clueless
Archived from groups: alt>php>sql (more info?)

Hello
I have been moderating a phpweblog website (www.sfdrcm.com) but am clueless
about the programming.
In the last few days the following warning had appeared before each news
article

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /home/sfdrcm/www/include/common.inc.php on line 94

The code block that contains line 94 is this:

function F_topicsel($topic="1") {
global $db;
$sql = "SELECT * FROM T_Topics";
$result = mysql_query($sql,$db);
$nrows = mysql_num_rows($result);
$tmp = "";
for ($i=0;$i<$nrows;$i++) {
$A = mysql_fetch_array($result);
$foo = $A["Topic"];
$ass = ($A["Rid"]==$topic ? "selected" : "");
$tmp .= sprintf("<option\tvalue\t= \"%s\" %s>%s</option>\n",
$A["Rid"],$ass,$foo);
}
return $tmp;

I'm not a programmer. What do I need to do to stop this error message?
Thanks






;

 >> Stay informed about: Warning help needed - clueless 
Back to top
Login to vote
J.O. Aho

External


Since: Dec 01, 2003
Posts: 164



(Msg. 2) Posted: Sun Apr 27, 2008 10:03 pm
Post subject: Re: Warning help needed - clueless [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Earle wrote:
> Hello
> I have been moderating a phpweblog website (www.sfdrcm.com) but am
> clueless about the programming.
> In the last few days the following warning had appeared before each news
> article
>
> Warning: mysql_result(): supplied argument is not a valid MySQL result
> resource in /home/sfdrcm/www/include/common.inc.php on line 94

This indicates that the SQL question failed, as if the table T_Topics
has changed name or that the privileges has been changed for the user
you are connected in the php script.


> The code block that contains line 94 is this:
>
> function F_topicsel($topic="1") {
> global $db;
> $sql = "SELECT * FROM T_Topics";
> $result = mysql_query($sql,$db);
> $nrows = mysql_num_rows($result);
> $tmp = "";
> for ($i=0;$i<$nrows;$i++) {
> $A = mysql_fetch_array($result);
> $foo = $A["Topic"];
> $ass = ($A["Rid"]==$topic ? "selected" : "");
> $tmp .= sprintf("<option\tvalue\t= \"%s\" %s>%s</option>\n",
> $A["Rid"],$ass,$foo);
> }
> return $tmp;
>}

function F_topicsel($topic="1") {
global $db;
$sql = "SELECT * FROM T_Topics";
$result = mysql_query($sql,$db);
if(!$result) { return; }
$nrows = mysql_num_rows($result);
$tmp = "";
for ($i=0;$i<$nrows;$i++) {
$A = mysql_fetch_array($result);
$foo = $A["Topic"];
$ass = ($A["Rid"]==$topic ? "selected" : "");
$tmp .= sprintf("<option\tvalue\t= \"%s\" %s>%s</option>\n",
$A["Rid"],$ass,$foo);
}
return $tmp;
}


--

//Aho

 >> Stay informed about: Warning help needed - clueless 
Back to top
Login to vote
NC

External


Since: Nov 20, 2007
Posts: 102



(Msg. 3) Posted: Tue Apr 29, 2008 8:11 am
Post subject: Re: Warning help needed - clueless [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Apr 27, 11:48 am, "Earle" <sfd....DeleteThis@hotmail.com> wrote:
>
> In the last few days the following warning had appeared before
> each news article
>
> Warning: mysql_result(): supplied argument is not a valid MySQL
> result resource in /home/sfdrcm/www/include/common.inc.php on
> line 94
>
> I'm not a programmer. What do I need to do to stop this error
> message?

Get somebody who understands database administration to look
into it. The kind of error you are seeing usually indicates
a database-level problem. Something has changed in the
database server. Maybe permissions were modified and your
application no longer can access the database. Maybe the
database table was accidentally dropped, renamed, or
corrupted. Without taking a look "under the hood", it's
hard to say...

Cheers,
NC
 >> Stay informed about: Warning help needed - clueless 
Back to top
Login to vote
Display posts from previous:   
   Database Help (Home) -> PHP SQL All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]