> Hi Paul, > > Here is a way you can make things easier to read. Use indenting (plus > make variable names shorter). > > <?php > > // here is sample code but i would use my own db functions instead of > these > $sql = "SELECT * FROM wherever"; > $result = @mysql_query($sql,$conn) or die ("Error in query: ".$sql); > > while ($row = mysql_fetch_assoc($result)){ > extract($row); // make vars from items in array > > if ($linksLink){ > echo $linksName; > } else { > echo "<a href=\"$linksLink\">$linksName</a>"; > } > } > > Adam > > ?> > > > ok this worked, but man does it ever look clunky.. > > i want to thank every one who respond to me on & off list.. > > if you have other ways you would write the same snippet, please post > > it. > > would help me to get a feel for cleaner php. > > > > <?php > > if ($row_rsViewLinks['linksLink'] == NULL) > > echo $row_rsViewLinks['linksName']; > > else > > echo "<a > > href=\"{$row_rsViewLinks['linksLink']}\">{$row_rsViewLinks['linksName'] > > }</a> > > " > > ?> > > > > > > sure oi will have some orderby / groupby questions in a few hours. > > thanks! > > -paul > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Hi, what about this: <?PHP $strHref = $row_rsViewLinks['linkLink']; $strLinkName = $row_rsViewLinks['linksName']; $strCode = $strHref != NULL ? "< a href=\"".$strHref."\">".$strLinkName."</a>\n" : $strLinkName; echo $strCode; ?> If you want to reduce the php code within html code you might want to implement that as a function on top of your php script or in a separate script called e.g. myfuncs.php which you can then include in every page where you need it like function getLink($row) { $strHref = $row['linkLink']; $strLinkName = $row['linksName']; $strCode = $strHref != NULL ? "< a href=\"".$strHref."\">".$strLinkName."</a>\n" : $strLinkName; return $strCode; } Then just call the function where you need: echo getLink($row_rsViewLinks); Sorry, I can't test this all now but it should work :) Thomas =============================================== Thomas Sinka mobil: +49 163 3 23 12 72 mailto: thomas.sinka@it-choice.de IT-Choice Software AG Kaiserstraße 160-162, 76133 Karlsruhe, Germany Tel.: +49(0)721-85 006-0, Fax: +49(0)721-85 006-77 www.it-choice.de, info@it-choice.de Amtsgericht Karlsruhe, HRB 9060 USt-Id Nr.: DE 812 950 635 Vorstand: Mirko Ketterer (Vorsitzender), Stephanie Lehmann, Dirk Ludwig Aufsichtsratsvorsitzender: Horst Gann -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php