Reply to Re: INSERT into mysql alway make two entries

Your name:

Reply:


Posted by Johannes A. Brunner on 09/14/05 08:50

Andy Hassall wrote:

> The INSERT can't be doing that. The most common mistake in this sort of
> thing
> is setting up a race condition, so two requests both start a new session
> and overlap saving to the database.

But if I have a racecondition it would make no differenc using a variable or a fixed string.
$result = mysql_query("INSERT INTO session SET ssid='$season',ip='$rip'",$connect);
$result = mysql_query("INSERT INTO session SET ssid='season',ip='$rip'",$connect);

But the second line works fine. Just one db-entrie per page hit.

> How are you detecting there's no ssid?

@$ssid = $_GET['ssid'];
if (!isset($ssid)) { $ssid = ssid_generate(); ssid_register($ssid,'false','unknown','false'); }


> What are you doing with the ssid afterwards?

A lot of stuf,
Here is the way I create the ssid

function ssid_generate() {

$ssid = md5(time());
return $ssid;
}

[Back to original 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

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