Re: [PHP] html table

2001-01-25 Thread Rasmus Lerdorf

> How do I get every other column to be a different color (or font ect.)when
> I'm populating a table from a db(different field counts all the time)

If $i is a counter then $i%2 will alternate between 0 and 1

$i%3 would cycles through 0,1 and 2

-Rasmus


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] html table

2001-01-25 Thread Brian V Bonini

$color = "tan";
FOR ($i=0 ; $i < $numrows ; $i++) {
if ( ($i % 2) == 0 ) {
  ECHO ("\n");
} else {
  ECHO ("\n");
}
}

> -Original Message-
> From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 25, 2001 4:19 PM
> To: Mike
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] html table
> 
> 
> > How do I get every other column to be a different color (or 
> font ect.)when
> > I'm populating a table from a db(different field counts all the time)
> 
> If $i is a counter then $i%2 will alternate between 0 and 1
> 
> $i%3 would cycles through 0,1 and 2
> 
> -Rasmus
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] html table

2001-01-25 Thread Randy

I use a slightly different technique...

Defined in database or global file:
  $tblbgcolor1="FF";
  $tblbgcolor2="CC";

Program Loop to create the table:

$altcolor=$tblbgcolor2;
while ($row = mysql_fetch_array($Query)) {
if ($altcolor==$tblbgcolor2)
$altcolor=$tblbgcolor1;
else
$altcolor=$tblbgcolor2;
echo "Text to
display on Row";
}

(this loops through rows fetched from a mysql table, but can be
any kind of loop)

Best regards,
 Randy   


Thursday, January 25, 2001, 3:57:47 PM, you wrote:

BVB> $color = "tan";
BVB> FOR ($i=0 ; $i < $numrows ; $i++) {
BVB> if ( ($i % 2) == 0 ) {
BVB>   ECHO ("\n");
BVB> } else {
BVB>   ECHO ("\n");
BVB> }
BVB> }

>> -Original Message-
>> From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, January 25, 2001 4:19 PM
>> To: Mike
>> Cc: [EMAIL PROTECTED]
>> Subject: Re: [PHP] html table
>> 
>> 
>> > How do I get every other column to be a different color (or 
>> font ect.)when
>> > I'm populating a table from a db(different field counts all the time)
>> 
>> If $i is a counter then $i%2 will alternate between 0 and 1
>> 
>> $i%3 would cycles through 0,1 and 2
>> 
>> -Rasmus
>> 
>> 
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>> 
>> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] HTML table to MySQL?

2001-04-08 Thread Lindsay Adams

If you are sucking the scores off someones website, so you can put them into
a database (you should first get permission from site owner ;) )

But the process would be as follows in pseudo code (can't be done with just
SQL commands, btw.)

Get page
Find beginning and end of table, strip off everything before and after.
Find each row
within each row find each set of  tags and put information
between into a variable or reference

Repeat for each row, storing your column data into an array or something.

When done,
Loop through result array and build SQL INSERT string
Execute SQL statement

That's the code.
It is going to require heavy use of regualr expressions and backreferences
inside those expressions.

Now, you just have to choose a programming language with powerful regex
capability (see Perl or PHP, PHP easier to learn for novice probably)

On 4/8/01 4:30 PM, "Scott VanCaster" <[EMAIL PROTECTED]> wrote:

> How would one go about getting each element from an HTML table to a
> database?  The HTML will be the source code from a games site score report
> pasted into a form.  I'm just learning, so don't waste you're valuable time
> explaining every detail of how this can be done, but if someone can point me
> in the right direction or a web site detailing something similar it would be
> appreciated.  I can come back here with more specific questions once I've
> learned enough to know what to ask and understand the answers :)
> 
> Thanks.
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] HTML table problem (solvable with PHP?)

2001-07-26 Thread Dave Freeman

On 26 Jul 01, at 11:41, Seb Frost wrote:

> Now my problem is this.  Depending on the amount of content in the main
> cell, the "fixed" size cells on the left expand.  This is SO annoying!  I
> managed to fix it by setting the height of the bottom left hand "filler"
> cell to be like 10,000 pixels but that's hardly right and means my copyright
> info and stuff at the page bottom is miles out of sight.

Nest your tables.  Basically, you create a 'wrapper' table with two 
columns set to the width that you want for your navigation and content.  
Then, inside the cells for each of the two columns you create another 
table to hold your actual navigation and content.

CYA, Dave


---
Outback Queensland Internet - Longreach, Outback Queensland - Australia
http://www.outbackqld.net.au  mailto:[EMAIL PROTECTED]
---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] HTML table to MySQL table conversion

2001-09-27 Thread Maxim Maletsky \(PHPBeginner.com\)

Uff..  Don't envy you...

Anyway, if someone (hopefully) was cuting&pasting the cells in you could
do a combination of fopen/explode/regex to split the data into
coma-separated values. For example, stripping out every HTML tag
replacing it with a coma and a space will create you a dump file.

Also, you could try using MS Excel or Access, if mr. Magic Microsoft
Excel allows you to import data from an HTML table you could then export
it from there as comma separated values and prepare yourself a dump file
this way.

There are ways, man. But be careful not to take more efforts for PHP
solution that what it would be getting an intern guy/girl pasting the
staff :-)


Maxim Maletsky
www.PHPBeginner.com


-Original Message-
From: RNie [mailto:[EMAIL PROTECTED]] 
Sent: giovedì 27 settembre 2001 12.53
To: [EMAIL PROTECTED]
Subject: [PHP] HTML table to MySQL table conversion


Hello there,

Anyone has done this before? Would like to see some sample code to build
a converter from HTML table to a MySql table. Someone put an enourmous
amount of data in HTML tables and now we would like to put it in MySQL
database. We would not like to do this manually.

Thank you!



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] HTML table to MySQL table conversion

2001-09-27 Thread RNie

Well I don't have Access, nor Excel, but there is the Freeware Staroffice
that did it for me. Thank's for the tip. I thought of this myself, but your
message encouraged me to try it and it works.

Method I used:
- Open HTML with Staroffice
- Delete irregular header fields
- Select the whole table and  copy it
- Open a new spreadsheet
- Paste the table in the spreadsheet
- Save it as a comma delimited file.
- Create a table with for instance phpMyAdmin according to the data in the
HTML table
- import it into this new table with phpMyAdmin's utility called "Insert
textfiles into table" You have to take care here that you put the same field
delimiter as is used in your file.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]