Kleine Vragen Topic #1

Gestart doorLennard4.284 reacties15.585 weergaven

4.285 berichten · pagina 4 van 286

Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Raaoul schreef:
Eerdere citaten tonen
Jordyvc schreef:
Hoe kan ik bij PHP alleen het hoogste id uit de database halen? en laten echoen?
ORDER BY id DESC LIMIT 1
Ah oke, en als ik nu bij het hoogste "id" zijn rij een "naam" wil uithalen. Is dat dan ook zo?
0
Berichten
10.409
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wat bedoel je precies?
0
Lennard

Lid · Topicstarter

Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
SELECT naam FROM lalala ORDER BY id DESC LIMIT 1 ?
0
Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Lennard schreef:
SELECT naam FROM lalala ORDER BY id DESC LIMIT 1 ?
Ah oke bedankt dat had ik nodig biggrin
0
Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoe doe ik dit?
Afbeelding
0
Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Thanks.
0
Berichten
7.806
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wat is hier mis mee:

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]( ([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) && ([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]signup[/COLOR][COLOR= #007700]])) {[/COLOR]
[COLOR= #0000BB]$signup_sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO leden VALUES(,"[/COLOR][COLOR= #007700].[/COLOR]sqlsafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR]sqlsafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]rang[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$signup_sql[/COLOR] [COLOR= #007700]==[/COLOR] TRUE[COLOR= #007700]) {[/COLOR]
                          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Lid succesvol toegevoegd!"[/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]"Error: Dit lid is niet succesvol aangemeld wegens: "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
                          }
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<form method="POST" action="">
<table border="0" cellpadding="0" cellspacing="0" width="32%" id="table1">
        <tr>
                <td width="139">Naam</td>
                <td>
                        <p><input type="text" name="username" size="26"></p>
                </td>
        </tr>
        <tr>
                <td width="139">Wachtwoord:</td>
                <td><input type="text" name="password" size="26"></td>
        </tr>
        <tr>
                <td width="139">Rang:</td>
                <td><select  name="rang">
                <option>DJ</option>
                <option>Hoofd-DJ</option>
                <option>Support</option>
                <option>Manager</option>
                <option>Admin</option>
            </select></td>
        </tr>

        <tr>
                <td width="139">&nbsp;</td>
                <td><input type="submit" value="Verzenden" name="signup"></td>
        </tr>
</table>
</form>"[/COLOR][COLOR= #007700];
        }[/COLOR]

?>


Deze error:

Quote:
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 Hoofd-DJ) at line 1
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Je sluit de strin in de query niet af:

".sqlsafe($_POST[rang]).")"


dat moet dus zo:

".sqlsafe($_POST[rang]).")"
0
Berichten
7.806
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Werkt! Bedankt wink
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wie weet een mooi lettertype ?
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Mijn subdomain zijn SESSIONS werken gewoon niet confused
http://panel.fakedmails.nl/

toevoeging op 4 juni 2012, 20:04:13:
Maartenl schreef:
Wie weet een mooi lettertype ?
Verdana wink
toevoeging op 4 juni 2012, 20:04:30:

function login(username, password, length) {
var errors = new Array();
if(username == null || username == "") {
errors.push("Je moet wel een gebruikersnaam opgeven")
} 
if((username != null && username != "") && username.length < 4) {
errors.push("Je gebruikersnaam is vast langer als 3 karakters")
} 
if(password == null || password == "") {
errors.push("Je moet wel een wachtwoord opgeven")
}
if(errors.length != 0) {

} else {
alert(JAY);
}
}


Wie vind de fout? confused
0
Berichten
10.409
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Stel voor ik heb een pagina vol met namen;

Henk
Peter
Jaap
Klaas

Ik wil dus op een andere pagina kijken of die naam er tussen staat en dat in een if statement.

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]isNaam [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]Henk[/COLOR][COLOR= #007700]) {[/COLOR]
 [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]naam is er[/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]naam niet gevonden[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Lennard

Lid · Topicstarter

Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$namen[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Henk[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]Peter[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]Jaap[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]Klaas[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Henk[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$namen[/COLOR][COLOR= #007700]))
{[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Naam is er[/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]Naam niet gevonden[/COLOR][COLOR= #007700];
    
}[/COLOR]


Zo?
0
Berichten
10.409
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maar dat werkt toch niet als ik op 2 verschillende paginas werkt.

namen.php en checknaam.php
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