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";
}

Recommended Answers

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 …

Jump to Post

All 4 Replies

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

Member Avatar

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.

Dear,

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

> 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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.