[Crazys] Error Topic

Gestart doorRobertt25 reacties29 weergaven

26 berichten · pagina 1 van 2

Robertt

Lid · Topicstarter

Berichten
1.579
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heey hallo!

Ik ben beetje aan het "spelen" met PHP ik heb nu dit:

[COLOR= #0000BB]<?php[/COLOR]
 [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]catogorie[/COLOR][COLOR= #007700]])) 
 {[/COLOR]
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]inclube/config.php[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM clipjes WHERE categorie = "[/COLOR][COLOR= #007700].[/COLOR] [URL="http://www.php.net/intval"]intval[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]categorie[/COLOR][COLOR= #007700]]) .[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]

    [COLOR= #0000BB]$ophalen[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/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]$ophalen[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Categorie niet gevonden?"[/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]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ophalen[/COLOR][COLOR= #007700])) 
    {[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<iframe title="[/COLOR]Randomhits YouTube Speler[COLOR= #DD0000]" class="[/COLOR]youtube[COLOR= #007700]-[/COLOR]player[COLOR= #DD0000]" type="[/COLOR]text/html[COLOR= #DD0000]" width="[/COLOR][COLOR= #0000BB]480[/COLOR][COLOR= #DD0000]" height="[/COLOR][COLOR= #0000BB]390[/COLOR][COLOR= #DD0000]" src="[/COLOR]http[COLOR= #007700]:[/COLOR][COLOR= #FF8000]//www.youtube.com/embed/ .$row[code]. ?rel=0&autoplay=1" frameborder="0"></iframe>";[/COLOR]
?>


Daar krijg ik Parse error: syntax error, unexpected T_STRING, expecting , or ; in C:xampphtdocsclippaginacategorie.php on line 22

Weet jij het probleem en volgens mij laat hij het clipje ook niet zien?
Ik haal het zo op index.php?p=categorie&catogorie=test
Ik hoop als ik duidelijk genoeg ben geweest bloos
0
Berichten
1.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
 [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]catogorie[/COLOR][COLOR= #007700]])) 
 {[/COLOR]
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]inclube/config.php[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM clipjes WHERE categorie = "[/COLOR][COLOR= #007700].[/COLOR] [URL="http://www.php.net/intval"]intval[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]categorie[/COLOR][COLOR= #007700]]) .[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]

    [COLOR= #0000BB]$ophalen[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/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]$ophalen[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Categorie niet gevonden?"[/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]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ophalen[/COLOR][COLOR= #007700])) 
    {[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<iframe title="Randomhits YouTube Speler" class="youtube-player" type="text/html" width="480" height="390" src="http://www.youtube.com/embed/[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]].[/COLOR] [COLOR= #DD0000]?rel=0&autoplay=1" frameborder="0"></iframe>[/COLOR][COLOR= #007700];[/COLOR]
?>


moet denk ik wel werken.

EDIT: dit moet de error verhelpen dan
0
Robertt

Lid · Topicstarter

Berichten
1.579
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nu krijg ik Parse error: syntax error, unexpected $end in C:xampphtdocsclippaginacategorie.php on line 23
0
Berichten
1.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
komt omdat je geen } op het eind hebt:

}
?>


EDIT hieronder:

tja, had daar niet eens op gelet aangezien ik enkel naar regel 20 tot en met 22 keekemo
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
 [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]catogorie[/COLOR][COLOR= #007700]])) 
 {[/COLOR]
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]inclube/config.php[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM clipjes WHERE categorie = "[/COLOR][COLOR= #007700].[/COLOR] [URL="http://www.php.net/intval"]intval[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]categorie[/COLOR][COLOR= #007700]]) .[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]

    [COLOR= #0000BB]$ophalen[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/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]$ophalen[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Categorie niet gevonden?"[/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]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ophalen[/COLOR][COLOR= #007700])) 
    {[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<iframe title="Randomhits YouTube Speler" class="youtube-player" type="text/html" width="480" height="390" src="http://www.youtube.com/embed/[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]].[/COLOR] [COLOR= #DD0000]?rel=0&autoplay=1" frameborder="0"></iframe>[/COLOR][COLOR= #007700];
}}}[/COLOR]
?>


hij had 3 haakjes vergetenyummie
0
Robertt

Lid · Topicstarter

Berichten
1.579
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bedankt! Nog 1 probleem? nu zegt die dat de cato niet gevonden is?

Quote:
MyAdmin SQL Dump
-- version 3.2.4
-- http://www.phpmyadmin.net
--
-- Machine: localhost
-- Genereertijd: 05 Nov 2010 om 19:57
-- Serverversie: 5.1.41
-- PHP-Versie: 5.3.1

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `clip`
--

-- --------------------------------------------------------

--
-- Tabelstructuur voor tabel `clipjes`
--

CREATE TABLE IF NOT EXISTS `clipjes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(120) NOT NULL,
`categorie` varchar(120) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Gegevens worden uitgevoerd voor tabel `clipjes`
--

INSERT INTO `clipjes` (`id`, `code`, `categorie`) VALUES
(1, R1jCxzBFdrY, test),
(2, 6gfP1kF2rrU, );

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Dit is mijn db
0
Berichten
1.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
dan heb je waarschijnlijk geen waarden in je velden.
kijk maar naar : mysql_num_rows, daarmee kijkt hij hoeveel er in de tabel staat, als dit 0(nul) is dan geeft hij dat weer.
0
Robertt

Lid · Topicstarter

Berichten
1.579
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Werkt niet echt ;-( Kan je even helpen via teamviewer?
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
haal in ieder geval nooit zo je gegevens uit de database

doe eerst eens bovenaan $cat = mysql_real_escape_string(intval($_GET[categorie]));

dan in query ipv $_GET de $cat
0
Erik

Lid

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Haal de intval weg
E: Justafools manier is overbodig, je kan ook gewoon je strings e.d. beveiligen in de query zelf.
0
Robertt

Lid · Topicstarter

Berichten
1.579
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Justafool schreef:
haal in ieder geval nooit zo je gegevens uit de database
doe eerst eens bovenaan $cat = mysql_real_escape_string(intval($_GET[categorie]));

dan in query ipv $_GET de $cat

Bedankt
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Erik schreef:
Haal de intval weg
E: Justafools manier is overbodig, je kan ook gewoon je strings e.d. beveiligen in de query zelf.
weet je hoe zulke lange querys je dan krijgt op een gegeven moment

Je kan ook in fuctie zetten doe ik allemaal
hoef alleen Secure($_POSTofGET[iets] te doen
0
Erik

Lid

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
De lengte van een query maakt niks uit?
0
Robertt

Lid · Topicstarter

Berichten
1.579
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Justafool schreef:
Eerdere citaten tonen
Erik schreef:
Haal de intval weg
E: Justafools manier is overbodig, je kan ook gewoon je strings e.d. beveiligen in de query zelf.

weet je hoe zulke lange querys je dan krijgt op een gegeven moment

Je kan ook in fuctie zetten doe ik allemaal
hoef alleen Secure($_POSTofGET[iets] te doen
Wat nu heb is goed? alleen hij ziet op 1 of andere manier de clip niet?
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Erik schreef:
De lengte van een query maakt niks uit?
heeft vele voordelen voor de scripter zelf

met het belangrijkste:

Overzicht, netheid, en je kan ook sneller iets terugvinden.

heeft verder voor het script geen verschil inderderdaad.
Crazydog schreef:
Eerdere citaten tonen
Justafool schreef:
Eerdere citaten tonen
Erik schreef:
Haal de intval weg
E: Justafools manier is overbodig, je kan ook gewoon je strings e.d. beveiligen in de query zelf.

weet je hoe zulke lange querys je dan krijgt op een gegeven moment

Je kan ook in fuctie zetten doe ik allemaal
hoef alleen Secure($_POSTofGET[iets] te doen
Wat nu heb is goed? alleen hij ziet op 1 of andere manier de clip niet?
ik zal wel even goed ernaar kijken moment
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