IT.COM

[Resolved] PHP making tables in Mysql..not working

Spaceship Spaceship
Watch
PHP making tables in mysql..not working

hey why is this code not working?
PHP:
<?php
require_once("./config.php");
//Make a MYSQL Connection
mysql_connect($db_host,$db_user,$db_pass) or die(mysql_error());
mysql_select_db($db_name) or die (mysql_error());
 $sql = 'CREATE TABLE `data` (`id` INT(20) NOT NULL, `site` VARCHAR(20) NOT NULL, `username` VARCHAR(10) NOT NULL, `password` VARCHAR(10) NOT NULL, `other` TEXT NOT NULL, `yes` VARCHAR(5) NOT NULL, `no` VARCHAR(5) NOT NULL, `ip` VARCHAR(12) NOT NULL, `show` INT(1) NOT NULL, `time` TIMESTAMP(5) NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE (`id`)) ENGINE = MyISAM'; 
$result=mysql_query($query) or die (mysql_error());
echo "All tables have been created, click next to finish the set up";
?>
it connects to the database and everything but gives me this :
Query was empty


NVM I FIGURED IT OUT LOL
I USED $SQL FOR THE QUERY, BUT WHEN I DID MYSQL_QUERY, i used $query
lol
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Just curious... why is the password field VARCHAR(10)?
 
0
•••
din't know what to use :p
is it bad?
 
0
•••
A maximum password length of 10 characters? I'd say that's not good. You can't exactly fit a good hash in there, either.

I'd suggest taking that out to at least 72 or 256 to be safe. Password security is worth it.
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back