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