Jump to content

Archived

This topic is now archived and is closed to further replies.

snake310

Create table help pls

Recommended Posts

Hi i have read tonns of tutorials but i cant figure out what could be the problem pls help me...
He wont write it to the database the wariables named $get1 and $producer works fine , at least as i echo them they show the right walue
<?php
mysql_pconnect("localhost","root")
                  or die("Unable to connect to SQL server");
mysql_select_db("$get1") or die ("No Conn");
if(!$producer)
$x=1;
else {
$sql = 'CREATE TABLE $producer ('.
        '`model` varchar(60) NOT NULL default 0,'.
        '`serial` varchar(60) NOT NULL default 0,'.
'`InTime` date NOT NULL default 0,'.
'`provider` varchar(60) NOT NULL default 0,'.
'`aviz` varchar(60) NOT NULL default 0,'.
'`OutTime` date NOT NULL default 0,'.
'`add1` varchar(60) NOT NULL default 0,'.
'`add2` varchar(60) NOT NULL default 0,'.
'`add3` varchar(60) NOT NULL default 0,'.
        '`buyer` varchar(60) NOT NULL default 0,.
      )';
 
$result = mysql_query($sql) or die ("Fail");}
?>

Share this post


Link to post
Share on other sites
OK, do you have phpMyAdmin installed?

If not I'd strongly advise getting it.  Then you can test the sql works before testing the php.  As it is, there's nothing wrong with the php.

It's all the '.' you have.

Just get rid of them and insert the following:

[code]
<?php
$sql = "CREATE TABLE $producer (
`model` varchar(60) NOT NULL default 0,
`serial` varchar(60) NOT NULL default 0,
`InTime` date NOT NULL default 0,
`provider` varchar(60) NOT NULL default 0,
`aviz` varchar(60) NOT NULL default 0,
`OutTime` date NOT NULL default 0,
`add1` varchar(60) NOT NULL default 0,
`add2` varchar(60) NOT NULL default 0,
`add3` varchar(60) NOT NULL default 0,
`buyer` varchar(60) NOT NULL default 0)";
?>
[/code]

Regards
Huggie

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.