Hello everyone,
I seem to be having a problem inserting some information into a MySQL table. Below is a copy of the MySQL table code I used and also the PHP code. I was wondering if anyone can help me find out why it wont insert the information.
What I am trying to do is make it so members can go and choose an option to join one of a selection of islands which will be subdivded into towns and then the town subdivided into villages. Each of the island/town and village levels will have a staff rank to allow certain members to have access rights to those pages.
But basically as you can see I want to set the default island/town/village levels and ranks to 0 intially. Then when the member goes to the island -age they will choose an island of say 4 options (which would update the island field to between 1-4 to depending on selecting an option. Then they choose a town of say between 1-4 and then again it updates the town field of between 1-4. And again for the village.
However, for some reason this code isnt working so far and its stopped me in my tracks. lol
I am using the $userid and $game tags which are apart of the include global.inc.php page I believe. I need this to identify the user and their individual details.
Can anyone help or see any obvious mistakes?
Here is the MySQL code:
CREATE TABLE `island2` (
`id` int(10) unsigned NOT NULL auto_increment,
`user` int(11) NOT NULL default '0',
`island` int(11) NOT NULL default '0',
`town` int(11) NOT NULL default '0',
`village` int(11) NOT NULL default '0',
`islandrank` int(11) NOT NULL default '0',
`townrank` int(11) NOT NULL default '0',
`villagerank` int(11) NOT NULL default '0',
`game` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6359 ;
And this is the PHP island1090.pro.php page which should once the link on island1090.php is clicked insert a row. But currently it doesnt do it.
<?php
/*
Move to Island 1090 (island1090.pro.php)
*/
ob_start();
$rank_check = 1;
include "global.inc.php";
$check = fetch("SELECT * FROM island2 WHERE user = '$userid' AND game = '$game'");
if ($check[id])
{
die(header(error("isaland1090.php?game=$game","You already have a House.")));
}
mysql_query("INSERT INTO island2 (id,user,island,town,village,islandrank,townrank,villagerank,game) VALUES ('',$userid','1','1','1','0','0','0','$game')");
header(error("island1090.php?game=$game","You have just settled into *****Island name here*******."));
?>
Any help is much appreciated.
Thank you
Justin