[PHP] task Scheduler driving me crazy!

2007-07-03 Thread Jason Pruim

Hi Everyone!

Okay, so for those of you who remember I have been going back and  
forth on how to write a reoccuring task manager program for my  
office, it's a little bit a labor of love, little bit wanting to  
expand my knowledge.


Anyway, I've hit a problem... I am attempting to add away to  
reschedule tasks based on a value entered in a text box (IE: 7/3/07)  
and then create a timestamp off of that so that I can have it show up  
on that date.


The problem comes in when I try and submit the values to the update  
form, as of right now, it only picks up the info in the bottom text  
box and updates it None of the others, no matter how many/few I  
have selected to update.


I think I need to put the text boxes into an array (And possibly the  
check boxes as well) but I have never done that before for text  
boxes.. Is it as easy as textbox[] to create an array of text boxes?  
Or is there something else that I'm missing?


Here is some of the code:

$result = mysql_query($sql);
echo form method='POST' action='update.php' name='ticklers';
echo table border='1' bgcolor=.$tableBody. ;
echo tr
THID #/TH
thTickler Name/th
thTickler Description/th
THCompleted/th
TH Day to complete/th
THReschedule Date/TH
/tr;

while($row = mysql_fetch_array($result)) {


echo TRTD bgcolor=.$rowColor.ID#, $row[0] /td;// ID #
	echo td bgcolor=.$rowColor.TicklerName, $row[1]  /td;//  
Tickler Name
	echo td bgcolor=.$rowColor.Instructions, A href='$row 
[2]'Instructions/A/td;// Instructions
	echo td bgcolor=.$dowColor.DayOfWeekWord, $dowword /td;//  
Day of week word
	echo TD BGCOLOR=.$rowColor.DateToReschedule, input type='text'  
name='txtReschedule' value='';//Date to reschedule
	echo TD BGCOLOR=.$rowColor.DateRescheduled, $Date;//Date  
stored in timeStamp
//	echo TD bgcolor=.$rowColor.A href='update.php?taskid=$row[0] 
taskdate=$taskdate'Click here!/A;
	echo TD bgcolor=.$rowColor.CheckboxForWhenDone, input  
type='checkbox' name='chkDone' value='$row[0]';//Check box for when  
completed


}

and the update form:

$taskdate1= $_POST['txtReschedule'];
$taskDone = $_POST['chkDone'];
$taskTime=mktime($taskdate1);

//	$sql=UPDATE tasks SET completed='1', timeStamp='$taskdate1' where  
id='$taskid' LIMIT 1;;
	$sql=update tasks set completed='1', timeStamp='$taskTime' where  
id='$taskDone' LIMIT 1;;


mysql_query($sql) or die(mysql_error());


Any help with this would be greatly appreciated! :)

Jason Pruim

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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 09:30 -0400, Jason Pruim wrote:
 Hi Everyone!

 Here is some of the code:
 
 $result = mysql_query($sql);
 echo form method='POST' action='update.php' name='ticklers';
 echo table border='1' bgcolor=.$tableBody. ;
 echo tr
 THID #/TH
 thTickler Name/th
 thTickler Description/th
 THCompleted/th
 TH Day to complete/th
 THReschedule Date/TH
 /tr;
 
 while($row = mysql_fetch_array($result)) {
 
 
   echo TRTD bgcolor=.$rowColor.ID#, $row[0] /td;// ID #
   echo td bgcolor=.$rowColor.TicklerName, $row[1]  /td;//  
 Tickler Name
   echo td bgcolor=.$rowColor.Instructions, A href='$row 
 [2]'Instructions/A/td;// Instructions
   echo td bgcolor=.$dowColor.DayOfWeekWord, $dowword /td;//  
 Day of week word
   echo TD BGCOLOR=.$rowColor.DateToReschedule, input type='text'  
 name='txtReschedule' value='';//Date to reschedule
   echo TD BGCOLOR=.$rowColor.DateRescheduled, $Date;//Date  
 stored in timeStamp
 //echo TD bgcolor=.$rowColor.A href='update.php?taskid=$row[0] 
 taskdate=$taskdate'Click here!/A;
   echo TD bgcolor=.$rowColor.CheckboxForWhenDone, input  
 type='checkbox' name='chkDone' value='$row[0]';//Check box for when  
 completed
 
 }

