...

View Full Version : Question about Session destroy



Ultragames
10-16-2004, 06:02 AM
Does session destroy actualy delete a cookie writen by session? Or does it just stop remembering the ID of the cookie used? If neither, than what does it do.

This leads into another part. One of my PHP pages writes to a database, the information it pulls out of a session it creates. If you hit refresh however, it writes the information again, in a new database table. How can i stop this? Is session_destroy the answer?

fci
10-16-2004, 06:27 AM
yes.. why didn't you actually try it before asking?

or you could check to see if the data was already in the database and not insert it into the tables if data already exists for that session.

Ultragames
10-16-2004, 06:38 AM
I tried it. But it still seams to be sending the data.

if i wrote the session number into the database, and then wrote an if{} to check for it, would that work?

$SESSID = session_id();
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query="SELECT * FROM Orders ORDER BY $SORTBY DESC";
$result=mysql_query($query);

$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$Session=mysql_result($result,$i,"Session");
if($SESSID == $Session){
$invalid = true;
}
}
if($invalid != true){
BLAH BLAH BLAH
}

Would that do it?

Also. I know how to create a database table, but im not sure how to add a feild to it. How can i do this?

fci
10-16-2004, 06:53 AM
do you have phpmyadmin?
http://www.devshed.com/c/a/PHP/Changing-Table-Structure-in-phpMyAdmin/
http://www.phpmyadmin.net/documentation/

Ultragames
10-16-2004, 06:55 AM
My teacher at my school does. unfortunatly, i dont have access to it. I have been having him add my feilds when i wanted to add one, but i need to know how to do it with raw code.

fci
10-16-2004, 06:57 AM
http://dev.mysql.com/doc/mysql/en/ALTER_TABLE.html



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum