Reply to Re: Why does this insert twice?

Your name:

Reply:


Posted by Geoff Berrow on 09/04/05 17:28

I noticed that Message-ID: <hBBSe.3225$7p1.3015@newsfe7-win.ntli.net>
from toedipper contained the following:

>
>I have the code below which logs a visitor to my site via logging the
>session id and other details in a table.

We've just had this. Why are you storing the session ID? Simply set a
session variable to true at the beginning of the session, check for it
before you write to the database, then set the session variable to
false.

e.g.
session_start();
if(!isset($_SESSION['test'])){
$_SESSION['test']=true;
}

if($_SESSION['test']){
//write to database
$_SESSION['test']=false;
}
else{
//visitor already logged so do other stuff
}


--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

[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

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