Page 1 of 2
MySQL Errors w/ PHP
Posted: Sun Jun 02, 2002 12:13 pm
by jon1
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.
Posted: Sun Jun 02, 2002 12:21 pm
by mykg4orce
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.
Code: Select all
<?php
while ($r=mysql_fetch_array ($ergebnis))
?>
should be
Code: Select all
<?php
while ($r=mysql_fetch_array ($ergebnis)) {
//stuff
}
?>
Posted: Sun Jun 02, 2002 12:38 pm
by jon1
Yes I did. And { is on line 60.
Posted: Sun Jun 02, 2002 12:38 pm
by volka
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.
- 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.
I always use something like this
Code: Select all
$ergebnis = mysql_query($sql) or die("you broke it - I'll tell the captain");
Posted: Sun Jun 02, 2002 6:31 pm
by jon1
// 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.
Posted: Sun Jun 02, 2002 8:17 pm
by volka
even better: post the result of print(mysql_error())

I've installed it and it's working.
Now I have a board of my own - I'm ready to take over the world

Posted: Sun Jun 02, 2002 8:26 pm
by jon1
arghh, now its taking a year and a day for my site to load....
Posted: Sun Jun 02, 2002 8:27 pm
by jon1
while ($ergebnis = mysql_query($sql) ) print(mysql_error ());
Like that right?
Posted: Sun Jun 02, 2002 8:31 pm
by volka
more like
$ergebnis = mysql_query($sql) or die(mysql_error());
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

Posted: Sun Jun 02, 2002 8:33 pm
by jon1
and how do i go about setting up these tables?
Posted: Sun Jun 02, 2002 8:36 pm
by volka
I used
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`))
but 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?

Posted: Sun Jun 02, 2002 8:58 pm
by jon1
Where do I put that?
Posted: Sun Jun 02, 2002 9:02 pm
by jon1
Do I need phpMyAdmin? - By the way, thanks for helping me out so far. I'm extremely new to this whole MySQL business as you can tell. Thanks.
Do I need telnet?
Posted: Sun Jun 02, 2002 9:19 pm
by volka
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?
Posted: Tue Jun 04, 2002 1:48 pm
by jon1
The original link to....?