我正在尝试在php-mysql中插入和显示元素数组。在表中插入数据工作正常。显示多个字段时出错 Uninitialized string offset: 0
. 在php-mysql中显示数组的原因是什么?
这是密码
//Inserting the data
for($i=0;$i<count($_REQUEST['slno1']);$i++)
{
$slno1 = $_REQUEST["slno1"][$i];
$name1 = mysql_real_escape_string(stripslashes($_REQUEST["name1"][$i]));
$rhof1 = mysql_real_escape_string(stripslashes($_REQUEST["rhof1"][$i]));
$dob1 = mysql_real_escape_string(stripslashes($_REQUEST["dob1"][$i]));
$dobapt1 = mysql_real_escape_string(stripslashes($_REQUEST["dobapt1"][$i]));
$doc1 = mysql_real_escape_string(stripslashes($_REQUEST["doc1"][$i]));
$doconf1 = mysql_real_escape_string(stripslashes($_REQUEST["doconf1"][$i]));
$qualification1 = mysql_real_escape_string(stripslashes($_REQUEST["qualification1"][$i]));
$school1 = mysql_real_escape_string(stripslashes($_REQUEST["school1"][$i]));
$occupation1 = mysql_real_escape_string(stripslashes($_REQUEST["occupation1"][$i]));
mysql_query("INSERT INTO member (memid,slno1,name1,rhof1,dob1,dobapt1,doc1,doconf1,qualification1,school1,occupation1)VALUES('$id','$slno1','$name1','$rhof1','$dob1','$dobapt1','$doc1','$doconf1','$qualification1','$school1','$occupation1')") or die(mysql_error());
}
//Displaying the data in php mysql
$run=mysql_query("SELECT * FROM member where memid='$id'");
while($row=mysql_fetch_array($run))
{
$slno=$row['slno1'];
$name=$row['name1'];
$rhof=$row['rhof1'];
$dob=$row['dob1'];
$dobapt=$row['dobapt1'];
$doc=$row['doc1'];
$doconf=$row['doconf1'];
$school=$row['school1'];
$qualification=$row['qualification1'];
$occupation=$row['occupation1'];
}
1条答案
按热度按时间dldeef671#
尝试