query

Gestart doorOne2xs9 reacties36 weergaven

10 berichten · pagina 1 van 1

One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM news WHERE on = 1"[/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]
?>


dat heb ik dus
en er is in de database heb ik 1 artikel staan die op 1 staat of op 0 en hij doet het NOOITcrywat doe ik fout?
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM news WHERE on = 1"[/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]
?>


Zo misschien?
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near on = 1 at line 1
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ow ... lol ff kijken in mijn scriptjes
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
oke
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb laatst nog een shout systeem voor mijn radio gemaakt gewoon een simpele maar zo haal ik alles uit de database:

[COLOR= #0000BB]<?php
$krijg[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM news WHERE on = 1"[/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/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$news[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$krijg[/COLOR][COLOR= #007700])) {[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$news[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$news[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]];

}[/COLOR]
?>


Bij $news[colom hier]; moet je een colom van de tabel news intypen die je wilt laten zien op de pagina.
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
ik krijg toch de hele tijd:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near on = 1 at line 1
me hele script is:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]inc/functions.php[/COLOR][COLOR= #007700]);[/COLOR]
boven[COLOR= #007700]([/COLOR][COLOR= #DD0000]Nieuws[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]2[/COLOR][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 news WHERE on = 1"[/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/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/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/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]Er is nieuws[/COLOR][COLOR= #007700];
            }
        }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<p>Er is geen nieuws!</p>[/COLOR][COLOR= #007700];
        }[/COLOR]
    onder[COLOR= #007700]();[/COLOR]
?>


en er is elke keer GEEN nieuws confused
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dan heb ik geen idee ..........
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
ok ik ook niet emo
EDIT:
als ik van on aan maak doet hij het wel emo
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
omdat ON zon mysql ding is dat bij JOINs wordt gebruikt moet het tussen `` biggrin
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