journeyman73 Posted May 28, 2008 Share Posted May 28, 2008 I want to be able to run this when the page loads, can somebody please help me at the moment it only runs if i refresh the page when it's loaded also can this be simplified? <?php mysql_query("DELETE FROM fixtures"); mysql_query("DELETE FROM highest_alley"); mysql_query("DELETE FROM player_scores"); mysql_query("DELETE FROM player_averages"); mysql_query("DELETE FROM results"); mysql_query("DELETE FROM tables"); mysql_query("DELETE FROM team_averages"); mysql_query("DELETE FROM trophy_leaders"); ?> Cheers kev Quote Link to comment https://forums.phpfreaks.com/topic/107610-running-when-the-page-loads/ Share on other sites More sharing options...
MadTechie Posted May 28, 2008 Share Posted May 28, 2008 we would need to see more code as that would run, without a refeash Quote Link to comment https://forums.phpfreaks.com/topic/107610-running-when-the-page-loads/#findComment-551556 Share on other sites More sharing options...
Daniel0 Posted May 28, 2008 Share Posted May 28, 2008 It does run when it's loading... Quote Link to comment https://forums.phpfreaks.com/topic/107610-running-when-the-page-loads/#findComment-551558 Share on other sites More sharing options...
journeyman73 Posted May 28, 2008 Author Share Posted May 28, 2008 but it won't delete anything unless i refresh the the page, it there a way i could do it so i don't have to refresh? Quote Link to comment https://forums.phpfreaks.com/topic/107610-running-when-the-page-loads/#findComment-551865 Share on other sites More sharing options...
MadTechie Posted May 28, 2008 Share Posted May 28, 2008 we would need to see more code as that would run, without a refeash Quote Link to comment https://forums.phpfreaks.com/topic/107610-running-when-the-page-loads/#findComment-551979 Share on other sites More sharing options...
journeyman73 Posted May 28, 2008 Author Share Posted May 28, 2008 that is all i have on a php page with no html on it at all kev Quote Link to comment https://forums.phpfreaks.com/topic/107610-running-when-the-page-loads/#findComment-552137 Share on other sites More sharing options...
.josh Posted May 28, 2008 Share Posted May 28, 2008 well if that's the only code you have for that whole file, then it IS deleting the first time around, but since you have no code to query/display the updated table, it's not showing an updated version until reload. I'm going to assume you have some other file you're running to query/display. It's not going to magically change before your eyes. That's not how php works. Quote Link to comment https://forums.phpfreaks.com/topic/107610-running-when-the-page-loads/#findComment-552138 Share on other sites More sharing options...
DarkWater Posted May 28, 2008 Share Posted May 28, 2008 Where's your connection script then? Obviously you have some more code. Quote Link to comment https://forums.phpfreaks.com/topic/107610-running-when-the-page-loads/#findComment-552141 Share on other sites More sharing options...
journeyman73 Posted May 28, 2008 Author Share Posted May 28, 2008 yes i do have a connection script that i use from an include that is across the whole site. when i call this page i get a blank page (which i know as it has no html on it) but when i check using mysql gui tools it still shows that data still there, but if i then refresh the page the data has gone I can do it fine when i'm deleting one record from a table but i need to delete all records from the tables in one go, this has got me stumped Quote Link to comment https://forums.phpfreaks.com/topic/107610-running-when-the-page-loads/#findComment-552161 Share on other sites More sharing options...
Darklink Posted May 28, 2008 Share Posted May 28, 2008 Use truncate instead. Not that it will make a difference in front of your eyes, but it's better. --- If you have data stored in memory it won't delete itself until you refresh. Just because something has gone from the database, doesn't mean it has automatically handled memory. I may of got your wrong here. You need to explain yourself a little bit more. Quote Link to comment https://forums.phpfreaks.com/topic/107610-running-when-the-page-loads/#findComment-552215 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.