0

Im not seeing it but its not working

here is the code:

mysql_select_db("my_db", $con);
$sql = "CREATE TABLE stream
(
waveID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(gameID),
userID int,
wave varchar(25),
waveTime TIMESTAMP DEFAULT NOW()
)";

// Execute query
if(!mysql_query($sql))
{
    echo "Couldn't do it";
}
else
{
    echo "alright";
}
4
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by da(code)da
0

You have set GameID to be the primary key BUT you haven't defined it !
If you are running on windows try using a program like http://www.heidisql.com/
to make sure your SQL runs OK before using within PHP

0

Show all your code - including how you connect to the DB.
What error messages do you get?
Do you get any output to the screen?

Im not seeing it but its not working

This doesn't make any sense.

0

Dear,

Please post something more to understand. you have created primary key on gameID is not making any sense..

0
> mysql_select_db("my_db", $con);
> $sql = "CREATE TABLE stream
> (
> waveID int NOT NULL AUTO_INCREMENT,
> PRIMARY KEY(waveID),
> userID int,
> wave varchar(25),
> waveTime TIMESTAMP DEFAULT NOW()
> )";
> // Execute query
> if(!mysql_query($sql))
> {
> echo "Couldn't do it";
> }
> else
> {
> echo "alright";
> }

sorry, typo, i fixed it a second after i posted this but forgot to update this.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.