Re: Multiple Inserts

From: Date: Wed, 23 Jun 2004 07:27:02 +0000
Subject: Re: Multiple Inserts
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-34883@lists.php.net to get a copy of this message
some tips when inserting data: instead of inserting into the the table, do some debugging,echo the insert string and check if: 1- all string fields are between single comma ('field_name').Numéric fields do not need single comma; 2- all not null fields are present in the field list; 3- you're respecting the fields order (insert into t (x,y,z) values (val_x,val_y,val_z) ); hope it helps. Rui Cunha Daniel Clark writes:
Any errors? Is the all the other data inserting into the second table?
Hello, I am using a form to Insert data into 2 tables in the same database. $TimesheetID needs to be in each table. However, it is not being inserted into the second table, "tblTimesheetDetails" . Any advise? $result_timesheet=mysql_query("INSERT INTO tblTimesheet (TimesheetID, WorkerID, ClientID, TimesheetDate, ProspectiveOrRetrospective) VALUES ('$TimeSheetID','$WorkerID','$ClientID','$TimesheetDate','$ProspectiveOrRetr ospective')")or die("Insert Error: ".mysql_error()); $result_timesheetdetails=mysql_query("INSERT INTO tblTimesheetDetails (TimesheetID, ActivityTypeID, TimeSpentHours, TimeSpentMinutes) VALUES ('$TimeSheetID','$ActivityTypeID','$TimeSpentHours','$TimeSpentMinutes')")or die("Insert Error: ".mysql_error()); Thanks, Declan.


« previous php.db (#34883) next »