mysql超链接_PHP MYSQL超链接和表单

伙计们,我运气不好…我试了又试。包括下面的代码。我在Dreamweaver做这件事,这就是有趣的代码。这是编辑页。我成功地将“bet_id”值从第1页解析到此页。它根据从第1页解析的值,用正确的“bet_id”和“category_id”值填充表单字段。当我更新表单中的值时会出现问题。如果我更新“category_id”值并单击“更新下注”按钮,则脚本不会更新数据库中的下注记录。非常感谢您的帮助。

mysql_select_db($database_punters_c, $punters_c);

$query_Recordset1 = "SELECT bet_id, punter_id,category_id FROM betslip where bet_id =".intval($_REQUEST['bet_id']);

$Recordset1 = mysql_query($query_Recordset1, $punters_c) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

##the below function removes dodgy field values

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}

$editFormAction = $_SERVER['PHP_SELF'];

if (isset($_SERVER['QUERY_STRING'])) {

$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

?>

// edit.php

if ((isset($_POST["apply"])) && ($_POST["apply"] == "update_betslip_detail")){

$query = sprintf(" UPDATE betslip

SET category_id = '%d'

WHERE bet_id = %d",

mysql_real_escape($_POST['category_id']),

mysql_real_escape($_POST['bet_id'])

);

mysql_select_db($database_punters_c, $punters_c);

$Result1 = mysql_query($query, $punters_c) or die('Connection error to MYSQL occurred: '.(mysql_error()));

header("Location: /update_betslip_test.php");

}

else

{

echo "bet detail not updated";

}

?>

Untitled Document

Back to Update page

mysql_free_result($Recordset1);

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值