Oh man, blast from the past... BLAST FROM THE PAST!!! Where did you dig
up such ancient HTML? I'm taking a walk down nostalgia lane.
Unfortunately it's making me nauseous as I remember the original trip. I
guess you could call it naustalgia! :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Jason Pruim


On Jul 3, 2007, at 9:47 AM, Robert Cummings wrote:


On Tue, 2007-07-03 at 09:30 -0400, Jason Pruim wrote:

Hi Everyone!

Here is some of the code:

$result = mysql_query($sql);
echo form method='POST' action='update.php' name='ticklers';
echo table border='1' bgcolor=.$tableBody. ;
echo tr
THID #/TH
thTickler Name/th
thTickler Description/th
THCompleted/th
TH Day to complete/th
THReschedule Date/TH
/tr;

while($row = mysql_fetch_array($result)) {


echo TRTD bgcolor=.$rowColor.ID#, $row[0] /td;// ID #
echo td bgcolor=.$rowColor.TicklerName, $row[1]  /td;//
Tickler Name
echo td bgcolor=.$rowColor.Instructions, A href='$row
[2]'Instructions/A/td;// Instructions
echo td bgcolor=.$dowColor.DayOfWeekWord, $dowword /td;//
Day of week word
echo TD BGCOLOR=.$rowColor.DateToReschedule, input type='text'
name='txtReschedule' value='';//Date to reschedule
echo TD BGCOLOR=.$rowColor.DateRescheduled, $Date;//Date
stored in timeStamp
//  echo TD bgcolor=.$rowColor.A href='update.php?taskid=$row[0]
taskdate=$taskdate'Click here!/A;
echo TD bgcolor=.$rowColor.CheckboxForWhenDone, input
type='checkbox' name='chkDone' value='$row[0]';//Check box for when
completed

}


Oh man, blast from the past... BLAST FROM THE PAST!!! Where did you  
dig

up such ancient HTML? I'm taking a walk down nostalgia lane.
Unfortunately it's making me nauseous as I remember the original  
trip. I

guess you could call it naustalgia! :)


But what I'm displaying is tabular data on my internal network :) so  
I can use an old table for it. Once I get it working properly I'll  
probably change the table into div's... Haven't decided yet :)


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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 09:52 -0400, Jason Pruim wrote:
 On Jul 3, 2007, at 9:47 AM, Robert Cummings wrote:
 
  On Tue, 2007-07-03 at 09:30 -0400, Jason Pruim wrote:
  Hi Everyone!
 
  Here is some of the code:
 
  $result = mysql_query($sql);
  echo form method='POST' action='update.php' name='ticklers';
  echo table border='1' bgcolor=.$tableBody. ;
  echo tr
  THID #/TH
  thTickler Name/th
  thTickler Description/th
  THCompleted/th
  TH Day to complete/th
  THReschedule Date/TH
  /tr;
 
  while($row = mysql_fetch_array($result)) {
 
 
 echo TRTD bgcolor=.$rowColor.ID#, $row[0] /td;// ID #
 echo td bgcolor=.$rowColor.TicklerName, $row[1]  /td;//
  Tickler Name
 echo td bgcolor=.$rowColor.Instructions, A href='$row
  [2]'Instructions/A/td;// Instructions
 echo td bgcolor=.$dowColor.DayOfWeekWord, $dowword /td;//
  Day of week word
 echo TD BGCOLOR=.$rowColor.DateToReschedule, input type='text'
  name='txtReschedule' value='';//Date to reschedule
 echo TD BGCOLOR=.$rowColor.DateRescheduled, $Date;//Date
  stored in timeStamp
  // echo TD bgcolor=.$rowColor.A href='update.php?taskid=$row[0]
  taskdate=$taskdate'Click here!/A;
 echo TD bgcolor=.$rowColor.CheckboxForWhenDone, input
  type='checkbox' name='chkDone' value='$row[0]';//Check box for when
  completed
 
  }
 
  Oh man, blast from the past... BLAST FROM THE PAST!!! Where did you  
  dig
  up such ancient HTML? I'm taking a walk down nostalgia lane.
  Unfortunately it's making me nauseous as I remember the original  
  trip. I
  guess you could call it naustalgia! :)
 
 But what I'm displaying is tabular data on my internal network :) so  
 I can use an old table for it. Once I get it working properly I'll  
 probably change the table into div's... Haven't decided yet :)

