PHP MySQL weergeven

Gestart doorStanieboy6 reacties16 weergaven

7 berichten · pagina 1 van 1

Stanieboy

Lid · Topicstarter

Berichten
435
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hi.
Ik moet een telefoon webshop voor iemand maken, nu ziet ik met 1 probleem.
Als de eigenaar, een categorie toevoeg lukt dat, dan kan hij product toevoegen (lukt ook), en dan kan hij het product weer wijzigen, door eerst een categorie te kliken, en dan opent open?ca=BlackBerry (werkt ook), maar nu als je naar die pagina gaat laat hij ze niet zien, de producten die bij dat merk horen.
Wat ik nu heb:

[COLOR= #0000BB]<?php
$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]];[/COLOR] 
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM producten WHERE ca="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$naam[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$obj2[/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]$titel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$obj2[/COLOR][COLOR= #007700]->[/COLOR]titel[COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$titel[/COLOR][COLOR= #007700];
}[/COLOR]
?>


Ik heb nu haast alles geprobeerd, kan iemand mij helpen.

Groet,
Stan
0
Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]];[/COLOR] 
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM producten WHERE ca="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$naam[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$obj2[/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]$titel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$obj2[/COLOR][COLOR= #007700]->[/COLOR]titel[COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"$titel"[/COLOR][COLOR= #007700];
}[/COLOR]
?>


probeer nu eens
0
Stanieboy

Lid · Topicstarter

Berichten
435
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Werkt niet.
En zo,
echo "$titel";


is het zelfde als
echo $titel;

emo
0
Berichten
1.579
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]];[/COLOR] 
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM producten WHERE ca="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$naam[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/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]$obj2[/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]$titel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$obj2[/COLOR][COLOR= #007700]->[/COLOR]titel[COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$titel[/COLOR][COLOR= #007700];
}[/COLOR]
?>


Wat krijg je nu?
0
Stanieboy

Lid · Topicstarter

Berichten
435
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Krijg ik ook niks.
En met or die mysql_error had ik al geprobeerd
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Stanieboy schreef:
Werkt niet.
En zo,
echo "$titel";
is het zelfde als
echo $titel;

emo
Nee, want echo "$titel";
Dan echot hij $titel
en als je echo $titel; doet echot hij de waarde achter $titel
0
Berichten
3.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Gebruik mysql_real_escape_string over je $_GET,

die "" moet je zeker NIET om een variabele zetten,

en je maakt een object aan van allemaal verschillende dingen wat geen goed idee is. Gebruik dit:

[COLOR= #0000BB]<?php
$naam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]);[/COLOR] 
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM producten WHERE ca="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$naam[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$qFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])) {[/COLOR]
[COLOR= #0000BB]$titel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$qFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$titel[/COLOR][COLOR= #007700];
}[/COLOR]
?>
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