Web Hosting Talk







View Full Version : [php] Newbie needs help php+mysql - quick answer required


Georgecooldude
06-05-2005, 04:03 PM
Hey guys,

I'm trying to do some programming for a php protal but I'm being a newbie and have got stuck. Maybe someone can see my faults and correct them?

$table_create[$prefix."_forums_cat"]=CREATE TABLE `".$prefix."_forums_cat` ("
."`cod` int(10) unsigned NOT NULL auto_increment,"
."`scat` varchar(80) NOT NULL default '0',"
."`pos` smallint(5) unsigned NOT NULL default '0',"
."PRIMARY KEY (`cod`)//" - Thought that quote was needed?
.") TYPE=MyISAM";

$table_index[$prefix."_forums_cat"][]="PRIMARY KEY (`cod`)";

$table[$prefix."_forums_cat"]["cod"]["field"]="cod";
$table[$prefix."_forums_cat"]["cod"]["type"]="int(10)";
$table[$prefix."_forums_cat"]["cod"]["attributes"]="unsigned";
$table[$prefix."_forums_cat"]["cod"]["null"]="no";
$table[$prefix."_forums_cat"]["cod"]["default"]="";
$table[$prefix."_forums_cat"]["cod"]["Extra"]="auto_increment";

$table[$prefix."_forums_cat"]["scat"]["field"]="scat";
$table[$prefix."_forums_cat"]["scat"]["type"]="varchar(80)";
$table[$prefix."_forums_cat"]["scat"]["null"]="no";
$table[$prefix."_forums_cat"]["scat"]["default"]="";

$table[$prefix."_forums_cat"]["pos"]["field"]="pos";
$table[$prefix."_forums_cat"]["pos"]["type"]="smallint(5)";
$table[$prefix."_forums_cat"]["pos"]["attributes"]="unsigned";
$table[$prefix."_forums_cat"]["pos"]["null"]="no";
$table[$prefix."_forums_cat"]["pos"]["default]="";

Any help much appreciated. :D

Does it have any errors or is it fine?

Vincent Lascaux
06-05-2005, 06:56 PM
Maybe you could try it... The first thing that jumps to my eyes is that you create a table that you never use.

One of my teacher told me the story (I let you judge if it's fake or not ;)) of a guy who inventer the WOM (Write Only Memory). Are you that person ? :P

Burhan
06-06-2005, 02:08 AM
You are missing a beginning " before CREATE TABLE.


$table_create[$prefix."_forums_cat"]="CREATE TABLE `".$prefix."_forums_cat` (
`cod` int(10) unsigned NOT NULL auto_increment, `scat` varchar(80) NOT NULL default '0', `pos` smallint(5) unsigned NOT NULL default '0', PRIMARY KEY (`cod`)) TYPE=MyISAM";

Georgecooldude
06-07-2005, 03:07 PM
fyrestrtr you are a Pro! Thanks! :D