Nothing wrong with tables... it's the mish-mash of lowercase/uppercase
tag/attribute names and the use of bgcolor instead of CSS :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Jason Pruim


On Jul 3, 2007, at 9:58 AM, Robert Cummings wrote:



Oh man, blast from the past... BLAST FROM THE PAST!!! Where did you
dig
up such ancient HTML? I'm taking a walk down nostalgia lane.
Unfortunately it's making me nauseous as I remember the original
trip. I
guess you could call it naustalgia! :)


But what I'm displaying is tabular data on my internal network :) so
I can use an old table for it. Once I get it working properly I'll
probably change the table into div's... Haven't decided yet :)


Nothing wrong with tables... it's the mish-mash of lowercase/uppercase
tag/attribute names and the use of bgcolor instead of CSS :)


I'll add the CSS once I can get the form to work properly, and can  
figure out how to change the color with css based on a certain value  
stored in a database IE: $rowColor :)


To the point of the email though, is it just as simple as typing  
textbox[] and I have an array from the text boxes? :)


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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Andrei

Jason Pruim wrote:

 On Jul 3, 2007, at 9:47 AM, Robert Cummings wrote:

 On Tue, 2007-07-03 at 09:30 -0400, Jason Pruim wrote:
 Hi Everyone!

 Here is some of the code:

 $result = mysql_query($sql);
 echo form method='POST' action='update.php' name='ticklers';
 echo table border='1' bgcolor=.$tableBody. ;
 echo tr
 THID #/TH
 thTickler Name/th
 thTickler Description/th
 THCompleted/th
 TH Day to complete/th
 THReschedule Date/TH
 /tr;

 while($row = mysql_fetch_array($result)) {


 echo TRTD bgcolor=.$rowColor.ID#, $row[0] /td;// ID #
 echo td bgcolor=.$rowColor.TicklerName, $row[1]  /td;//
 Tickler Name
 echo td bgcolor=.$rowColor.Instructions, A href='$row
 [2]'Instructions/A/td;// Instructions
 echo td bgcolor=.$dowColor.DayOfWeekWord, $dowword /td;//
 Day of week word
 echo TD BGCOLOR=.$rowColor.DateToReschedule, input
 type='text'
 name='txtReschedule' value='';//Date to reschedule
 echo TD BGCOLOR=.$rowColor.DateRescheduled, $Date;//Date
 stored in timeStamp
 //echo TD bgcolor=.$rowColor.A
 href='update.php?taskid=$row[0]
 taskdate=$taskdate'Click here!/A;
 echo TD bgcolor=.$rowColor.CheckboxForWhenDone, input
 type='checkbox' name='chkDone' value='$row[0]';//Check box for when
 completed

 }

 Oh man, blast from the past... BLAST FROM THE PAST!!! Where did you dig
 up such ancient HTML? I'm taking a walk down nostalgia lane.
 Unfortunately it's making me nauseous as I remember the original trip. I
 guess you could call it naustalgia! :)

 But what I'm displaying is tabular data on my internal network :) so I
 can use an old table for it. Once I get it working properly I'll
 probably change the table into div's... Haven't decided yet :)

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

Anyway you should get rid of echoing everything from php... It really
gets you mad when you want to change things...
Do it like:

while($row = mysql_fetch_array($result))
{
?
   TR
TD bgcolor=?=$rowColor?ID#, ?=$row[0]?/td
td bgcolor=?=$rowColor?TicklerName, ?=$row[1]?/td
etc...
   /tr
   ?
}
 

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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 10:06 -0400, Jason Pruim wrote:
 On Jul 3, 2007, at 9:58 AM, Robert Cummings wrote:
 
 
  Oh man, blast from the past... BLAST FROM THE PAST!!! Where did you
  dig
  up such ancient HTML? I'm taking a walk down nostalgia lane.
  Unfortunately it's making me nauseous as I remember the original
  trip. I
  guess you could call it naustalgia! :)
 
  But what I'm displaying is tabular data on my internal network :) so
  I can use an old table for it. Once I get it working properly I'll
  probably change the table into div's... Haven't decided yet :)
 
  Nothing wrong with tables... it's the mish-mash of lowercase/uppercase
  tag/attribute names and the use of bgcolor instead of CSS :)
 
 I'll add the CSS once I can get the form to work properly, and can  
 figure out how to change the color with css based on a certain value  
 stored in a database IE: $rowColor :)

At it's simplest:

'td class='.$rowColor.''

