Jump to content

Fetching data from mysql with php


OutOfInk

Recommended Posts

In the database i need to extract the following information; Date, And return which round of game it is.

 

Im sure their is a much better way and easier way than how im going about this, so if someone could improve the way im going about it would be awesome.

 

There are 23 rounds. In each round there are 9 games.

 

$round1 = mysql_fetch_row(mysql_query("SELECT MIN(Date) , MAX(Date) FROM `gamerounds` WHERE `round` = '1'"));

 

$rounddate = date();

 

round one dates are from say 14th of March to 23rd of March, than round 2 will run from 27th of March to 1 of April

 

if (($round1[0] >= $rounddate) && ($round1[1] <= $rounddate)){ echo "Round 1"; }else{ echo "Not round 1"; }

 

I could do this for all 23 than compare them in a If and else code and eventually return what round it is but it would be like a page and im sure time wasting time and there has to be a better way

Link to comment
https://forums.phpfreaks.com/topic/286958-fetching-data-from-mysql-with-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.