Dhaval, did you try the code I sent you?
Marco On Sat, 2002-11-09 at 23:59, Dhaval Desai wrote: > Hi! > > > Well let's make it simple.. We can see that the following values: > > 2222211111111111111999999992222 > are stored in just one row in 31 different columns. > > Bsaed on this if we were to make a table with colspans how would it go..? > > > Thank you > > Dhaval > > > > > > > > > > >From: Marco Tabini <[EMAIL PROTECTED]> > >To: Dhaval Desai <[EMAIL PROTECTED]> > >CC: [EMAIL PROTECTED] > >Subject: Re: [PHP] Automatic Colspan from database data > >Date: 09 Nov 2002 15:10:39 -0500 > > > >Ouch... > > > > > >well, assuming you have two columns: day_id and value, here's a possible > >solution: > > > >$rs = mysql_query ('select day_id, value from my_table order by > >day_id'); > >$a = mysql_fetch_assoc ($rs); > > > >do > >{ > > $i = 1; > > $control = $a['value']; > > > > while (($a = mysql_fetch_assoc ($rs)) && $a['value'] == $control) > > $i++; > > > > echo '<td colspan=' . $i . '>' . $control . '</td>'; > >} while ($a); > > > >This is a bit rough and can probably be optimized quite a bit, plus I > >can't test it, so I'm not sure that it will work the first time. > >Hopefully, it gives you an idea of how it could be done. > > > >If I could make a suggestion without knowing how your system works, I > >think you should revisit your database design a little. > > > >Hope this helps, > > > > > >Marco > > > >-- > >------------ > >php|architect - The magazine for PHP Professionals > >The first monthly worldwide magazine dedicated to PHP programmers > >Check us out on the web at http://www.phparch.com > > > >On Sat, 2002-11-09 at 14:32, Dhaval Desai wrote: > > > Hi! > > > > > > Well I have 12 table for 2 years which makes it 24 tables named as: > > > jan_2002, feb_2002 ...etc dec_2002 > > > jan_2003, feb_2003 ...etc dec_2003 > > > > > > Each table has fields according to the number of days in the month plus > >1 > > > field as a unique key. > > > > > > Each registration will create 1 entry in 24 tables each and it can only > >be > > > modified as 1 entry per registrant per table. > > > the fields in each table will take values ranging rom 1-20. > > > > > > Well that's all about how my tables are in the database. > > > > > > > > > Thank You for your time > > > > > > Dhaval Desai > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >From: Marco Tabini <[EMAIL PROTECTED]> > > > >To: Dhaval Desai <[EMAIL PROTECTED]> > > > >CC: [EMAIL PROTECTED] > > > >Subject: Re: [PHP] Automatic Colspan from database data > > > >Date: 09 Nov 2002 13:34:20 -0500 > > > > > > > >How is your database organized? you might be able to pull this > > > >information from the query by using an appropriate group-by clause. > > > > > > > > > > > >Marco > > > >-- > > > >------------ > > > >php|architect - The magazine for PHP Professionals > > > >The first monthly worldwide magazine dedicated to PHP programmers > > > >Check us out on the web at http://www.phparch.com > > > > > > > >On Sat, 2002-11-09 at 11:57, Dhaval Desai wrote: > > > > > > > > > > > > > > > > > > > > > > > > > Hi everybody! > > > > > > > > > > > > > > > Well this is how it goes... > > > > > > > > > > For the month of January there are 31 days... > > > > > so there are 2 rows in this table on the top row there are 31 > >columns > > > > > showing 31 days...and in the row below this one we will have to > > > > > generate....colspan based on the below information pulled from the > > > > > database... > > > > > > > > > > 2222211111111111111999999992222 > > > > > > > > > > > > > > > in the above case we will have to get a colspan as follows: > > > > > <tr> > > > > > <td colspan="5"> 2 </td> > > > > > <td colspan="15"> 1 </td> > > > > > <td colspan="8"> 9 </td> > > > > > <td>colspan="4"> 2 </td> > > > > > </tr> > > > > > > > > > > > > > > > This is all I want to do....I know it is difficult...but still > >waiting > > > >for > > > > > some genius! > > > > > > > > > > > > > > > Thank You! > > > > > Dhaval > > > > > > > > > > > > > > > _________________________________________________________________ > > > > > Add photos to your messages with MSN 8. Get 2 months FREE*. > > > > > http://join.msn.com/?page=features/featuredemail > > > > > > > > > > > > > > > -- > > > > > PHP General Mailing List (http://www.php.net/) > > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > _________________________________________________________________ > > > STOP MORE SPAM with the new MSN 8 and get 2 months FREE* > > > http://join.msn.com/?page=features/junkmail > > > > > > > > > -- > > > 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 > > > _________________________________________________________________ > The new MSN 8: advanced junk mail protection and 2 months FREE* > http://join.msn.com/?page=features/junkmail > > > -- > 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