Go Back   Dreamweaver Club Forums > Hand Coders Forum > General
Register FAQ Members List Search Today's Posts Mark Forums Read

Thread Tools Display Modes
Old 09-15-2007, 08:11 PM   #1
Join Date: Sep 2007
Posts: 64
Default Help Convert to a function


I am trying to learn functions and if someone could convert this to a function I could learn off of this, then I could learn how to convert my other code to functions.

PHP Code:
do {
'<div class="boxtop"><h4 style="margin: 0px; font-size: 10px;">';
'<div class="boxbottom"><br /><b>';
$lang_id$row['news_id'].'<br />';
$lang_author$row['news_author'].'<br />';
$lang_date$row['news_date'].'</b><br /><br />';
    } while (
$row mysql_fetch_array($result));
That is what I have displaying my news. I don't know anything about functions yet, so if you do choose to help, could you please comment the code so I can learn and see what you are doing.

Thank you soooooo much!
owner is offline   Reply With Quote
Old 09-15-2007, 08:38 PM   #2
davidj's Avatar
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256

this doesnt lend its self to a function really. You could do it but will be more complicated when debugging

stick it in an include and bobs your uncle

also you have mixed print and echos....?

its better to do it like this..

PHP Code:
<?php do { ?>
    <div class="boxtop"><h4>;
    <?php echo $row['news_title']; ?>
    <div class="boxbottom"><br />;
    <?php echo $lang_id ","$row['news_id']; ?><br />;
    <?php echo $lang_author ","$row['news_author']; ?><br />;
    <?php echo $lang_date","$row['news_date']; ?><br />;
    <?php echo $row['news_body'?></div>;
   <?php } while ($row mysql_fetch_array($result)); ?>
also remember to style your code using CSS
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 08:01 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com