[PHP] Melding error.

Gestart doorOne2xs12 reacties30 weergaven

13 berichten · pagina 1 van 1

One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Ik heb deze code:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]@[/COLOR][URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db_error_msg[/COLOR][COLOR= #007700]);
@[/COLOR][URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db_error_msg[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er zijn geen reports.[/COLOR][COLOR= #007700];
}[/COLOR] 
[COLOR= #0000BB]$qLid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM reports"[/COLOR][COLOR= #007700]);[/COLOR] 
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$aLid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700])) 
{[/COLOR] 
?>
#<?=$aLid[id]?> | <?=$aLid[berichtid]?><hr>
[COLOR= #0000BB]<?[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/mysql_free_result"]mysql_free_result[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700]);[/COLOR] 
?>


Maar ik krijg deze errors:

Notice: Undefined variable: qLid in /home/*****/domains/*****/public_html/admin.php on line 121

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/*****/domains/*****/public_html/admin.php on line 121
Er zijn geen reports.


De melding wordt wel weergegeven maar met vage warnings
0
Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Vertaal en dan moet het wel lukken.
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Sanderc schreef:
Vertaal en dan moet het wel lukken.
Nee, ik begrijp het niet.
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je doet mysql_num_rows van iets, maar dat "iets" komt pas later in het script voor ?
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]@[/COLOR][URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db_error_msg[/COLOR][COLOR= #007700]);
@[/COLOR][URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db_error_msg[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$qLid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM reports"[/COLOR][COLOR= #007700]);[/COLOR] 
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er zijn geen reports.[/COLOR][COLOR= #007700];
}[/COLOR] 
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$aLid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700])) 
{[/COLOR] 
?>
#<?=$aLid[id]?> | <?=$aLid[berichtid]?><hr>
[COLOR= #0000BB]<?[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/mysql_free_result"]mysql_free_result[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700]);[/COLOR] 
?>
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jellesch schreef:
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]@[/COLOR][URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db_error_msg[/COLOR][COLOR= #007700]);
@[/COLOR][URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db_error_msg[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$qLid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM reports"[/COLOR][COLOR= #007700]);[/COLOR] 
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er zijn geen reports.[/COLOR][COLOR= #007700];
}[/COLOR] 
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$aLid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700])) 
{[/COLOR] 
?>
#<?=$aLid[id]?> | <?=$aLid[berichtid]?><hr>
[COLOR= #0000BB]<?[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/mysql_free_result"]mysql_free_result[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700]);[/COLOR] 
?>
Waarom eigenlijk mysql_free_result ? Gewoon nieuwsgierig smile
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
omdat het moet worden aangeroepen als je je zorgen maakt over hoeveel geheugen wordt gebruikt voor queries die grote resultaat sets terug te keren. Al het geassocieerde geheugen wordt automatisch vrijgemaakt aan het eind van de uitvoering van het script.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
En is de foutafhandeling weer eens met vakantie?

Jelle, wordt het niet gewoon eens tijd op de MYSQL-tut van phptuts.nl te volgen? Dit wat je nu hebt is echt brak....
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Aarclay schreef:
En is de foutafhandeling weer eens met vakantie?

Jelle, wordt het niet gewoon eens tijd op de MYSQL-tut van phptuts.nl te volgen? Dit wat je nu hebt is echt brak....
I know dit zijn oude scripts, ik ga me er weer in verdiepen (vooral in de foutafhandeling wink)
0
Berichten
1.053
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dit is niet echt gezondyummie Vergelijk de jouwe eens met deze, ik heb hem alleen niet getestwink
[COLOR= #0000BB]<?php[/COLOR]

   [URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]localhost[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]db_user[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]db_password[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
   [URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]db_name[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]

    [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM `reports`"[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er zijn geen reports.[/COLOR][COLOR= #007700];
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
            [URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){[/COLOR]
               [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"#"[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR] [COLOR= #DD0000]" | "[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]berichtid[/COLOR][COLOR= #007700]].[/COLOR] [COLOR= #DD0000]"<hr>"[/COLOR][COLOR= #007700];
            }
    }[/COLOR]
?>
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Wederom mis ik daar goede foutafhandeling. In je sig doe je het wel weer goed yummie
0
Berichten
1.053
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja heb het gewoon simpel gedaan zonder na te denken, dus kan dat er een foutje in zin.
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Waarom ga je niet gewoon verder in het topic dat je hierover had aangemaakt vandaag?
http://www.one2xs.com/threads/43540
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