【发布时间】:2012-07-12 23:46:35
【问题描述】:
我正在编写一个用于创建序列化数组的 php 脚本,如下所示:
$x=Array();
$x[0]=$_GET['fname'];
$x[1]=$_GET['lname'];
$str=serialize($x);
print $str;
$y=$_GET['hf'];
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("formdemo", $con);
$sql="update rohit set data='$str' where fid='$y'";
现在我想在这个数组上附加更多数据。我该怎么办呢
感谢
【问题讨论】:
-
请不要使用
mysql_*函数编写新代码。它们不再维护,社区已经开始deprecation process。看到red box?相反,您应该了解prepared statements 并使用PDO 或MySQLi。如果你不能决定哪一个,this article 会帮助你。如果你选择 PDO,here is good tutorial.
标签: php