这在下面的代码中无法检索任何结果,当我硬编码member_username =' admin'它工作正常,但当我有member_username =' $ kdo'它失败。即使我回应$ kdo它打印' admin' (没有引号)
<?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);
感谢您的帮助,非常感谢
答案 0 :(得分:0)
试试这个:
$result = mysql_query("SELECT * FROM members WHERE member_username = '" . $kdo . "';");