[PHP] Has anyone this script ??

2002-12-01 Thread Ray Healy \(Data Net Services\)
Dear All

I have been trying for ages to write a PHP calendar with a mySQL backend but cannot 
seem to get it working correctly.

I have visited many sites and downloaded various free scripts but they all seem to do 
more than I need although they are all excellent.

What I want to be able to do is enter a start_date and end_date from a form with a 
event. Once this is in the databse then the calender can be viewed and all those days 
that have an event, the days cell is coloured, say red. If there are no events for 
that day then it stays white. There is no need to see the event in the general user 
calendar. This way they can see which days are booked and which days are not.

Has anyone such a script that I could use or at lesat get an idea how to do it. I have 
alreday tried all the script archives and tutorials.

Any advice would be appreciated.

Thanks

Ray


Re: [PHP] Display cell if dates are between 2 dates - help

2002-11-17 Thread Ray Healy \(Data Net Services\)
Dear Jason

The startdate and endate columns are date format - have any ideas what i
can do

Thanks for yout help

Ray
- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, November 17, 2002 6:22 AM
Subject: Re: [PHP] Display cell if dates are between 2 dates - help


 On Sunday 17 November 2002 04:10, Ray Healy \(Data Net Services\) wrote:
  Dear all
 
  I'm trying to create a search function that can check the current day in
a
  calendar against a mysql database where there is a startdate and enddate
  and if the date is there then colour code the cell in the calendar.
 
  I have tried to use the following command
 
  $eventQuery = SELECT title FROM prestigecal WHERE '$sql_currentday'
  BETWEEN startdate AND enddate;;
 
  The database has an ID - title - startdate - enddate

 What types are the columns 'startdate' and 'enddate'?

 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 You're ugly and your mother dresses you funny.
 */


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Display cell if dates are between 2 dates - help

2002-11-16 Thread Ray Healy \(Data Net Services\)
Dear all

I'm trying to create a search function that can check the current day in a calendar 
against a mysql database where there is a startdate and enddate and if the date is 
there then colour code the cell in the calendar.

I have tried to use the following command

$eventQuery = SELECT title FROM prestigecal WHERE '$sql_currentday' BETWEEN startdate 
AND enddate;;

The database has an ID - title - startdate - enddate

This seems to work BUT if the date in the database is a single number i.e. 0 to 9 it 
cannot dispaly it and also if the startdate or endate is a 10, 20 or 30 it also thinks 
that it is a 1, 2or 3

Just in case it helps the full codede for this section is as follows :

