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

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 for diafol

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 meeting, networking, learning, and sharing knowledge.