0

Hi again guys,

I am getting information from a table that I would dearly love to format using my css styles in an external css sheet. Now I am calling the sheet in the header correctly, tested that to make sure.

Here is the code I am using. This generates the text, but not formatted according to my css style sheet.

echo "<div align=\"left\">"; 
while($row=mysql_fetch_array($result))
{ 
echo "<p class=\"index_page_big\">";
echo $row['manufacturer']." ".$row['make']." ".$row['model']." ".$row['variant'];
echo "</p>";
}
mysql_close($connect);
?>
</div>

What I would ideally like to do, is have lines 4,5,6 all one one line. But can just as well live with the three lines if just for the sake of readability! Nice to have short precise code, but then also good to be able to read what has been done easily!

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by CarterLangley
0

Dont knowe if this helps, but i usually write my html within php with ' rather than ".
example,

echo "<li style='color:red;'>hello world</li>";

another little thing i do is use arrays to get my records, can sometimes keep coding efforts down. example,

echo "<div align='left'>";
while($row=mysql_fetch_array($result))
{
$columns = array("manufacturer", "make", "model", "variant");
foreach($columns as $cname){$$cname = $row[$cname];}
echo "<p class='index_page_big'>$manufacturer $make $model $variant</p>";
}
mysql_close($connect);
0

Thanks gotboots

Done and dusted now. Like your idea of

$columns = array("manufacturer", "make", "model", "variant");
foreach($columns as $cname){$$cname = $row[$cname];}

Makes life just that little bit easier.

Carter

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.