یکی به ما بگه مشکل این کد ما چیه ؟
[PHP]<?php
$code = rand(103456, 199789);
if(isset($_POST["B1"])){
$re = mysql_query("insert into buy values('$id', '$_POST[T1]', '$_POST[T2]', '$_POST[S1]', '$_POST[T3]','$_POST[T5]','$code')");
mysql_query("insert into rahgiri values ('$code')");
$re2 = mysql_query("UPDATE buycode SET buycode='$code'");
if($re2){
header("Location: buy_payment.php");
}
else print('<p align="center"><font color="GREEN">عملیات ناموفق بود</font></p>');
}
?>[/PHP]
به این یه قسمت که میرسه کد رو تو جدولش قرار نمی ده :
[PHP]mysql_query("insert into rahgiri values ('$code')");[/PHP]
این هم یه مشکل کوچیک داره :
[PHP]<?php
include "../connect.php";
$c1= $_GET["id"];
if(isset($_POST["B1"])){
mysql_query("UPDATE product SET name='$_POST[T1]', price='$_POST[T2]',cat='$_POST[D1]',exp='$_POST[S1]' WHERE id=$id");
print '<p align="center"> تغییرات با موفقیت ثبت شد .</p>';
}
?>
<div align="center">
<table border="0" width="400" cellspacing="0" cellpadding="0">
<tr>
<td>
<form name="f1" method="POST" action="<?php print $_SERVER["PHP_SELF"]; ?>">
<fieldset style="padding: 2">
<legend>ويرايش محصول </legend>
<div align="center">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
$code = $_GET["id"];
$re= mysql_query("select * from product WHERE id='$code'");
$row = mysql_fetch_array($re)
?>
<tr>
<td width="81">
<p align="center">کد کالا :</td>
<td><?php print $code; ?></td>
</tr>
<tr>
<td width="81">
<p align="center">نام :</td>
<td><input type="text" name="T1" size="20" value="<?php print $row['name']; ?>"></td>
</tr>
<tr>
<td width="81">
<p align="center">قيمت :</td>
<td><input type="text" name="T2" size="11" value="<?php print $row['price']; ?>"> تومان</td>
</tr>
<tr>
<td width="81">
<p align="center">گروه :</td>
<td><select size="1" name="D1">
<option selected value="1">رايانه</option>
<option value="2">لپ تاپ</option>
<option value="3">تلفن همراه</option>
</select></td>
</tr>
<tr>
<td width="81">
<p align="center">توضيحات :</td>
<td><textarea rows="6" name="S1" cols="31"><?php print $row['exp']; ?></textarea></td>
</tr>
</table>
</div>
</fieldset><p align="center">
<input type="submit" value="Update" name="B1"></p>
</form>
</td>
</tr>
</table>
</div>[/PHP]
دستور آپدیت که شرط داره کار نمی کنه با این یه قسمت مشکل داره [PHP]$id[/PHP]