Jump to content

table already exists


addyp

Recommended Posts

hi guys, I just started using msql for the frist time and am having some problems, when i go to create the new table i get the error "table already exists" i have placeds an IF statment to see is the table is created and if not to make one, however it is still returning the same error,

ill post the code below anyhelp would be much apricated

<?php
if (empty($_POST['bug_ID']))
echo "<p>You must enter a BUG ID number, No Bug Recorded</p>";
else {
$bugID = addslashes($_POST['bug_ID']);	
$name = addslashes($_POST['bug_name']);	
$date = addslashes($_POST['Date']);	
$sDescription = addslashes($_POST['shortDiscription']);
$lDescription = addslashes($_POST['Discription']);	
$action = addslashes($_POST['action']);	
}

$table = "
create table bugs (
ID varchar (50) not null,
Name varchar (50) not null,
Date varchar (50) not null,
ShortDescription varchar (50) not null,
LongDescription varchar (100) not null,
Action varchar (100) not null,
primary key (ID)
)";

$conn=mysql_connect("xxxxxxxxxxx","xxxxxxxxxxx","xxxxxxxxxx");
mysql_select_db("xxxxxxx");

$sql="SELECT * FROM $table";

$result=@mysql_query($sql);


umask(0007);
if (!$result)
{
mysql_query($table)
or die(mysql_error());
}

if(isset($_POST['submit']))
{

mysql_query("INSERT INTO bugs (ID, Name, Date, ShortDescription, LongDescription, Action)
VALUES ('$bugID', '$name', '$date', '$sDescription', '$lDescription', '$action')");
}
echo "table updated";
mysql_close();

?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.