Reply to Re: Desperate help needed on tables in .php

Your name:

Reply:


Posted by David Haynes on 05/29/06 13:56

Ladysniper@gmail.com wrote:
> DESPERATE doesn't begin to describe it.
>
> Can someone PLEASE tell me what is WRONG with this code?
>
> Now..a bit of background. It is a search results page for
> http://www.azsoma.info/directory.htm. (use Scottsdale for the city)
>
> If you go look, you see that the search results post (I do have my
> table borders up for debugging) but it doesn't line up with the table
> above it...the whole scroll background doesn't show up and I cannot get
> my results to have a space between them. And on top of it...they want
> an inline frame! I haven't even attempted that...at all....
>
> Please...can someone help me. Hell, I'll pay someone if I have to...be
> glad to...but this page needs to be done for the client....
>
> Warning...long coding....
>
> Thank you in advance....please, if someone could/would help me....


Wow! a lot of things could be improved on this page.

1. Use a stylesheet.

2. Dump the boxed comments especially when they state the obvious. (i.e.
Now, if there are any records, we'll set through getting the xxx.)

3. Since the only difference in a bunch of these is the xxx value, make
it a function.

function showInTable($sub_fld_name) {
$sql = "select sub_fld_value "
."from pf_submissions "
."where sub_rec_id = '{$row['sub_rec_id']' "
."and sub_fld_name = '$sub_fld_name' ";

$result = mysql_query($sql);
while( $row = @mysql_fetch_row($result) {
?>
<tr height="20">
<td valign="top">
<p style="margin-left:150"> // stylesheets would be better here
<font size="2">
<?php echo $row[0];?>
</font>
</p>
</td>
</tr>
<?php
}
$mysql_free_result($result);
}

This reduces your inner loop to something like:
foreach( array('Full Name', 'Office Address', 'Office City', ...) as
$field_name ) {
showInTable($field_name);
}

4. Remove the silly 1=1 test use a boolean flag to know whether this is
the first entry (i.e. the where)

5. You don't close your <form>

6. Since both your outer table and inner table have width 800, I don't
understand what you want the outer table to do.

7. $variable1 is never set

8. The <br> at the end of each table row will not cause double spacing.
Either set double spacing up in the style sheet (preferred) or alter the
showInTable function to emit an empty row (<tr><td>&nbsp;</td></tr>)
after each populated row.

That's probably enough to get you started.

-david-

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация