Jump to content

can't insert, please help..


boon_chong

Recommended Posts

I got 2 tables, punch1 and punch2, why the record in punch1 can't insert into punch2?  

table punch1:
[table][tr][td]employeeID[/td]
[td]punch1[/td]
[td]date[/td]
[td]outlet[/td]
[/tr][/table]

table punch2:
[table][tr][td]employeeID[/td]
[td]punch2[/td]
[td]date[/td]
[td]outlet[/td]
[/tr][/table]



[code]
<?
include("8_dbconnect.php");

$sql = "select * from punch1";
$result = mysql_query($sql, $mysql_link);

$sql2 = "select * from punch2";
$result2 = mysql_query($sql2, $mysql_link);

while($row = mysql_fetch_array($result))

{

if (punch1.date !=punch2.date)
{

$i1 ="insert into punch2 (employeeID,punch2,date,outlet) values ($row[employeeID],$row[punch1],$row[date],$row[outlet])";
$result3= mysql_query($i1, $mysql_link);

}
}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/32655-cant-insert-please-help/
Share on other sites

what I'd like to do is trace the record in table punch1 whether exist in table punch2, if the condition is true then insert the record in table punch1 into table punch2. i'm not sure i'm using the right coding or not. There is no error come out, but the record can't insert.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.