Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,194,808 members, 7,956,068 topics. Date: Sunday, 22 September 2024 at 11:41 PM

Help! It's Php! - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Help! It's Php! (620 Views)

Help! It's Urgent / What Is The Web Technology Behind Nairaland? Is It Php, Java, .net Or What (2) (3) (4)

(1) (Reply) (Go Down)

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:


<table>
<tr>
<td colspan="4">bla</td><td colspan="4">bla</td>
</tr>
<tr>
<td colspan="2">bla</td><td colspan="2">bla</td><td colspan="2">bla</td><td colspan="2">bla</td>
</tr>
<tr>
<td>bla</td><td>bla</td><td>bla</td><td>bla</td>
<td>bla</td><td>bla</td><td>bla</td><td>bla</td>
</tr>
</table>

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 tongue
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 cool
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)

Please Review This Site And Give A Rating Out Of 10 / View The Picture Of My Adsense Account / Take A Look (website)

(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. 19
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.