Jump to content

Create table help pls


snake310

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");}
?>
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.