[PHP] mysql_query pain!

Soldato
Joined
30 Jun 2003
Posts
2,807
Location
Berkshire
trying to get mysql enter the following data;

Code:
CREATE TABLE `servers` (
  `host` varchar(255) NOT NULL default '',
  `user` varchar(255) NOT NULL default '',
  `accesshash` text NOT NULL,
  PRIMARY KEY  (`host`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE `users` (
  `ID` mediumint(9) NOT NULL auto_increment,
  `username` varchar(60) default NULL,
  `password` varchar(60) default NULL,
  PRIMARY KEY  (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

I'm doing each part seperately firstly the "servers" database i've done

Code:
 <?php
 require 'config.php';
mysql_query("CREATE TABLE `servers` (  `host` varchar(255) NOT NULL default '',  `user` varchar(255) NOT NULL default '',  `accesshash` text NOT NULL,  PRIMARY KEY  (`host`)))
 or die(mysql_error()");  
 
 ?>

config.php contains:

Code:
<?php
$connect = mysql_connect("HOST", "USER", "PASSWORD") or die(mysql_error());
$db = mysql_select_db("DATABASE") or die(mysql_error()); 
?>

Anyone got any suggestions on why this is not working?
 
ok tried the error coding, firstly i forgot to put ../ infront of config.php however its still not adding the tables to the database
 
done it

Code:
 <?php
 error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
 require '../config.php';
mysql_query("CREATE TABLE `servers` (
  `host` varchar(255) NOT NULL default '',
  `user` varchar(255) NOT NULL default '',
  `accesshash` text NOT NULL,
  PRIMARY KEY  (`host`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1")
 or die(mysql_error()); 
 ?>
 
Back
Top Bottom