The first step in isolating SQL problems that occur in the programming language is to run the generated SQL directly against the database. In my experience if 90% of the time the program code (i.e. in your case your PHP code) is the reason - not the SQL itself.
And for future questions, you will get more accurate answers if you try to be more detailed than just "isn't working" (e.g. showing the error message)
Hi, I havent tried running a query outside of php itself, I really not sure how to do this?...do you mean just insert a some values manualy?... I am using same code for another insert on a different table and it works also I get no error messages from my php script. any ideas?.... sorry for being vague, i just wanted to try an keep the post brief.
-- Table structure for table `participant_info`
CREATE TABLE `participant_info` (
`name` varchar(50) NOT NULL,
`address` varchar(55) NOT NULL,
`phone` smallint(12) NOT NULL,
`email` varchar(55) NOT NULL,
PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Dumping data for table `participant_info`
Im not sure if this is somehow related to the previous problem, but this table will not auto increment as expected when doing an insert of data, I have to generate a random number in php then it works...really strange as it did work locally when i sent a nul ("") value for "userid" field. When live though i have to actually send a value for that parameter.
-- Table structure for table `user_registrations`
CREATE TABLE `user_registrations` (
`userid` int(6) NOT NULL auto_increment,
`theday` date NOT NULL,
`seats` smallint(4) NOT NULL,
PRIMARY KEY (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=119309 ;
-- Dumping data for table `user_registrations`
when I try an insert without sending a number of some sort for the userid param, my database is never updated and does insert of the data...when I generate a random num from php to send with the insert giving that first param a value it works....
how else can i trouble shoot this?
okay since you are just getting going, please do the following
- drop your table
- go to post #7 and copy the script down to but not including the blue stuff
- open an sql window in phpmyadmin or the command line or whatever it is you're using to administer your database
- paste in the code, execute it, and let us know what happened
flash sending id=""
so since that didnt work sending "", i used a random num for a value, should I just have left that parameter blank?
$insert_seat = "INSERT INTO user_registrations VALUES('', '$thedate', '$guests')";