Home  >  Article  >  Backend Development  >  [PHP] 获取数据打印出来的有关问题 , 多谢帮助

[PHP] 获取数据打印出来的有关问题 , 多谢帮助

WBOY
WBOYOriginal
2016-06-13 12:20:28856browse

[PHP] 获取数据打印出来的问题 , 谢谢帮助 !

<?php<br />$con = mysql_connect("localhost","root","");<br />if (!$con)<br />  {<br />  die('Could not connect: ' . mysql_error());<br />  }<br /><br />mysql_select_db("shopsystem", $con);<br /><br />$userId=$_GET['id'];<br />$sql = "select * from shop where id=".$userId;<br />  $result = mysql_query($sql,$con);<br />  $user = mysql_fetch_array($result);<br />?><br /><form action="edit.php" method="post"><br /><input type="hidden" name="user_id" value="<?php echo $user['id']?>"/><br /><br /><table width="368" border="0" cellpadding="7" cellspacing="0"><br /><br />  <tr><br />    <td colspan="3"> <h4>請填寫以下信息<h4></td><br />    </tr><br />  <tr><br />    <td width="75">姓名:</td><br />    <td width="150"><input type="text" name="name" value="<?php echo $user['name'] ?>"></td><br />    <td width="76" style="color:#F00;">*</td><br />

= - 为什么我获取到ID后  然后查询出来的数据 表单里面没有,但是要在域名后面加的相应的ID,表单里面才能显示出来

------解决思路----------------------
url里id参数为空
$userId=$_GET['id'];为空
执行的sql是select * from shop where id=  ;
你觉得会有数据吗= =
------解决思路----------------------
user_id" value=""/>
$userId=$_GET['id'];
一样吗?我怎么看都不一样

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn