PHP help me

Gestart doorJesper177 reacties875 weergaven

178 berichten · pagina 4 van 12

Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php

$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM overzicht WHERE member_id = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/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/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700])) {[/COLOR]
?>

<h2>Domeinen</h2><br>
[COLOR= #0000BB]<?php[/COLOR]  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]domein[/COLOR][COLOR= #007700]];[/COLOR] ?>
<h2>Hostings</h2><br>
[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]host[/COLOR][COLOR= #007700]];[/COLOR] ?>
<h2>Vpsen</h2><br>
[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vps[/COLOR][COLOR= #007700]];[/COLOR]  ?>

[COLOR= #0000BB]<?php[/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]"Geen resultaten gevonden. "[/COLOR][COLOR= #007700];
}[/COLOR]
?>


Zou moeten werken.
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Vriendje schreef:
[COLOR= #0000BB]<?php

$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM overzicht WHERE member_id = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/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/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700])) {[/COLOR]
?>

<h2>Domeinen</h2><br>
[COLOR= #0000BB]<?php[/COLOR]  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]domein[/COLOR][COLOR= #007700]];[/COLOR] ?>
<h2>Hostings</h2><br>
[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]host[/COLOR][COLOR= #007700]];[/COLOR] ?>
<h2>Vpsen</h2><br>
[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vps[/COLOR][COLOR= #007700]];[/COLOR]  ?>

[COLOR= #0000BB]<?php[/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]"Geen resultaten gevonden. "[/COLOR][COLOR= #007700];
}[/COLOR]
?>
Zou moeten werken.

Zal morgen ff kijken zit nu op tablet
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik zit ook op iPod wink
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Dan alsnog....

Waarom een while voor 1 record die je krijgt?
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Vriendje schreef:
[COLOR= #0000BB]<?php

$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM overzicht WHERE member_id = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/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/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700])) {[/COLOR]
?>

<h2>Domeinen</h2><br>
[COLOR= #0000BB]<?php[/COLOR]  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]domein[/COLOR][COLOR= #007700]];[/COLOR] ?>
<h2>Hostings</h2><br>
[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]host[/COLOR][COLOR= #007700]];[/COLOR] ?>
<h2>Vpsen</h2><br>
[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vps[/COLOR][COLOR= #007700]];[/COLOR]  ?>

[COLOR= #0000BB]<?php[/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]"Geen resultaten gevonden. "[/COLOR][COLOR= #007700];
}[/COLOR]
?>
Zou moeten werken.

Thanks deze werkt perfect!
0
Berichten
262
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
nog een tip, haal de * uit je query, deze vertraagt namelijk query.
zet er neer wat je nodig hebt

mysql_query("SELECT domien, host, vps FROM overzicht WHERE member_id = " . mysql_real_escape_string($_SESSION[id]) . "") or die(mysql_error());


en vraag me af of dit nu zo prettig zal vinden werken dit onder ander door or die in query.
de or die zorgt er nu voor dat je helle script afbreekt. ik zou toch wat beter fout afhandeling gaan kijk als jij was.

fout afhandeling
als je onderstaande boven je script had gestaan had je al kunnen weten wat de fout was(dus geen witte pagin)
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/ini_set"]ini_set[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]display_errors[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]On[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/error_reporting"]error_reporting[/URL][COLOR= #007700]([/COLOR]E_ALL[COLOR= #007700]);[/COLOR]
?>


en als laatste heb ik nog wel een goede link voor je
SQL Beginnershandleiding

denk dat je daar wel veel meer info vindwink
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]


    [COLOR= #007700]{[/COLOR]

        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO factuur (NULL,"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]",
"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bedrag[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]",
"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]waarom[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]","[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]member_id[/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/echo"]echo[/URL] [COLOR= #DD0000]<div id="succes">Factuur succesvol verstuurt <a href="index.php">Klik hier</a></div>[/COLOR][COLOR= #007700]; 

        }[/COLOR]

?>


Error:
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 NULL,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 1,00, Jemamammaammaa,412 ) at line 1
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
heb je dan een veld welke NULL heet? Dat klinkt niet erg logisch.
En bovendien is SQL injection mogelijk, en ben je erg makkelijk hackbaar.

En zoals er eerder gezegd is, is die() niet de juiste manier om fouten mee op te vangen.
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
NULL is de id en hoe kan ik hem beveiligen dit is voor admin paneel

toevoeging op 27 januari 2012, 16:01:42:
Hoe moet ik de id dan automatisch laten gaan heb al auto increment gedaan mar dan wil ik dat hij bij id niks invult zodat dat automatisch gaat
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]

    [COLOR= #007700]{[/COLOR]

        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO factuur (id, bericht, bedrag, waarom, member_id) VALUES (NULL,"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]",
"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bedrag[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]",
"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]waarom[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]","[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]member_id[/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/echo"]echo[/URL] [COLOR= #DD0000]<div id="succes">Factuur succesvol verstuurt <a href="index.php">Klik hier</a></div>[/COLOR][COLOR= #007700]; 

        }[/COLOR]

?>


Unknown column nuulll in field list

nuulll is wat in intypte
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Zet je values tussen single-quotes

Je hoeft geen ID mee te geven als veld, als deze op AUTO-INCREMENT staat.
En zie ook mijn opmerking over SQL-injection.

Nog een tip: Je kan gerust enters gebruiken in je query, zo kan je hem beter leesbaarder maken.
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO factuur (bericht, bedrag, waarom, member_id) VALUES ("[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]","[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bedrag[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]","[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]waarom[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]","[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]member_id[/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]


?>
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Je gebruikt geen single-quotes in je values.
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maar ik snap er niks van van die single qoutes waar moeten die nouconfused
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