|
|
|
update ไม่ใด้ครับ..... ช่วยดูไห้ที เมือน print sql ดู มันก็บอกว่า ok แต่ใน database มันไม่บรรทึก |
|
|
|
|
|
|
|
update ไม่ใด้ครับ..... ช่วยดูไห้ที
Code (PHP)
<?
$pid = $_GET['phoneid'];
$pnid = $_GET['phonename'];
print "phoneID = " .$phoneid;
include("connect.php");
$sql="select * from smobile where phoneid = '$pid' ";
mysql_query("set names TIS620");
//print "<br>" . $sql ."<br>";
$result = mysql_query($sql) or die(mysql_error());
$rs = mysql_fetch_array($result);
?>
<FORM METHOD=POST ACTION="updatephone.php" enctype="MULTIPART/FORM-DATA" >
<table align="center">
<tr><td>PhoneName Model::</td><td><input name="phonename" id="phonename" type="text" value = "<?=$rs['phonename']?>" size="30"></td></tr>
<tr><td>BrandID::</td><td>
<select name="brandid" id="brandid">
<option value = "<?=$rs['brandid']?>" selected="selected">เลือกยี้ห้อโทรศัทพ์</option>
<option value="1">Nokia</option>
<option value="2">i-mobile</option>
<option value="3">Samsung</option>
<option value="4">Sony Ericsson</option>
<option value="5">HTC </option>
<option value="6">LG </option>
<option value="7">Acer</option>
<option value="8">Apple</option>
<option value="9">BlackBerry</option>
<option value="10">Motorola</option>
<option value="11">GNet</option>
<option value="12">Asus</option>
<option value="13">WellcoM</option>
</select></td></tr>
<td>ลายละเอียด::</td>
<td><input name="descr" id="descr" cols="50" rows="5" value = "<?=$rs['descr']?>"></td>
</td></tr>
<tr><td>wifi::</td>
<td><select name="wifi" id="wifi" >
<option value = "<?=$rs['wifi']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr><td>Bluetooth::</td><td><select name="bluetooth" id="bluetooth" >
<option value = "<?=$rs['bluetooth']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr><td>GPRS::</td><td><select name="gprs" id="gprs" >
<option value = "<?=$rs['gprs']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr><td>HSDPA/3G::</td><td><select name="hsdpa" id="hsdpa" >
<option value = "<?=$rs['hsdpa']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr><td>GPS::</td><td><select name="gps" id="gps" >
<option value = "<?=$rs['gps']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr><td>EDGE::</td><td><select name="edge" id="edge" >
<option value = "<?=$rs['edge']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr><td>MP3&VDO::</td><td><select name="mp3" id="mp3" >
<option value = "<?=$rs['mp3']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr>
<td>วิทยุ::</td>
<td><select name="radio" id="radio" >
<option value = "<?=$rs['radio']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr><td>2 ซิม::</td>
<td><select name="twosim" id="twosim" >
<option value = "<?=$rs['twosim']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr><td>TV mobile::</td><td><select name="tvmobile" id="tvmobile" >
<option value = "<?=$rs['tvmobile']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr>
<td>แชท::</td>
<td><select name="bb" id="bb" >
<option value = "<?=$rs['bb']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr><td>กล้องถ่ายภาพ::</td>
<td><select name="photo" id="photo" >
<option value = "<?=$rs['photo']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr><td>หน้าจอสัมผัส::</td>
<td><select name="momi" id="moni" >
<option value = "<?=$rs['moni']?>" selected="selected">เลือก</option>
<option value="1">มี</option>
<option value="0">ไม่มี</option>
</select></td></tr>
<tr><td>ราคา::</td>
<td><input name="price" id="price" type="text" value = "<?=$rs['price']?>" size="30"></td></tr>
<tr>
<td>PicPhone::</td>
<td><input type="file" name="img_data" id="img_data" value="<?=$rs['img_data']?>" size="30" ></td></tr>
<INPUT TYPE="submit" value="แก้ไขข้อมูล">
<INPUT TYPE="reset">
</FORM>
Code (update.php)
<?
$pid = $_GET['phoneid'];
print "Phonename = " .$phonename;
include("connect.php");
//$phonename=$_POST['phonename'] ;
//$brandid=$_POST['brandid'] ;
//$descr=$_POST['descr'] ;
//$wifi=$_POST['wifi'] ;
//$bluetooth=$_POST['bluetooth'] ;
//$gprs=$_POST['gprs'] ;
//$hsdpa=$_POST['hsdpa'] ;
//$gps=$_POST['gps'] ;
//$edge=$_POST['edge'] ;
//$mp3=$_POST['mp3'] ;
//$radio=$_POST['radio'] ;
//$twosim=$_POST['twosim'] ;
//$tvmobile=$_POST['tvmobile'] ;
//$bb=$_POST['bb'] ;
//$photo=$_POST['photo'] ;
//$moni=$_POST['moni'] ;
//$price=$_POST['price'] ;
//$img_data=$_POST['img_data'] ;
mysql_query("set names tis620") ;
$sql ="update smobile set phonename = '$phonename' ,
brandid = '$brandid' ,
descr = '$descr' ,
wifi = '$wifi' ,
bluetooth = '$bluetooth' ,
gprs = '$gprs' ,
hsdpa = '$hsdpa' ,
gps = '$gps' ,
edge = '$edge' ,
mp3 = '$mp3' ,
radio = '$radio' ,
twosim = '$twosim' ,
tvmobile = '$tvmobile' ,
bb = '$bb' ,
photo = '$photo' ,
moni = '$moni' ,
price = '$price' ,
img_data = '$img_data'
where phoneid = '$pid' " ; // file = '$img_data'
print $sql;
$result = mysql_query($sql) or die (mysql_error());
if($result)
{
print "ok";
print "<script>alert('แก้ไขให้แล้ว')</script>";
//print "<script>window.location='showpawutkai_admin.php'</script>";
}
else
{
print "error";
}
//print $sql;
print "<script>window.location='showphoneadmin.php'</script>";
?>
<a href='showphoneadmin.php.php'> <<<++กลับหน้าshowphoneadmin++>>> </a><br>
Tag : PHP
|
|
|
|
|
|
Date :
2012-08-28 02:35:12 |
By :
noom |
View :
911 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอา SQL ไปรันดูใน phpMyAdmin ครับ
|
|
|
|
|
Date :
2012-08-28 06:31:02 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตรง where phoneid = '$pid' " ; ลองเปลี่ยนเป็น
where phoneid = $pid " ;
where phoneid ='".$pid ."' ";
ลอง 2 รูปแบบนี่ดูทีละอันครับ
|
|
|
|
|
Date :
2012-08-28 08:43:46 |
By :
apisitp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|