我想在单击指向包含php代码的页面的href链接时提交用户id和产品id
这是store.php页面我想在单击指向包含php代码的页面的href链接时提交用户id和产品id,php,mysql,sql,Php,Mysql,Sql,这是store.php页面 <a href=\"order.php?id=".$row[prod_id]."\">Order</a> 而order.php包含 <?php $email = "mis@es-tg.com"; #add your code here now or later to connect to the MySQL database. error_reporting(E_ERROR | E_PARSE); $con = mysql_pco
<a href=\"order.php?id=".$row[prod_id]."\">Order</a>
而order.php包含
<?php
$email = "mis@es-tg.com";
#add your code here now or later to connect to the MySQL database.
error_reporting(E_ERROR | E_PARSE);
$con = mysql_pconnect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_set_charset('utf8',$con);
$charset = mysql_client_encoding($con);
mysql_select_db("scientology", $con);
$sql = "Insert into requested_product values (stdid,prod_id) where prod_id=".$_GET['prod_id'] , stdid=".$_GET['stdid'];
$result = mysql_query ("$sql");
if(!($result))
echo "<BR><font color=red>Thank you for ordering</font>";
echo $sql;
header("Location: store.php");
?>
在store.php中,您正在发送id
,但您正在order.php中读取$\u GET['prod\u id']
。将$\u GET['prod\u id']
替换为$\u GET['id']
替换为检查插入查询语法!!它类似于插入到表中\u名称值(value1、value2、value3,…)代码>我们在insert QUERY中不使用WHERE
子句。您需要基本教程。充满语法错误。