/snip
$sql_currentday = $year-$month-$zz;
$eventQuery = SELECT title FROM prestigecal WHERE '$sql_currentday' BETWEEN startdate 
AND enddate;;
$eventExec = mysql_query($eventQuery);
while($row = mysql_fetch_array($eventExec)) {
if (strlen($row[title])  0) {
echo td bgcolor=\red\ valign=\middle\ align=\center\font size=\1px\ 
face=\Verdana\$zz/font/td\n;
$result_found = 1;
/snip


Thanks for any advice.

Ray




[PHP] Calendar script - help

2002-11-03 Thread Ray Healy \(Data Net Services\)
Dear All

I spent days and days on this little project but still cannot get it to work (new to 
PHP as you might guess).

I have a script which is a combination of tutorial scripts and free code to display a 
calendar with colour coded cells for the events on each day.

The only way to enter events is to enter them one at a time. What I want to do is to 
be able to enter either a start date and end date or start date and the number of 
days. This will then enter a new line in the mySQL database for each day. There would 
only ever be one vent per day.

I have the following fields at present in the database and would probably need another 
field (say number of days)
id int (auto_increment) - eventdate date ('-00-00') - title (varchar) - event 
(blob)

Can anyone help me as I have searched them web and mail lists to no avail. Everything 
that is available is excellent but does too much for what I need.

Summary:- a calendar that can colour code the background cells if there is an event 
title in the mySQL database and to be able to enter the event for multiple days.

Any help would be very much appreciated.

Thanks for your time

Ray



[PHP] PHP/mySQL help or advice

2002-10-13 Thread Ray Healy \(Data Net Services\)

Hi All

I have been trying to write a database and scripts for a calendar that shows which 
days are booked and have failed at each point.

What i would like it to do is to show a calendar which have the dates that are booked 
in a cell which are colour coded (say red) when it is unavailable and say white when 
available.

The admiministartor should be able to enter multiple dates at a time (say a holiday is 
booked for 5 days). perhaps a section for nortes that is only available for admin use 
only would be handy.

An option to view 2 months at a time or perhaps the whole year would also be nice.

I have downloaded various scripts and tried to write my own but I cannot seem to be 
able to enter multiple dates or colour code the output.

Can anyone help me or perhaps someone already has a script  database that does this 
and would be willing to share.

Otherwise it there a script already out there that will do this - all the one that I 
can find seem to do too much by allowing multiple users and storing a lot more data 
which is something I do nort need.

Any help would be appreciated as I am tearing my hair out at the moment.

Thanks for your time

Ray Healy



[PHP] Enhancement of script

2002-09-07 Thread Ray Healy \(Data Net Services\)

Dear All

I have recently downloaded a calendar from CST (which is no longer
supported ) and I have made a few changes to the script.

The calendar will be used to see when something is booked and you can assign
messages to it as well which the general user cannot see. In this respects I
have created 2 pages - welcome .php for the general viewer and admin_welcome
for the updating of the calendar.

What I would like to do is to be able to enter multiple dates in at the same
time - either saying from a start date for so many days or from a start date
to an end date.

After spending hours looking at the code and in this forum I cannot seem to
get it right - basically I cannot do it.

I was wondering if someone could have a look and tell me where I am going
wrong.

I have attached the files to this email along with the mySQL table file in
case another column needs to be added.

You can see the script running at
www.matrix-hosting.co.uk/prestige/welcome.php for the general view and
www.matrix-hosting.co.uk/prestige/admin_welcome.php for the admin side.

Any help would be appreciated


Ray

P.S. if any one also knows how to get it to display a 2 or 3 months at a
time or even a year this would also be a bonus as I have tried to do this as
well.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Enhancement of script

2002-09-07 Thread Ray Healy \(Data Net Services\)

Dear All

The calendar will be used to see when something is booked and you can assign
messages to it as well which the general user cannot see. In this respects I
have created 2 pages - welcome .php for the general viewer and admin_welcome
for the updating of the calendar.

What I would like to do is to be able to enter multiple dates in at the same
time - either saying from a start date for so many days or from a start date
to an end date.

After spending hours looking at the code and in this forum I cannot seem to
get it right - basically I cannot do it.

I was wondering if someone could have a look and tell me where I am going
wrong. (scripts at bottom of page)

ng at
www.matrix-hosting.co.uk/prestige/welcome.php for the general view and
www.matrix-hosting.co.uk/prestige/admin_welcome.php for the admin side.

Any help would be appreciated

Ray

P.S. if any one also knows how to get it to display a 2 or 3 months at a
time or even a year this would also be a bonus as I have tried to do this as
well.

The Scipts:

mySQL Database File
CREATE TABLE tablename (
id int(11) DEFAULT '0' NOT NULL auto_increment,
username varchar(255),
stamp datetime,
subject varchar(255),
description blob,
PRIMARY KEY (id)
);


welcome.php (this is what the end user sees)
?
$mysql_hostname = 'localhost';
$mysql_username = '';
$mysql_password = '';
$mysql_database = '';
$mysql_tablename = '';
$currentday = date(j, time());
$currentmonth = date(m, time());
$currentyear = date(Y, time());
$lastday = 1;
$database = mysql_connect($mysql_hostname, $mysql_username,
$mysql_password);
if (!$month)
{
$month = date(m, time());
$year = date(Y, time());
}

mysql_select_db($mysql_database, $database);
echo centerfont face=Arial size=2b;
echo date('F', mktime(0,0,0,$month,1,$year));
echo  $yearpfont size=3/bp;

$firstday = date( 'w', mktime(0,0,0,$month,1,$year));
while (checkdate($month,$lastday,$year))
{
$lastday++;
}

$nextmonth = $month+1;
$nextyear = $year;
if ($nextmonth == 13)
{
$nextmonth = 1;
$nextyear = $year + 1;
}
$lastmonth = $month-1;
$lastyear = $year;
if ($lastmonth == 0)
{
$lastmonth = 12;
$lastyear = $year-1;
}
echo tabletr;
echo tdform method=post action=welcome.phpinput type=submit
value=''
input type=hidden name=month value=$lastmonth
input type=hidden name=year value=$lastyear/form/td;
echo tdform method=post action=welcome.phpinput type=submit
value=''
input type=hidden name=month value=$nextmonth
input type=hidden name=year value=$nextyear/form/td/tr/table;

echo table width=175 cellpadding=1 cellspacing=1 border=1;
echo trtd width=25font size=2bSun/b/font/tdtd width=25font
size=2bMon/b/font/td
td width=25font size=2bTue/b/font/tdtd width=25font
size=2bWed/b/font/td
td width=25font size=2bThu/b/font/tdtd width=25font
size=2bFri/b/font/td
td width=25font size=2bSat/b/font/td/b/font/tr;
for ($i=0; $i7; $i++)
{
if ($i  $firstday)
{
echo td/td;
}
else
{
$thisday = ($i+1)-$firstday;
if ($currentyear  $year)
{
echo td valign=top align=center bgcolor=dd;
}
else if ($currentmonth  $month  $currentyear == $year)
{
echo td valign=top align=center bgcolor=dd;
}
else if ($currentmonth == $month  $currentday  $thisday  $currentyear
== $year)
{
echo td valign=top align=center bgcolor=dd;
}
else
{
echo td valign=top align=center bgcolor=white;
}
echo font size=2b$thisday/b/fontbr
font size=3;
$query2 = mysql_query(SELECT subject FROM $mysql_tablename WHERE stamp =
\$year-$month-$thisday 00:00:00\ and stamp = \$year-$month-$thisday
23:59:59\ ORDER BY stamp);
for ($j = 0; $jmysql_num_rows($query2); $j++)
{
$results = mysql_fetch_array($query2);
if ($results[subject])
{
echo font color=redb$results[subject]/b/font;
}
}
if (mysql_num_rows($query2)  4)
{
for ($j=0; $j(4-mysql_num_rows($query2)); $j++)
echo ;
}
echo /td;
}
}
echo /tr\n;
$nextday = ($i+1)-$firstday;
for ($j = 0; $j5; $j++)
{
echo tr;
for ($k = 0; $k7; $k++)
{
if ($nextday  $lastday)
{
if ($currentyear  $year)
{
echo td valign=top align=center bgcolor=dd;
}
else if ($currentmonth  $month  $currentyear == $year)
{
echo td valign=top bgcolor=dd;
}
else if ($currentmonth == $month  $currentday  $nextday  $currentyear
== $year)
{
echo td valign=top align=center bgcolor=dd;
}
else
{
echo td valign=top align=center bgcolor=white;
}
echo font size=2b$nextday/b/fontbr
font size=3;
$query3 = mysql_query(SELECT subject FROM $mysql_tablename WHERE stamp =
\$year-$month-$nextday 00:00:00\ AND stamp = \$year-$month-$nextday
23:59:59\ ORDER BY stamp);
for ($i = 0; $imysql_num_rows($query3)+4; $i++)
{
$results2 = mysql_fetch_array($query3);
if ($results2[subject])
{
echo font color=redb$results2[subject]/b/font;
}
else if ($i  4)
{
echo ;
}
}
echo /td;
$nextday++;
}
}
echo /tr\n;
}
echo /tablefont size=3;
?


admin_welcome.php  (this is what the admin uses)
?
$mysql_hostname = 'localhost';
$mysql_username = '';
$mysql_password = '';
$mysql_database = '';
$mysql_tablename = '';
$currentday = date(j, time());
$currentmonth = date(m, time());
$currentyear = date(Y, 

[PHP] Help with script - if possible

2002-08-28 Thread Ray Healy \(Data Net Services\)

Hi All

Thanks for everyones help in trying to get my script to work - I'm learning
fast. But have the following problem:

I am using the following select command for searching a table with regards
to booked villas according to id number:

$sql = SELECT COUNT(*) as count FROM bookings WHERE '$book_start_date'
BETWEEN booking_start AND booking_end OR '$book_end_date' BETWEEN
booking_start AND booking_end AND villa_id = '$place';

This counts as far as I believe an displays a 0 if available and number
of times it occurs if unavailable.

The problem I have is that still counts the number of entries regardless of
the villa_id number it is given. In other words if I have a villa that is
booked between 2002-04-10 and 2002-004-20 for villa_id 1 and I search using
the same dates (via a FORM) but on villa_id 3 it still comes back and says
that the villas is unavailable. Which of course it is wrong for villa_id 3
(it is villa_id 1 that is booked).

I have tried to find a command (something like IF villa_id =3 THEN count)
but to no avail that would only count if the villa_id matches as well.

Can anyone help

Thanks for your time.


Ray


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] New to PHP/mySQL - Help on script

2002-08-26 Thread Ray Healy \(Data Net Services\)

Thanks for everyones help yesterday but nI have come up against a problem
(as I am new). I have created my document as detailed below with notes. I
can see from the form that I have connected to the server, accessed the
correct database, created the statment and executed it. The problem is how
to display the information - as far as I can understand from yesterday if
the result is 0 then the villa is available. So what I need to do is if the
result = 0 display villa available and if the result is greater than 0 then
display villa not available . I know that the variables are getting to the
query as if I change the echo $result; to $sql;  and key in 3 as the id and
2 dates in the form I get the following:

SELECT COUNT(*) FROM bookings WHERE ('2002-04-04') BETWEEN booking_start AND
booking_end OR ('2002-04-10')BETWEEN booking_start AND booking_end AND
villa_id = ('3')

So, corrcet me if I am wrong but the query is working its just i cannot see
anything. I have spent hours on this today, reading books and looking at the
list. I hope that once I have done one good script I can then start to
understand it and create more :-)

Thanks for all your help


Ray


html
 body
 ?php

 if ($submit) {

 // open connection to database

 $db = mysql_connect(localhost, matrix, matrix);

 // pick database to use

 mysql_select_db(matrix,$db);

 // create the SQL statement

 $sql = SELECT COUNT(*) FROM bookings WHERE ('$book_start_date') BETWEEN
booking_start AND booking_end OR ('$book_end_date')BETWEEN booking_start AND
booking_end AND villa_id = ('$place');

 // execute the SQL statement

 $result = mysql_query($sql);

 // display the information

 echo $result;

} else{

 // display form

 ?
 form method=post action=?php echo $PHP_SELF?
 Villa id number:input type=Text name=placebr
 Start date:input type=Text name=book_start_datebr
 End date:input type=Text name=book_end_datebr
 input type=Submit name=submit value=Search information
 /form
 ?php
 }
  // end if
 ?
 /body
 /html



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php