Jump to content

Sql Problem In Php


wilfred_phang

Recommended Posts

Hi, i would like to ask why the database is not successfully created when i'm using AUTO_INCREMENT in for the primary key? Below is my code:<?php$con = mysql_connect("localhost","root","");if (!$con) { die('Could not connect: ' . mysql_error()); }/*// Create databaseif (mysql_query("CREATE DATABASE my_db",$con)) { echo "Database created"; }*/// Create tablemysql_select_db("my_db", $con);$sql = "CREATE TABLE People(P_ID varchar(10) NOT NULL AUTO_INCREMENT,PRIMARY KEY(P_ID),P_Name varchar(20),P_Pswd varchar(20),)";// Execute querymysql_query($sql,$con);mysql_close($connect);?>Please help me to solve this problem. Thanks!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...