Jump to content

Recommended Posts

Hey Guys,

 

I have setup a mysql query that is run everytime the page is refreshed. Its on my page called secure.php, which is on everypage within my website.

 

At the moment it finds all the fixtures in the database and checks if the current time has passed its specific time. It all works fine but im wanting to get that specific fixture_id so that i can then send a notification to the manager saying that the current time has passed ur fixture time.

 

$fixture = ("SELECT * FROM `fixtures`") or die(mysql_error());
$resultfixture=mysql_query($fixture);

if (mysql_num_rows($resultfixture) != 0) {
while($rows = mysql_fetch_array($resultfixture)) {

	mysql_query("UPDATE `fixtures` SET `status` = '2', `result`='TBA' WHERE UNIX_TIMESTAMP() > `time` AND `status`='1'") or die(mysql_error());  
}

}

 

Any help much appreciated!

 

Cheers

Link to comment
https://forums.phpfreaks.com/topic/268531-php-run-query/
Share on other sites

The code you posted reads every row in the table, then for every row in that table if performs the same update. You only need to perform the update once.

 

You mention "that fixture" but give no details on what that means. What are you trying to do?

Link to comment
https://forums.phpfreaks.com/topic/268531-php-run-query/#findComment-1379139
Share on other sites

Ok so lets say that msyql query runs and it finds 1 fixture that has passed its fixture time, i want to be able to get the id of that fixture so i can then run a another mysql_query that will notify the manager to let him know the current time has passed the fixture time.

 

Hope that makes sense.

Link to comment
https://forums.phpfreaks.com/topic/268531-php-run-query/#findComment-1379141
Share on other sites

I need to update all fixtures where the current time has passed the fixture time. The query will then update the column 'status' to '2'.

 

I then need to GET the fixtures that it just updated so i can run another query that will notify the managers of those fixtures.

 

 

Link to comment
https://forums.phpfreaks.com/topic/268531-php-run-query/#findComment-1379146
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.