Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MySQL
#1
When using MySQL, wouldn't this create multi-databases?

Code:
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die(mysql_error());
  }

if (mysql_query("CREATE DATABASE my_db",$con))
  {
  echo "Database created";
  }
else
  {
  echo mysql_error();
  }

mysql_close($con);
?>

One every time the page is loaded?
Reply
#2
(07-19-2011, 04:35 PM)roperson Wrote: When using MySQL, wouldn't this create multi-databases?

Code:
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die(mysql_error());
  }

if (mysql_query("CREATE DATABASE my_db",$con))
  {
  echo "Database created";
  }
else
  {
  echo mysql_error();
  }

mysql_close($con);
?>

One every time the page is loaded?

I think it would cause an error, because you can't have 2 databases with the same name.
Reply
#3
So...

Just create a ConnectionTest.php page, and create the db, and the tables, and then add stuff to the in the forum and stuff?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)