hey well Im working on this php for fun/class... and for the life of me... I dont know what Im doing wrong. to start off..... the table setup.
I dont know what I did... heres the code, it used to work.. and I dont know what I changed... but now it doesnt even make the table. So if you can help, please do.
db file for the include:
setup code:
I dont know what I did... heres the code, it used to work.. and I dont know what I changed... but now it doesnt even make the table. So if you can help, please do.
db file for the include:
PHP:
<?
$username="name";
$password="pass";
$database="databasename";
?>
PHP:
<?php
include("db.php");
$con = mysql_connect('localhost', $username, $password);
if (!$con) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
$db_selected = mysql_select_db($database, $con);
if (!$db_selected) {
die ('Can\'t use $database : ' . mysql_error());
}
$query="CREATE TABLE newspost
(id int(6) NOT NULL auto_increment,
newstitle varchar(50) NOT NULL,
loginname varchar(40) NOT NULL,
date varchar(100) NOT NULL,
news varchar(500) NOT NULL,
PRIMARY KEY (id),
UNIQUE id (id),
KEY id_2 (id))";
mysql_query($query);
mysql_close($con);
echo "Made the Database";
?>







