php & mysql help!

Gestart doorJornd15 reacties86 weergaven

16 berichten · pagina 1 van 2

Jornd

Lid · Topicstarter

Berichten
513
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey,

ik ben beizg met een kleine licentie systeempje wat ik voor weinig wil verkopen.

stel ik vul een naam in zoals henk
hoe kan ik deze $_POST["naam"] als waarde henk
dan controleren of hij in me database staat?
0
Berichten
4.912
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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]x[/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 users WHERE naam="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/ucfirst"]ucfirst[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]));[/COLOR] [COLOR= #0000BB]$row[/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] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]){[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Gebruikersnaam is al in gebruik, kies een andere."[/COLOR][COLOR= #007700]; }[/COLOR]
?>
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$qQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT naam FROM users WHERE naam = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][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]$qQuery[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Gebruikersnaam in gebruik.[/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]Gebruikersnaam is vrij.[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Jornd

Lid · Topicstarter

Berichten
513
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jponsen schreef:
[COLOR= #0000BB]<?php
$qQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT naam FROM users WHERE naam = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][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]$qQuery[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Gebruikersnaam in gebruik.[/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]Gebruikersnaam is vrij.[/COLOR][COLOR= #007700];
}[/COLOR]
?>
uhhmmmm het is toch echt volgensmij echo Gebruikersnaam in gebruik.;
in plaats van echo Gebruikersnaam in gebruik.
biggrin
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Typfouten kunnen gebeuren... :l
0
Jornd

Lid · Topicstarter

Berichten
513
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
weet ik biggrin maar ik maak ook soms van die fouten hoor heart
0
Jornd

Lid · Topicstarter

Berichten
513
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
even weer tussen door ik heb die van jponsen gebruikt maar krijg deze error:

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:xampphtdocstestcheck.php on line 19
Licentie bestaat niet!
0
Jornd

Lid · Topicstarter

Berichten
513
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
iemand?
0
Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heb je geen licentie?
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Geef ons het hele script dan.
Wij weten niet wat lijn 19 is.
0
Berichten
3.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
"SELECT naam FROM users WHERE naam = ".mysql_real_escape_string($_POST[naam]).""

moet

"SELECT * FROM users WHERE naam = ".mysql_real_escape_string($_POST[naam]).""

zijn.
0
Jornd

Lid · Topicstarter

Berichten
513
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
oke ik ga dat straks is even proberen

EDIT:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$mysql_id[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"$dbhost"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]"$dbuser"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]"$dbpass"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$res[/COLOR][COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_db_query"]mysql_db_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"$db"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]"$qQuery"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$mysql_id[/COLOR][COLOR= #007700]);[/COLOR]
?>
<!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=iso-8859-1" />
<title>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"$sitelicentie"[/COLOR][COLOR= #007700])[/COLOR] ?></title>
<meta name="keywords" content="radio, 538, slam fm, fm, shoutcast, internet, domein, hoe, internet radio, internetradio, internetradios, internetradios, enzovoort, youtube, hyves, goldmember, wallie, muziek, layout, mooi">
<meta name="description" content="Damageradio is een leuke online radio voor en door jongeren">

</head>

<body>

[COLOR= #0000BB]<?php
$qQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM licenties WHERE licentie = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]licentie[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][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]$qQuery[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Gebruikersnaam in gebruik.[/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]Gebruikersnaam is vrij.[/COLOR][COLOR= #007700];
}[/COLOR]
?>

</body>
0
Jornd

Lid · Topicstarter

Berichten
513
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik kom er nog steeds niet uit! wie kan me helpen met teamviewer desnoods?
0
Berichten
6.722
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]
[URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$dbhost[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$dbuser[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$dbpass[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_db_query"]mysql_db_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$qQuery[/COLOR][COLOR= #007700]);[/COLOR]
?>
<!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=iso-8859-1" />
<title>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$sitelicentie[/COLOR][COLOR= #007700];[/COLOR] ?></title>
<meta name="keywords" content="radio, 538, slam fm, fm, shoutcast, internet, domein, hoe, internet radio, internetradio, internetradios, internetradios, enzovoort, youtube, hyves, goldmember, wallie, muziek, layout, mooi">
<meta name="description" content="Damageradio is een leuke online radio voor en door jongeren">

</head>

<body>

[COLOR= #0000BB]<?php
$qQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM licenties WHERE licentie = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]licentie[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][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]$qQuery[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Gebruikersnaam in gebruik.[/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]Gebruikersnaam is vrij.[/COLOR][COLOR= #007700];
}[/COLOR]
?>

</body>


Ik heb er een heel aantal fouten uit gehaald.
0
Berichten
165
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
PM me als je nog hulp nodig hebt, ik heb teamviewer wink
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