Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,205,628 members, 7,993,128 topics. Date: Monday, 04 November 2024 at 07:18 AM |
Nairaland Forum / Science/Technology / Webmasters / Help! It's Php! (624 Views)
Help! It's Urgent / What Is The Web Technology Behind Nairaland? Is It Php, Java, .net Or What (2) (3) (4)
Help! It's Php! by jeshurun07: 2:20pm On Dec 02, 2009 |
hello nairalanders, i am working on a php/mysql project and right now i am stuck and need help fast. what i want to do is echo out a row with 2n cells what i mean is: row1 wld have 2 cells row 2 wld have 4 rows row 3 wld have 8 rows etc. You get? my php codes are : <?php echo "table border=1>"; require_once "connector.inc" - # for the connector strings require_once "tree.inc" - # for the mysql commands which is just a normal MySQL SELECT query if($result=mysql_query($sql)){ while($row=mysql_fetch_assoc($result)){ $count=1; - # to initiate the count for the number of cells i want echo "<tr>"; $ab =pow(2,$count); - #to limit the number of cells per row $i=1; do{ echo "<td>"; echo $i; $studentname=current($row); echo $studentname; echo "</td>"; } i++; echo "</tr>"; } } } echo "</table>"; I have tried to find out what i am doing wrong but i don;t seem to get it. I wld love to use OOP but right now, i am still studying it. Thanks alot for ur help |
Re: Help! It's Php! by inf8nity(m): 2:36pm On Dec 02, 2009 |
Why don't you also paste the respective source codes of "connector.inc" and "tree.inc" that we can follow everything step by step. |
Re: Help! It's Php! by yawatide(f): 4:09pm On Dec 02, 2009 |
I see 2 issues with your problem: 1) First problem could be solved if you viewed source, copied and pasted the source table, and pasted it here for us to see what you are getting. 2) Looking at your code, I don't see any "colspan" which will ensure that the table layout looks good, regardless of number of cells. 2a) First thing that needs to be done, IMHO, is to draw out the table first, as though you were doing just html:
2b) Then you can start devising logic to accomplish this aim 2c) You will need another variable, counting down (4, 2, etc), that will dynamically populate in the "colspan" Out of curiosity, why must the number of cells be raised by a power of 2? Seems like it is making the whole thing more complex than it should be. good luck! |
Re: Help! It's Php! by jeshurun07: 9:57pm On Dec 02, 2009 |
@yawa-ti-de, thanks but i don't tink that mite fit into what i have in mind. my intention is to dynamically generate a multi level pyramid just like that of regular mlm boards. do u have any other suggestions that mite be of help? |
Re: Help! It's Php! by yawatide(f): 10:23pm On Dec 02, 2009 |
I guess it depends on what an mlm board is |
Re: Help! It's Php! by xanadu: 4:41am On Dec 03, 2009 |
Well, @jeshurun07 - I posted what I believe is a possible solution to the issue you raised, but it appears it has been deleted/blocked (whatever) for some reason. Too bad. |
Re: Help! It's Php! by xanadu: 5:02am On Dec 03, 2009 |
@jeshurun07 - I have sent a sent solution to you via email. |
Re: Help! It's Php! by jeshurun07: 11:03am On Dec 03, 2009 |
thx xanadu, i saw ur mail. worked but i have to finetune it a bit to suit wot i want thx alot anyway. |
Re: Help! It's Php! by yawatide(f): 12:06pm On Dec 03, 2009 |
xanadu: As moderator I can see your solution and have forwarded your post to seun to "un spam" it. Sorry for any inconveniences. jeshurun: based on what he sent you via email, isn't it the same thing I said above? oh, I see, it is because unlike xanadu, I didn't write actual php right? Sometimes, you have to start with pseudocode, understand that, then proceed with actual code |
Re: Help! It's Php! by xanadu: 4:33pm On Dec 03, 2009 |
Thanks, @Yawa. Well @Jesurun07 I'm glad that worked for you. Of course, I did not expect you to use the code 'as is' - you will always NEED to fine-tune it to suit your needs! |
Re: Help! It's Php! by Nobody: 5:37pm On Dec 03, 2009 |
it is really painful when you take your time to make a world class composition only to post it and see it only in your recent posts. maybe seun show remove his custom antispam script since from my view, isn't really working. well, it's working just that it's doing exactly what it's not supposed to do. |
Re: Help! It's Php! by MyHonour(m): 6:55pm On Jan 04, 2010 |
Seun will never ever never ever sack the hardworking spam bot. |
(1) (Reply)
Great Forum Here / What Do You Think Of The Ipad? / Does Anyone Know Of A Website Who Helps With Legal Problems_
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 17 |