snake310 Posted September 20, 2006 Share Posted September 20, 2006 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 https://forums.phpfreaks.com/topic/21378-create-table-help-pls/ Share on other sites More sharing options...
HuggieBear Posted September 20, 2006 Share Posted September 20, 2006 What errors are being output to the browser?RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/21378-create-table-help-pls/#findComment-95184 Share on other sites More sharing options...
snake310 Posted September 20, 2006 Author Share Posted September 20, 2006 i get error : Fail Link to comment https://forums.phpfreaks.com/topic/21378-create-table-help-pls/#findComment-95187 Share on other sites More sharing options...
HuggieBear Posted September 20, 2006 Share Posted September 20, 2006 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]RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/21378-create-table-help-pls/#findComment-95197 Share on other sites More sharing options...
snake310 Posted September 20, 2006 Author Share Posted September 20, 2006 Thx problem solved ;D Link to comment https://forums.phpfreaks.com/topic/21378-create-table-help-pls/#findComment-95201 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.