Though I would advise using a more descriptive name. Additionally some
advice... try to limit your global classes. Instea dof having:

td.someClass
{
background-color: #dd;
}

Try something more specific:

table.specialInformation td.someClass
{
background-color: #dd;
}


 To the point of the email though, is it just as simple as typing  
 textbox[] and I have an array from the text boxes? :)

Yes, but only if one or more checkboxes get checked. Unchecked
checkboxes are not sent to the server by the browser. So you need at
leas one to have an array, but you can just check for existence of your
incoming data before attempting to access array indexes.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Jim Lucas

Jason Pruim wrote:

Hi Everyone!

Okay, so for those of you who remember I have been going back and forth 
on how to write a reoccuring task manager program for my office, it's a 
little bit a labor of love, little bit wanting to expand my knowledge.


Anyway, I've hit a problem... I am attempting to add away to reschedule 
tasks based on a value entered in a text box (IE: 7/3/07) and then 
create a timestamp off of that so that I can have it show up on that date.


The problem comes in when I try and submit the values to the update 
form, as of right now, it only picks up the info in the bottom text box 
and updates it None of the others, no matter how many/few I have 
selected to update.


I think I need to put the text boxes into an array (And possibly the 
check boxes as well) but I have never done that before for text boxes.. 
Is it as easy as textbox[] to create an array of text boxes? Or is there 
something else that I'm missing?


Here is some of the code:

$result = mysql_query($sql);
echo form method='POST' action='update.php' name='ticklers';
echo table border='1' bgcolor=.$tableBody. ;
echo tr
THID #/TH
thTickler Name/th
thTickler Description/th
THCompleted/th
TH Day to complete/th
THReschedule Date/TH
/tr;

while($row = mysql_fetch_array($result)) {


echo TRTD bgcolor=.$rowColor.ID#, $row[0] /td;// ID #
echo td bgcolor=.$rowColor.TicklerName, $row[1]  /td;// 
Tickler Name
echo td bgcolor=.$rowColor.Instructions, A 
href='$row[2]'Instructions/A/td;// Instructions
echo td bgcolor=.$dowColor.DayOfWeekWord, $dowword /td;// 
Day of week word
echo TD BGCOLOR=.$rowColor.DateToReschedule, input type='text' 
name='txtReschedule' value='';//Date to reschedule
echo TD BGCOLOR=.$rowColor.DateRescheduled, $Date;//Date 
stored in timeStamp
//echo TD bgcolor=.$rowColor.A 
href='update.php?taskid=$row[0]taskdate=$taskdate'Click here!/A;
echo TD bgcolor=.$rowColor.CheckboxForWhenDone, input 
type='checkbox' name='chkDone' value='$row[0]';//Check box for when 
completed


}


First off, I would use the heredoc syntax for this chuck of code.

also if you are going to use the indexes of $row, then use mysql_fetch_row() 
instead of *_array()
Won't chew up as much resources.  I would recommend that you use *_assoc() instead, this way you can 
call to the column name and not have to rely on the DB layout never changing.


while($row = mysql_fetch_row($result)) {

echo HTML

tr
td class={$rowColor}ID#, {$row[0]} /td
td class={$rowColor}TicklerName, {$row[1]}  /td
td class={$rowColor}Instructions, a 
href='{$row[2]}'Instructions/a/td
td class={$dowColor}DayOfWeekWord, {$dowword} /td
td class={$rowColor}DateToReschedule,
input type='text' name='tasks[{$row[0]}][txtReschedule]' 
value=''/td
td class={$rowColor}DateRescheduled, {$Date}/td
td class={$rowColor}a
href='update.php?taskid={$row[0]}taskdate={$taskdate}'Click 
here!/a/td
td class={$rowColor}CheckboxForWhenDone,
input  type='checkbox' name='tasks[{$row[0]}][chkDone]' 
value='{$row[0]}'/td
/tr

HTML;

}




and the update form:



if ( isset($_POST['tasks'])  count($_POST['tasks'])  0 ) {
foreach ( $_POST['tasks'] AS $id = $attributes ) {
if ( isset($attributes['chkDone'])  $attributes['chkDone'] == 
$id ) {
$id = mysql_real_escape_string((int)$id);
$SQL = UPDATE tasks
SET completed='1',
timeStamp=NOW()  -- Assuming 
DATE/TIME/etc...
WHERE   id='{$id}';
mysql_query($SQL) or die(mysql_error());
}
}
}


