Jump to content

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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.