Jump to content

help reading from a table


Dragen

Recommended Posts

Hi,

I'm trying to create a simple calendar type tool. What I've got is a file called calendar.php, which creates the calendar. I've also got another admin system running so that someone can add information to a databse. I'm wanting to take this information and use it in my calendar.

The calendar is used to highlit certain days, which I need to select from the database.

My database table is

bookID | day | month | year

with bookID as a primary key. I'm trying to get my calendar to read the input from the day month and year columns and highlight those days on the calendar.

I found a quick reference of reading data from a table, but it's not what I need..

mysql_select_db("gimppro2", $conn);

$result = mysql_query("SELECT * FROM booked");

while($row = mysql_fetch_array($result))
  {
  echo $row['day'] . " / " . $row['month'] . " / " . $row['year'];
  echo "<br />";
  }

obvously the table is called booked..

I thought if I could save the results of the table as a variable and then when creating the calendar, check it against the variables. I just don't know how to do so...

I guess the $result variable is what I need to use. Also not sure how I'd check it either...

 

Any help would be great!

thanks

Link to comment
https://forums.phpfreaks.com/topic/45953-help-reading-from-a-table/
Share on other sites

I was just going to edit my previous post, but didn't seem to be able to.. so here goes.

I realise that I didn't write down my whole table above. Just the headers.

here's the whole thing.. hopefully it's understandable.

bookID | day | month | year
---------------------------
  1    |  2  |   1   | 2007
  2    | 12  |   11  | 2007
  4    |  4  |   6   | 2008

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.