$taskdate1= $_POST['txtReschedule'];
$taskDone = $_POST['chkDone'];
$taskTime=mktime($taskdate1);

//$sql=UPDATE tasks SET completed='1', timeStamp='$taskdate1' where 
id='$taskid' LIMIT 1;;
$sql=update tasks set completed='1', timeStamp='$taskTime' where 
id='$taskDone' LIMIT 1;;






mysql_query($sql) or die(mysql_error());


Any help with this would be greatly appreciated! :)

Jason Pruim

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




--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Jochem Maas
Robert Cummings wrote:

...

 I'll add the CSS once I can get the form to work properly, and can  
 figure out how to change the color with css based on a certain value  
 stored in a database IE: $rowColor :)
 
 At it's simplest:
 
 'td class='.$rowColor.''

...
if $rowColor is a hex based value using it as a CSS class is not really going 
to work
that well, in such cases I would opt to use inline css:

echo 'td style=background:', $rowColor, '';

 
 
 To the point of the email though, is it just as simple as typing  
 textbox[] and I have an array from the text boxes? :)
 
 Yes, but only if one or more checkboxes get checked. Unchecked
 checkboxes are not sent to the server by the browser. So you need at

where did the checkboxes come from? I'm sure he was only asking about textboxes.

BUT: Rob is correct, and if you have a number of fields in each row (of which 
some
might be checkboxes) you are better off adding explicit array indices to the 
field
element names so that you can explicitly match values for a give row accross 
multiple
arrays:

input type=text name=text[1]input type=checkbox name=chk[1] 
value=1
input type=text name=text[2]input type=checkbox name=chk[2] 
value=1

for ($i = 1; isset($_POST['text'][$i]); $i++) {
$text = cleanInput($_POST['text'][$i]);
$chk  = isset($_POST['chk'][$i]);  // checkboxes are not sent if they 
are not checked
}

 leas one to have an array, but you can just check for existence of your
 incoming data before attempting to access array indexes.
 
 Cheers,
 Rob.

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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 17:57 +0200, Jochem Maas wrote:
 Robert Cummings wrote:
 
 ...
 
  I'll add the CSS once I can get the form to work properly, and can  
  figure out how to change the color with css based on a certain value  
  stored in a database IE: $rowColor :)
  
  At it's simplest:
  
  'td class='.$rowColor.''
 
 ...
 if $rowColor is a hex based value using it as a CSS class is not really going 
 to work
 that well, in such cases I would opt to use inline css:
 
 echo 'td style=background:', $rowColor, '';

Inline CSS is as maintainable as bgcolor. if you're using inline styling
then you've missed the point.

  To the point of the email though, is it just as simple as typing  
  textbox[] and I have an array from the text boxes? :)
  
  Yes, but only if one or more checkboxes get checked. Unchecked
  checkboxes are not sent to the server by the browser. So you need at
 
 where did the checkboxes come from? I'm sure he was only asking about 
 textboxes.

I dunno :) Guess it was so similar to checkboxes and I most often use
array syntax in form fields when working with checkboxes that I got
confused :B

 BUT: Rob is correct, and if you have a number of fields in each row (of which 
 some
 might be checkboxes) you are better off adding explicit array indices to the 
 field
 element names so that you can explicitly match values for a give row accross 
 multiple
 arrays:
 
 input type=text name=text[1]input type=checkbox name=chk[1] 
 value=1
 input type=text name=text[2]input type=checkbox name=chk[2] 
 value=1
 
 for ($i = 1; isset($_POST['text'][$i]); $i++) {
   $text = cleanInput($_POST['text'][$i]);
   $chk  = isset($_POST['chk'][$i]);  // checkboxes are not sent if they 
 are not checked
 }
 
  leas one to have an array, but you can just check for existence of your
  incoming data before attempting to access array indexes.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Jochem Maas
Robert Cummings wrote:
 On Tue, 2007-07-03 at 17:57 +0200, Jochem Maas wrote:
 Robert Cummings wrote:

 ...

 I'll add the CSS once I can get the form to work properly, and can  
 figure out how to change the color with css based on a certain value  
 stored in a database IE: $rowColor :)
 At it's simplest:

 'td class='.$rowColor.''
 ...
 if $rowColor is a hex based value using it as a CSS class is not really 
 going to work
 that well, in such cases I would opt to use inline css:

 echo 'td style=background:', $rowColor, '';
 
 Inline CSS is as maintainable as bgcolor. if you're using inline styling
 then you've missed the point.

