View Full Version : PHP-insert row+delete row
donswebdesigns
11-11-2008, 01:14 AM
This is a line in my PHP thats inserts a row into mysql table:
$insert = mysql_query("INSERT INTO $tableName2 (usersonline) VALUES ('$username')") or die(mysql_error());
What I need is a DELETE line to delete that same entry when user closes out. Can anyone help?
mysql_query("DELETE FROM $tableName2 WHERE useronline = $username");
That what you're looking for?
donswebdesigns
11-11-2008, 04:50 PM
Yes, it is....
now how to get it to run only when user exits the flash movie
Thats the 6 million dollar question. You can have a close button, but if they close the browser, you lose. You can use Javascript to catch the browser close, however, you'll see different behaviors in FF and IE.
donswebdesigns
11-11-2008, 05:52 PM
hmm.. ya makes sense, well ill tell you my goal in this project.
I have a user login MC in flash cs3, that uses php>mysql. What i want to do is show users that are logged in. In lets say another MC.
I think i need to setup some sort of session. So when user closes window the session ends. so maybe the INSERT into table and DELETE from table is the wrong ideal for what im trying to do.
Here is the login system im using.
http://flashden.net/item/ultimate-php-mysql-membership-system/5587
Dont think it uses any sessions, how would i do a show users logged in? any idea?
OR.. I just had an ideal how to run the DELETE query on last frame in flash MC?
It a frame i have a log off timer then unloads MC. If i can run it from there that would work for me.
unless you used a polling system where the flash and php are checking with eachother every minute and once that user doesnt answer, delete the name.
donswebdesigns
11-11-2008, 06:38 PM
What does a polling system require, is it hard to setup into my existing login?
polling, in this case, is another way of saying constantly check something. Basically, you want the php to constantly check if the Flash is talking back. If it isnt, delete the user name.
donswebdesigns
11-11-2008, 07:00 PM
Can you help me do that?
donswebdesigns
11-12-2008, 04:54 PM
Im looking on the net for a way to make a flash script with a loop or setinterval thats sends variables to php, and php to know when it stops then perform a query. But no luck. Not sure exactly what tell my search. Searching with keyword "polling" keeps getting me voting scripts. Im trying to find something simple to do this. This doesnt sound hard. Shuld i post a new topic? Anyways, im still looking dude, peace out.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.