Jump to content

running when the page loads


journeyman73

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.