dongpian6319
2014-02-11 22:45
浏览 39
已采纳

PHP / MYSQL:表未在wamp服务器中创建

when I run this php file in my wamp server it connects to database, selects database but not create table . the output is this:

connected to database succussfully.
connected to database store_db succussfully.
table users was not created.

what is the problem???

php code:

<?php
$sql='CREATE TABLE users
(
PID INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(PID),
NAME CHAR(20),
PASSWORD CHAR(15),
)';

mysql_connect("localhost","root","") or die('could not connect to database.');
echo 'connected to database succussfully.<br>';

mysql_select_db('store_db') or die('database store_db not found.');
echo 'connected to database store_db succussfully.<br>';

mysql_query($sql) or die('table users was not created');
echo 'table users was created in database store_db succussfully.<br>';

?>
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

4条回答 默认 最新

相关推荐 更多相似问题