PHP error?

Gestart doorJordyvc4 reacties65 weergaven

5 berichten · pagina 1 van 1

Jordyvc

Lid · Topicstarter

Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey,

Ik krijg deze error:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/thomvh/domains/thomvh.s1.one2xs.com/public_html/nieuws/index.php on line 7


Dit is mijn script:

[COLOR= #0000BB]<?php 
$connection[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"localhost"[/COLOR] [COLOR= #007700],[/COLOR] [COLOR= #DD0000]"thomvh_db"[/COLOR] [COLOR= #007700],[/COLOR] [COLOR= #DD0000]"123123123123123123123123"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$db[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"news"[/COLOR] [COLOR= #007700],[/COLOR] [COLOR= #0000BB]$connection[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM news ORDER BY submitted DESC LIMIT 10"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"<table border = 0 width = 90%>"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$rows[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_row"]mysql_fetch_row[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]))
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"<tr><td>$rows[1]</td><td>author : $rows[3]</td></tr>"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"<tr><td>$rows[2]</td></tr>"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"<tr>><td><a href=$rows[5]>$rows[5]</a></td><td>Submitted on : $rows[4]</td></tr>"[/COLOR][COLOR= #007700]);
}[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</table>"[/COLOR][COLOR= #007700];[/COLOR]
?>
0
Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je kiest geen correct ding uit de DB denk ik?
0
Jordyvc

Lid · Topicstarter

Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Namen kloppen allemaal
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Ga gewoon fatsoenlijke foutafhandeling toevoegen.

toevoeging op 15 mei 2012, 19:43:40:
Nog een paar tips:

- echo is geen functie, dus de () haakjes kunnen weg
- variabelen buiten quotes.
0
Jordyvc

Lid · Topicstarter

Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
bedankt
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren