Re: Multiple Inserts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A simple way to debug your scripts would be like this :

FROM :
$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());

TO
$sql = ("INSERT INTO tblTimesheet (TimesheetID,
WorkerID, ClientID, TimesheetDate, ProspectiveOrRetrospective) VALUES
('$TimeSheetID','$WorkerID','$ClientID','$TimesheetDate','$ProspectiveOrRetr
ospective')";
echo 'Query : ' . $sql . "\n<br>";
$result_timesheet=mysql_query($sql)or die("Insert Error: ".mysql_error());

It would atleast give you a good feeling on the data getting passed to mySQL
if youre not getting any error message.

--
--
Kim Steinhaug
----------------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
----------------------------------------------------------------------
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
----------------------------------------------------------------------

"Achieve It" <info@xxxxxxxxxxxxxx> wrote in message
news:007101c45877$b59f3940$fc90869f@xxxxxxxxx
> 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.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux