Need help

Hello!

I’m trying to make a cron in php that will move a picture (only her information) from a table to two other tables.
Here is my code:

$iaupoza = mysql_query(“SELECT * FROM pics where id=‘1’”);
////I’m selecting only one picture

while ($punpoza = mysql_fetch_array($iaupoza))
{
$yesterday = date(‘y-m-d’, mktime(0, 0, 0, date(“m”) , date(“d”) - 1, date(“Y”)));
print “
I’ve inserted a line: $yesterday, {$punpoza[‘id’]}, {$punpoza[‘hint’]}, {$punpoza[‘clng’]}, {$punpoza[‘obiectiv’]}”; // this is working
// mysql_query(“INSERT INTO lastweekpics set id=’{$punpoza[‘id’]}’ data=’$yesterday’, hint=’{$punpoza[‘hint’]}’, clat=’{$punpoza[‘clat’]}’, clng=’{$punpoza[‘clng’]}’, erac=’{$punpoza[‘erac’]}’, poza=’{$punpoza[‘poza’]}’, obiectiv=’{$punpoza[‘obiectiv’]}’”);
mysql_query(“INSERT INTO lastweekpics (id, data, hint, clat, clng, erac,poza, obiectiv) VALUES (’{$punpoza[‘id’]}’, ‘$yesterday’, ‘{$punpoza[‘hint’]}’, ‘{$punpoza[‘clat’]}’, ‘{$punpoza[‘clng’]}’, ‘{$punpoza[‘erac’]}’,’{$punpoza[‘poza’]}’, ‘{$punpoza[‘obiectiv’]}’)”);
print “
I’ve inserted another line”;
// mysql_query(“INSERT INTO archivepics set id=’{$punpoza[‘id’]}’ data=’$yesterday’, hint=’{$punpoza[‘hint’]}’, clat=’{$punpoza[‘clat’]}’, clng=’{$punpoza[‘clng’]}’, erac=’{$punpoza[‘erac’]}’, poza=’{$punpoza[‘poza’]}’, obiectiv=’{$punpoza[‘obiectiv’]}’”);
mysql_query(“INSERT INTO archivepics (id, data, hint, clat, clng, erac,poza, obiectiv) VALUES (’{$punpoza[‘id’]}’, ‘$yesterday’, ‘{$punpoza[‘hint’]}’, ‘{$punpoza[‘clat’]}’, ‘{$punpoza[‘clng’]}’, ‘{$punpoza[‘erac’]}’,’{$punpoza[‘poza’]}’, ‘{$punpoza[‘obiectiv’]}’)”);
}

mysql_query(“DELETE FROM pics where id=‘1’”);
//i’m deleting the picture from the main table and I’m trying to move the other pictures (to decrement their id)… the problem is that I set the id to be auto_increment

$mod = mysql_query(“SELECT * FROM pics”);
while ($modific = mysql_fetch_array($mod))
{
print “
I’m modifying one line: {$modific[‘id’]} - >”;
$nouid=$modific[‘id’]-1;
print “$nouid
”;
mysql_query(“UPDATE pics set id=’$nouid’ where id=’{$modific[‘id’]}’”);
// this is not working…
}

Can you help me with a solution? because my code doesn’t make any insertions in my other two tables (the deletion works in my main table) and the id isn’t changed…

Thank you

Sponsor our Newsletter | Privacy Policy | Terms of Service