$rowColor is coming from a DB (that was my assuption based on the OP's story) - 
it's value is,
for example, '#ff' so it cannot be used as a CSS class .. the OP may not be 
in
a position to change the data in the DB. There may be a style/color choosing
interface in his app that makes things very maintainable (especially for the 
developer
because the user does the work).

missing the point is not all bad - especially when the point is on the end of a 
sword :-)

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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Jason Pruim


On Jul 3, 2007, at 12:46 PM, Jochem Maas wrote:


Robert Cummings wrote:

On Tue, 2007-07-03 at 17:57 +0200, Jochem Maas wrote:

Robert Cummings wrote:

...


I'll add the CSS once I can get the form to work properly, and can
figure out how to change the color with css based on a certain  
value

stored in a database IE: $rowColor :)

At it's simplest:

'td class='.$rowColor.''

...
if $rowColor is a hex based value using it as a CSS class is not  
really going to work

that well, in such cases I would opt to use inline css:

echo 'td style=background:', $rowColor, '';


Inline CSS is as maintainable as bgcolor. if you're using inline  
styling

then you've missed the point.


$rowColor is coming from a DB (that was my assuption based on the  
OP's story) - it's value is,
for example, '#ff' so it cannot be used as a CSS class .. the  
OP may not be in
a position to change the data in the DB. There may be a style/color  
choosing
interface in his app that makes things very maintainable  
(especially for the developer

because the user does the work).

missing the point is not all bad - especially when the point is on  
the end of a sword :-)





Allow me to clear up one thing :)

$rowColor does not come from a database,

if($row[5] =='Level1' or $row[5] =='level1'or $row[5] =='level 1'or  
$row[5] =='Level 1'){

// Yellow Highlight
$rowColor = $Level1;

Currently $Level1 is hardcoded into the php file and provides color  
information based on $row[5] which does come from the database :)


And I do have full control over the info in the database. It's a  
internal project to make us more of a paperless office.



Oh, And I do have a check box on the form, just 1 per row, use it to  
be able to check it when the project is done.


And for anyone that is interested: HTTP://www.raoset.com/tests/ 
ticklers/viewall.php -- That's the output of the form :) Please  
don't abuse it! :)


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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 13:18 -0400, Jason Pruim wrote:

 And for anyone that is interested: HTTP://www.raoset.com/tests/ 
 ticklers/viewall.php -- That's the output of the form :) Please  
 don't abuse it! :)

My eyes are bleeding... gh. 

:)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread Jason Pruim

I'm matching a color coding scheme that was already established :P

But the red on yellow is a little bright ;)


On Jul 3, 2007, at 2:08 PM, Robert Cummings wrote:


On Tue, 2007-07-03 at 13:18 -0400, Jason Pruim wrote:


And for anyone that is interested: HTTP://www.raoset.com/tests/
ticklers/viewall.php -- That's the output of the form :) Please
don't abuse it! :)


My eyes are bleeding... gh.

:)

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'




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



Re: [PHP] task Scheduler driving me crazy!

2007-07-03 Thread tedd

At 5:05 PM +0300 7/3/07, Andrei wrote:

Anyway you should get rid of echoing everything from php... It really
gets you mad when you want to change things...

while($row = mysql_fetch_array($result))
{
?
   TR
TD bgcolor=?=$rowColor?ID#, ?=$row[0]?/td
td bgcolor=?=$rowColor?TicklerName, ?=$row[1]?/td
etc...
   /tr
   ?
}


Andrei:

Well don't -- use css instead:

First, define a background-color in a css class, like so:

.myRow0
  {
  background-color: yellow;
  }

.myRow1
  {
  background-color: red;
  }

Then in your php, assign:

$rowColor = 'myRow0';  // actually this is column color and not row color

?
   TR
TD class=?=$rowColor?ID#, ?=$row[0]?/td
td class=?=$rowColor?TicklerName, ?=$row[1]?/td
etc...
   /tr
   ?php

Also, I wouldn't use short tags.

Plus, to alternate color *rows* in a table, just use:

tr class=myRow?php echo($i++  1 );?
  td whatever...

   /tr

See it work here:

http://www.webbytedd.com/b/color-rows/

It works better than anything I've read thus far.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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