You are here: parallel interpreter/db problem. transaction didn't fix. « PHP Programming Language « IT news, forums, messages
parallel interpreter/db problem. transaction didn't fix.

Posted by Jim Michaels on 04/23/06 08:33

mysql_query("START TRANSACTION", $link2);
$q2=mysql_query("SELECT pictures.pid AS pid
FROM pictures,counter
WHERE pictures.pid>counter.pid
LIMIT 1", $link2);
if ($row2=mysql_fetch_assoc($q2)) {
mysql_query("UPDATE counter SET pid=$row2[pid]", $link2);
$n=$row2['pid'];
} else { //reached end of table.
mysql_query("UPDATE counter SET pid=1", $link2);
$n=1;
}
mysql_free_result($q2);
mysql_query("COMMIT", $link2);

the transaction makes no difference in the outcome.
I've even tried locking the tables, but that only results in invalid
resource errors.
when this picture code is called twice in sequence, (2 separate
interpreters, possibly by separate processors), I get the same image. I
shouldn't be getting the same image twice. this is one of those
hair-pulling sessions.

Everything I've tried results either in no pictures at all (picture
placeholders) with both the same sizes due to errors, or with the same
pictures on the same page.

transactions, no transactions, using a counter is out of the question.
I don't understand what's even happening here. the transaction *should* fix
this! Am I missing something

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация