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

Warning help needed - clueless

 
   Database Help (Home) -> PHP SQL RSS
Next:  Bug Bounty program  
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: 190



(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: 109



(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" 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:   
Related Topics:
PHPtriad v2.2.1 removal - When I fist started using apache/php/mysql I used phptriad [a wonderful piece of kit] to get me up and running. I've used this ever since. I'm think inow of 'upgrading' to laters versions of all three applications, and have found various tutorials/Ho...

MySQL regular expression to match a imploded item - Hello I need to use MySQL's REGEXP (POSIX compliant) to search registries where one field is an imploded set of integer values separated with pipes "|". I need to match one of these imploded values directly on a sql select. $sql = "SELECT...

Weird mysql_connect problem - Hello. My mysql_connect just started to give me following error today, Fatal error: Call to undefined function: mysql_connect() in ..../database_functions/db_functions.inc.php on line 11. So it seems that my php no longer finds php-mysql module...

MySQL - question about displaying data - I am working an some pages that have database content on them. I'm sorry that I don't have any versions of it online yet, but it isn't hard to explain. The site lists restaurants with contact information. All of the information is kept in a MySQL..

How can i Optimize sql Query ? - Hi, I'd like to optimize this query: Code: SELECT * FROM `links` WHERE active = "1" AND mainweight != 0 ORDER BY Rand()*(1/mainweight) LIMIT 5 I have a database of links wich has 3 000 rows. I'd like to select weighted random links from ...
   Database Help (Home) -> PHP SQL All times are: Pacific Time (US & Canada)
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 ]