資料庫找不到資料

edited 九月 2014 in PHP新手區
我資料庫已經按照步驟建立了,但是執行後還是一直說她找不到資料. 我表單傳送資料她卻說找不到
<?php
error_reporting(E_ALL^E_DEPRECATED);
if(isset($_POST['store_live'])&&empty($_POST['store_live']))
 if(isset($_POST['store_phone'])&&empty($_POST['store_phone']))
  if(isset($_POST['store_name'])&&empty($_POST['store_name']))
{
die('資料有沒輸入');
}else
{$sql="INSERT shopping(店家名稱,店家電話,店家住址)
     value('{$_POST['store_name']}','{$_POST['store_phone']}','{$_POST['store_live']}')";
	mysql_query($sql);
	}
?>
<body>
<?
header('content-type:text/html;charset=utf-8');
include('mysql.php');
?>
<form name="form1" action="" method="post" enctype="multipart/form-date">
店家名稱:<input type="text"  name="store_name" size="5" >
店家電話:<input type="text" name="store_phone" size="10">
店家住址:<input type="text" name="store_live" size="30">
<input type="submit" value="新增">
<input type="reset" value="重設">
</form>
<?php

	$sql = "SELECT live,name,phone FROM shoping"; 
		   $result = mysql_query($sql) or  die("query failed,error message=".mysql_error()); 
if(mysql_num_rows($result)>0)
{
  echo "<hr><table><tr><td>店家名稱</td><td>店家電話</td><td>店家住址</td></tr>";
  while($row = mysql_fetch_array($result))
  {
  echo"<tr><td>{$row['店家名稱']}</td>
          <td>{$row['店家電話']}</td>
          <td>{$row['店家住址']}</td><tr>";
  } 
}echo"</table>";
?>

</body>
query failed,error message=No database selected 他說他找不到資料

評論

Sign In or Register to comment.