[PHP] Vragentopic voor nieuw script [PHP]

Gestart doorJosnl44 reacties61 weergaven

45 berichten · pagina 2 van 3

Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Echo $query eens.
0
Berichten
3.000
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Waar?
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nadat je hem aanmaakt.
0
Berichten
3.000
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Geen bestaat dit wel:
mysql_num_rows


?
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja dat bestaat maar echo $qeury eens.
0
Berichten
3.000
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Geen verschil
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]//Het verbindingsscript ophalen[/COLOR]

[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT name,email,ad_name,beschrijving,plaatje,biedenaf,buynow FROM marktplaats ORDER BY id ASC"[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]//Gegevens uit de database halen: met SELECT worden de velden gekozen die weergegeven moeten worden, FROM geeft de tabel van de database aan en met ORDER BY wordt de sorteervolgorde aangegeven. In dit geval is dat ASCending (oplopend) op id.[/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]$query[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR][COLOR= #FF8000]//Er zijn geen producten gevonden (je krijgt een foutmelding te zien)[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"Er zijn nog geen producten gevonden!"[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [COLOR= #0000BB]$rij[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_object"]mysql_fetch_object[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]name[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$ad_name[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]ad[COLOR= #007700]-[/COLOR]name[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$beschrijving[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]beschrijving[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$plaatjes[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]plaatjes[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$biedenaf[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]biedenaf[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$buynow[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]buynow[COLOR= #007700]);[/COLOR]
0
Berichten
3.000
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nog steeds nu krijg ik ditmysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/josnl/domains/zoozio.nl/public_html/marktplaats/producten.php on line 48
Er zijn nog geen producten gevonden!
0
Erik

Lid

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Regel 4: $query = mysql_query("SELECT name,email,ad_name,beschrijving,plaatje,biedenaf,buynow FROM marktplaats ORDER BY id ASC") or die(mysql_error())
0
Berichten
3.000
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
werkt niet krijg nu deze error Parse error: syntax error, unexpected T_ELSE in /home/josnl/domains/zoozio.nl/public_html/marktplaats/producten.php on line 48
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
MikeK zoekt nog steeds een oplossing! yummie
0
Berichten
3.000
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Deze error krijg ik nu: Parse error: syntax error, unexpected } in /home/josnl/domains/zoozio.nl/public_html/marktplaats/producten.php on line 48

Code is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<title>Verkoop je spullen!</title>
</head>

<body>

<div class="spullen_aantal">
Er zijn <font color="red">nog geen</font> advertenties geplaatst!
</div>

<div id="menu">
<a href="index.php">Startpagina</a> | 
<a href="toevoegen.php">Advertentie plaatsen</a> | 
<a href="producten.php">Alle producten</a>
</div>

<div id="container">

<!-- ###   EERSTE STUK CONTENT   ### -->
<div class="content_top"><font style=" font-size: 16px; font-weight: bold; color: #FFF;">Welkom!</font></div>
<div class="content_mid">

<font style=" font-size: 16px; font-weight: bold;">Welkom!</font>
<p>Welkom op Kijk&Koop.nl, Hier staan de producten
</p>

Groetjes,

Het K&K Team

</div>
<div class="content_footer"></div>
<!-- ###   EINDE EERSTE STUK CONTENT   ### -->


<!-- ###   TWEEDE STUK CONTENT   ### -->
<div class="content_top"><font style=" font-size: 16px; font-weight: bold; color: #FFF;">Producten</font></div>

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]//Het verbindingsscript ophalen[/COLOR]

[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT name,email,ad_name,beschrijving,plaatje,biedenaf,buynow FROM marktplaats ORDER BY id ASC"[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]//Gegevens uit de database halen: met SELECT worden de velden gekozen die weergegeven moeten worden, FROM geeft de tabel van de database aan en met ORDER BY wordt de sorteervolgorde aangegeven. In dit geval is dat ASCending (oplopend) op if(mysql_num_rows($query) == 0){[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"Er zijn nog geen producten gevonden!"[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [COLOR= #0000BB]$rij[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_object"]mysql_fetch_object[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]name[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$ad_name[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]ad[COLOR= #007700]-[/COLOR]name[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$beschrijving[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]beschrijving[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$plaatjes[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]plaatjes[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$biedenaf[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]biedenaf[COLOR= #007700]);[/COLOR] 
    [COLOR= #0000BB]$buynow[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]buynow[COLOR= #007700]);[/COLOR]



    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"
        <strong>naam: "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/ucfirst"]ucfirst[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]",</strong><br />
            Adverteerder: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"<br />
           Advertentie naam: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$ad_name[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"<br />
            Beschrijving: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$beschrijving[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" <br />
            Foto: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$plaatje[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"<br />
            Bieden van af: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$biedenaf[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"<br />
            Buynow: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$buynow[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"<br />
            <br />n"[/COLOR][COLOR= #007700];
}[/COLOR]

?>



</div>
<div class="content_footer"></div>
<!-- ###   EINDE TWEEDE STUK CONTENT   ### -->

</div>
</body>
</html>
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb het probleem van MikeK opgelost, alleen nu krijg ik een andere error:

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/josnl/domains/zoozio.nl/public_html/marktplaats/producten.php on line 50


Dit is de code nu:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]//Het verbindingsscript ophalen[/COLOR]

[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT name,email,ad_name,beschrijving,plaatje,biedenaf,buynow FROM marktplaats ORDER BY id ASC"[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]//Gegevens uit de database halen: met SELECT worden de velden gekozen die weergegeven moeten worden, FROM geeft de tabel van de database aan en met ORDER BY wordt de sorteervolgorde aangegeven. In dit geval is dat ASCending (oplopend) op if(mysql_num_rows($query) == 0){[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"Er zijn nog geen producten gevonden!"[/COLOR][COLOR= #007700];
{[/COLOR]
    [COLOR= #0000BB]$rij[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_object"]mysql_fetch_object[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]name[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$ad_name[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]ad[COLOR= #007700]-[/COLOR]name[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$beschrijving[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]beschrijving[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$plaatjes[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]plaatjes[COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$biedenaf[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]biedenaf[COLOR= #007700]);[/COLOR] 
    [COLOR= #0000BB]$buynow[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]buynow[COLOR= #007700]);[/COLOR]



    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"
        <strong>naam: "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/ucfirst"]ucfirst[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]",</strong><br />
            Adverteerder: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"<br />
           Advertentie naam: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$ad_name[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"<br />
            Beschrijving: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$beschrijving[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" <br />
            Foto: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$plaatje[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"<br />
            Bieden van af: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$biedenaf[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"<br />
            Buynow: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$buynow[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"<br />
            <br />n"[/COLOR][COLOR= #007700];
}[/COLOR]

?>
0
Berichten
3.000
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Weet iemand hoe je deze error oplost:Parse error: syntax error, unexpected T_STRING in /home/josnl/domains/zoozio.nl/public_html/marktplaats/producten.php on line 48
Regel 44 tm 50:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]//Het verbindingsscript ophalen[/COLOR]

[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT name,email,ad_name,beschrijving,plaatje,biedenaf,buynow FROM marktplaats; ()
(mysql_num_rows($query) == 0);
    echo"[/COLOR]Er zijn nog geen producten gevonden[COLOR= #007700]![/COLOR]"[COLOR= #007700];[/COLOR]
0
Berichten
3.000
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
opgelost
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