Help error code

Fermé
witek212 Messages postés 35 Date d'inscription mercredi 28 décembre 2011 Statut Membre Dernière intervention 27 août 2012 - 3 juil. 2012 à 01:35
JooS Messages postés 2468 Date d'inscription mardi 22 janvier 2008 Statut Membre Dernière intervention 8 juin 2016 - 4 juil. 2012 à 00:14
hello, guys

how are you all, today i have some problem i've been making a php page to edit information mysql but when i try to insert the info they said:

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 ''b58pw_users' SET username ='admin' WHERE ID = 62' at line 1

how can fix it please this is the code:



<?
if(empty($_POST['pwd']) empty($_POST['prefix'])){
echo "<FORM method=\"POST\">
hostname : <input name=\"localhost\" type=\"text\" value=\"localhost\" style=\"border:1px dotted #00FFFF; width: 212px; background-color:#0C0C0C; font-family:Tahoma; font-size:8pt; color:#00FFFF; \" /><br><br>
database : <input name=\"database\" type=\"text\" style=\"border:1px dotted #00FFFF; width: 212px; background-color:#0C0C0C; font-family:Tahoma; font-size:8pt; color:#00FFFF; \" /><br><br>
username : <input name=\"username\" type=\"text\" style=\"border:1px dotted #00FFFF; width: 212px; background-color:#0C0C0C; font-family:Tahoma; font-size:8pt; color:#00FFFF; \" /><br><br>
prefix _ : <input name=\"prefix\" type=\"text\" value=\"jos_users\" style=\"border:1px dotted #00FFFF; width: 212px; background-color:#0C0C0C; font-family:Tahoma; font-size:8pt; color:#00FFFF; \" /><br><br>
password : <input name=\"password\" type=\"password\" style=\"border:1px dotted #00FFFF; width: 212px; background-color:#0C0C0C; font-family:Tahoma; font-size:8pt; color:#00FFFF; \" /><br><br>
<br>
Your username : WITEK <input name=\"admin\" type=\"hidden\" value=\"WITEK\" style=\"border:1px dotted #00FFFF; width: 212px; background-color:#0C0C0C; font-family:Tahoma; font-size:8pt; color:#00FFFF; \" /><br>
Your Password : witek00 <input name=\"pwd\" type=\"hidden\" value=\"9d49eaf09a376ed15ad66148a74ba58f\" style=\"border:1px dotted #00FFFF; width: 212px; background-color:#0C0C0C; font-family:Tahoma; font-size:8pt; color:#00FFFF; \" /><br><br>

<input name=\"send\" type=\"submit\" value=\"change login\" style=\"border:1px dotted #00FFFF; width: 99; font-family:Tahoma; font-size:10pt; color:#00FFFF; text-transform:uppercase; height:23; background-color:#0C0C0C\" />
</FORM>";
}else{
$localhost = $_POST['localhost'];
$database = $_POST['database'];
$username = $_POST['username'];
$prefix = $_POST['prefix'];
$password = $_POST['password'];
$pwd = $_POST['pwd'];
$admin = $_POST['admin'];


@mysql_connect($localhost,$username,$password) or die(mysql_error());
@mysql_select_db($database) or die(mysql_error());

$hash = crypt($pwd);

$SQL=@mysql_query("UPDATE '".$prefix."' SET username ='".$admin."' WHERE ID = 62") or die(mysql_error());
$SQL=@mysql_query("UPDATE '".$prefix."' SET password ='".$pwd."' WHERE ID = 62") or die(mysql_error());

if($SQL){
echo "<b>Success : now you can use the new user and password.</b> ";
}

}

?>



A voir également:

3 réponses

Melooo Messages postés 1405 Date d'inscription vendredi 28 novembre 2008 Statut Membre Dernière intervention 18 mars 2013 84
3 juil. 2012 à 08:46
Hello,
if(empty($_POST['pwd']) && empty($_POST['prefix'])){
0
witek212 Messages postés 35 Date d'inscription mercredi 28 décembre 2011 Statut Membre Dernière intervention 27 août 2012
3 juil. 2012 à 18:49
still dosent work :S

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 ''jos_users' SET username ='WITEK' WHERE ID = 62' at line 1
0
JooS Messages postés 2468 Date d'inscription mardi 22 janvier 2008 Statut Membre Dernière intervention 8 juin 2016 228
4 juil. 2012 à 00:14
Hi, I thought there's an English section for this forum, just change the language !
Anyway !

$SQL=@mysql_query('UPDATE '.$prefix.' SET username = '.$admin.' WHERE ID = 62') or die(mysql_error()); 
$SQL=@mysql_query('UPDATE '.$prefix.' SET password = '.$pwd.' WHERE ID = 62') or die(mysql_error());


Try this way !
0