-------这是传送id
<?php
echo "<a href=job_edit.php?sid=".$array[jobid]."><img src=images/icon-edit.gif width=13 height=11 border=0 /></a>";
?>------这是接收id<?
include 'conn.php'; //链接数据库
$id = intval($_GET['sid']);
$sql1 = mysql_query("SELECT * FROM `job_show` WHERE jobid = '$id'");
$array = mysql_fetch_array($sql1);
$date = $_POST[date];
if($date == 0) {
$date = date("Y-m-d");
}
if($_POST['submit3']) {
$sql = "UPDATE `job_show` SET company='$_POST[company]', trade='$_POST[trade]',
type='$_POST[type]', telephone='$_POST[telephone]', contact='$_POST[contact]',
treatment='$_POST[treatment]', area='$_POST[area]', adress='$_POST[adress]',
date='$date', record='$_POST[record]'
WHERE `jobid`='$id'";
$query = mysql_query($sql); echo "<script language=\"javascript\">alert('更新成功')</script>";
if($query) {
echo "<script>location .href='job_show.php';</script>";
}
}
echo mysql_error();
?>
请问为什么当我将“where `jobid`=`$id`”改变为"where `jobid`=`1`"时,能发生更新。
求助啊。
<?php
echo "<a href=job_edit.php?sid=".$array[jobid]."><img src=images/icon-edit.gif width=13 height=11 border=0 /></a>";
?>------这是接收id<?
include 'conn.php'; //链接数据库
$id = intval($_GET['sid']);
$sql1 = mysql_query("SELECT * FROM `job_show` WHERE jobid = '$id'");
$array = mysql_fetch_array($sql1);
$date = $_POST[date];
if($date == 0) {
$date = date("Y-m-d");
}
if($_POST['submit3']) {
$sql = "UPDATE `job_show` SET company='$_POST[company]', trade='$_POST[trade]',
type='$_POST[type]', telephone='$_POST[telephone]', contact='$_POST[contact]',
treatment='$_POST[treatment]', area='$_POST[area]', adress='$_POST[adress]',
date='$date', record='$_POST[record]'
WHERE `jobid`='$id'";
$query = mysql_query($sql); echo "<script language=\"javascript\">alert('更新成功')</script>";
if($query) {
echo "<script>location .href='job_show.php';</script>";
}
}
echo mysql_error();
?>
请问为什么当我将“where `jobid`=`$id`”改变为"where `jobid`=`1`"时,能发生更新。
求助啊。
那么就应该有表单了,提交时 sid 是如何传送的?
var_dump($id); //什么结果
这样报错吗
echo 出来的。
"UPDATE `job_show` SET company=", trade='..', type='..', telephone='..', contact='..', treatment='..', area='..', adress='..', date='.2012-08-02.', record='..' WHERE jobid='1'