View Single Post
Old 11-20-2008, 02:02 AM   #5 (permalink)
zxt3st
The Addict
 
zxt3st's Avatar
 
Join Date: Apr 2008
Posts: 200
Thanks: 18
zxt3st is on a distinguished road
Default

Quote:
Originally Posted by Normo View Post
I have an account that allows me to make unlimited databases, therefore I assumed I would be able to create them outside of the admin system. :/

Can I create tables outside of a database then? :S
Hmm, as far as i experience, most of the freehost usually do is that give you only one database for you to use in any way you want it. Then just create multiple tables under that single database.

So if you really have an account that can make unlimited databases, then it wont give you any problems usually. Just try to replace some of the value in your codes.

Your code
Code:
<?php 
mysql_connect("localhost", "", "") or die(mysql_error()); 
echo "Connected to MySQL<br />"; 
mysql_query("CREATE DATABASE test") or die(mysql_error()); 
echo "Connected to Database<br />"; 
?>  [IMG]file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/moz-screenshot.jpg[/IMG][IMG]file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/moz-screenshot-1.jpg[/IMG][IMG]file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/moz-screenshot-2.jpg[/IMG][IMG]file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/moz-screenshot-3.jpg[/IMG]
Change it to
PHP Code:
<?php
$host 
'the domain of the hosting here';
$u_host 'something'#username of your account that can create unlimited database
$p_host 'something'#password of your account that can create unlimited database

$link mysql_connect($host$u_host$p_host)or die("Error: Could not connect to the database server");
if (
$link){
  
$q_create "create database test";
  
mysql_query($q_create$link)or die("Error: Could not create database!");
}else{
  return 
false;
}
?>
Take note that "test" is already existing in a mysql server unless it is remove by admin(if im not mistaken about it). So try to put other names as a sample.

Quote:
Originally Posted by Normo View Post
Can I create tables outside of a database then? :S
You cannot create a tables outside a database. It works this way, you can't sit if you dont have a chair. Easy right?


Regards,
t3st
zxt3st is offline  
Reply With Quote