在下面的代碼中,它無法檢索任何結果,當我硬編碼member_username ='admin'它工作得很好,但是當我有member_username ='$ kdo'時失敗。即使當我回聲$ KDO它打印 '管理員'(不帶引號)提交表單後獲取會話信息
<?php
mysql_set_charset('utf8');
$result = mysql_query("SELECT * FROM members WHERE member_username = '$kdo'");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo "
<fieldset>
<legend>Změnit kontaktní informace</legend>
<form method='post' action='zucet.php' class='menu_add'>
<p>
Email: <input type='text' name='aemail' id='aemail' value='$row[4]' size='30'/><br>
Jméno: <input type='text' name='ajmeno' value='$row[8]' size='30'/><br>
Příjmení: <input type='text' name='aprijmeni' value='$row[9]' size='30'/><br>
Firma: <input type='text' name='afirma' value='$row[15]' size='30'/><br>
Telefon: <input type='text' name='atel' value='$row[10]' size='30'/><br>
Centrální tel.: <input type='text' name='actel' value='$row[11]' size='30'/><br>
Město: <input type='text' name='amesto' value='$row[12]' size='30'/><br>
Ulice: <input type='text' name='aulice' value='$row[13]' size='30'/><br>
Čas doručení: <input type='text' name='acas' value='$row[14]' size='30'/><br>
<input type='submit' name='zmenit' formaction='zucet.php' value='Změnit' />
</p>
</form>
</fieldset>";
}
mysql_free_result($result);
?>
zucet.php
<?php
session_start();
$con = mysql_connect("juxcore.ipagemysql.com", "*", "*") or
die("Could not connect: " . mysql_error());
mysql_select_db("jux_mms");
mysql_set_charset('utf8');
$sql="UPDATE members SET member_email = '$_POST[aemail]' WHERE member_username = '$kdo'";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
header('Location: http://www.juxcore.com/x/vita/ucet.php');
mysql_close($con);
感謝您的幫助,非常感謝
你在哪裏分配ed'$ kdo'? – StaticVariable
是的,我有$ kdo = $ _SESSION ['member_username'];其中='管理'ATM – user1505027
代碼在哪裏? – StaticVariable