Jump to content


Photo

Create Tables in Mysql


  • Please log in to reply
2 replies to this topic

#1 superhoops

superhoops
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 27 August 2006 - 06:04 PM

Hi my name is Michael and i have just started working with mysql today. I have a database already and want to  add a table to it using sql/php code.

Here is the code i have:

<?php
$con = mysql_connect

("db5.awardspace.com:3306","fmpsite_reg","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
// Create table in fmpsite_reg database
mysql_select_db("fmpsite_reg", $con);
$sql = "CREATE TABLE Market
(
Player varchar(15),
Price varchar(12),
Type text
Position text
Age int(2)
Ka int(2)
Ta int(2)
Pa int(2)
Sa int(2)
)";
mysql_query($sql,$con);
?>

I have put in the password field password so noone here takes it but i was wondering what is wrong with the code or what i need to do to create the tables as i uploaded this file and went to my database and the table had not been created.

Any help will be greatly appreciated.

Thanks
Michael

#2 superhoops

superhoops
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 27 August 2006 - 06:26 PM

I have added the line

mysql> SHOW TABLES;

But the file doesn't show this?

I must be doing something wrong???

Any help would be much appreicated.

#3 superhoops

superhoops
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 27 August 2006 - 06:47 PM

Sorted it out.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users