MySQL Errors w/ PHP
Moderator: General Moderators
MySQL Errors w/ PHP
I'm having a little troubles with a sql/news/forum script. I don't know if any of you know SQL that good but worth a shot. I even tried the tech support at mysql.com but there's not e-mail addy or forum to go to. Show's how much they care... Anyways, I get this error:
quote:
--------------------------------------------------------------------------------
Warning: Supplied argument is not a valid MySQL result resource in /home/news/news.php on line 59
--------------------------------------------------------------------------------
Line 59 is as follows:
quote:
--------------------------------------------------------------------------------
while ($r=mysql_fetch_array ($ergebnis))
--------------------------------------------------------------------------------
Now I'm in one dilly of a pickle. If anyone can give assistance, I'ld greatly appreciate it. Thanks.
quote:
--------------------------------------------------------------------------------
Warning: Supplied argument is not a valid MySQL result resource in /home/news/news.php on line 59
--------------------------------------------------------------------------------
Line 59 is as follows:
quote:
--------------------------------------------------------------------------------
while ($r=mysql_fetch_array ($ergebnis))
--------------------------------------------------------------------------------
Now I'm in one dilly of a pickle. If anyone can give assistance, I'ld greatly appreciate it. Thanks.
lol im not sure if you know mysql that well, heh
are u sure you copied that line properly cause ur missing the curly bracket.
should be
are u sure you copied that line properly cause ur missing the curly bracket.
Code: Select all
<?php
while ($r=mysql_fetch_array ($ergebnis))
?>Code: Select all
<?php
while ($r=mysql_fetch_array ($ergebnis)) {
//stuff
}
?>seems that $ergebnis is not a valid result resource - as mentioned in the error. 
May be you've forgotten the mysql_query ( i.e. // $ergebnis = mysql_query($sql); )
or misspelled the name: $Ergebnis = mysql_query($sql); )
or (most likely) the sql-statement is faulty.
May be you've forgotten the mysql_query ( i.e. // $ergebnis = mysql_query($sql); )
or misspelled the name: $Ergebnis = mysql_query($sql); )
or (most likely) the sql-statement is faulty.
- insert a print(mysql_error ()); after the query
- print the sql-statement before querying it. You may take this string and try it in a mysql-client.
Code: Select all
$ergebnis = mysql_query($sql) or die("you broke it - I'll tell the captain");// phpBB2 News Script by http://www.pcforen.de
// Version 0.23
// Download: http://www.pcforen.de/tools/news.zip
That's the program I'm using....well trying to use. Take a look at line 59.
// Version 0.23
// Download: http://www.pcforen.de/tools/news.zip
That's the program I'm using....well trying to use. Take a look at line 59.
more like 
but I think I got the problem. You probably haven't setup up the database/table. There is no setup in the archive, you have to do it manually (crap). And looking through the code I cann't find any post-routine. It's only displaying the content of the table$ergebnis = mysql_query($sql) or die(mysql_error());
I usedbut it was only a guess.
Search for another script. I think, this one isn't that good (might be wrong)
http://www.hotscripts.com/ has been proposed several times here as a source. Haven't checked it out yet - but why not?
Code: Select all
CREATE TABLE `phpbb2` (`topic_id` MEDIUMINT (3) UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT, `topic_title` VARCHAR (48) DEFAULT 'no topic' NOT NULL, `post_text` TEXT NOT NULL, `topic_time` DATETIME NOT NULL, `topic_replies` TEXT, `user_id` TINYINT UNSIGNED DEFAULT '0' NOT NULL, `username` VARCHAR (30) NOT NULL, UNIQUE(`topic_id`), INDEX(`topic_id`,`topic_time`))Search for another script. I think, this one isn't that good (might be wrong)
http://www.hotscripts.com/ has been proposed several times here as a source. Haven't checked it out yet - but why not?
if your provider allows remote connections you may use any mysql-client(-frontend) i.e. http://www.anse.de/mysqlfront/
But I changed the script to use only one table. I cann't tell you, how it was supposed to be and what features there have been. Have you posted the original link?
But I changed the script to use only one table. I cann't tell you, how it was supposed to be and what features there have been. Have you posted the original link?