If you want your output to validate xhtml, you had better make sure that
your html looks like:

<a href="link.php">Link</a>

and NOT:

<a href='link.php'>Link</a>



> -----Original Message-----
> From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 02, 2002 4:52 PM
> To: '[EMAIL PROTECTED]'
> Cc: '[EMAIL PROTECTED]'
> Subject: RE: [PHP-DB] need some help...
> 
> 
> Thank you. Someone else exists who has the sense of mind to use single
> quotes. I hate looking at other people's code that has tons 
> of \"s in it.
> 
> - Jonathan
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 02, 2002 5:00 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] need some help...
> 
> 
> Not really a database question, but why not...
> 
> Step 1:  Clean up the code...
>          a)  Convert all double-quote to single quotes in the 
> HTML portion.
>               I usually use doubles for PHP and singles for 
> HTML.  I hate 
>               having to escape quotes.
>          b)  Use of spacing and indentation.
> 
> old
> **********************************************
>       <div align="left">
>         <table border="0" cellpadding="0" cellspacing="0" width="95%">
>           <tr>
>             <td width="100%"><p>
>               <font face="Tahoma, Verdana, Arial, Helvetica" 
> size="1"><img
> src="/images/menu-reviews.gif" width="137" height="20"><br><br><?php
> $db = mysql_connect( "db",  "******",  "******");
> mysql_select_db( "net3dual_reviews",$db);
> $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC 
> LIMIT 7");
> $max = mysql_query("select max(num) from hwureviews",$db);
> while($a=mysql_fetch_array($r)) {
> printf ("&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"%s\"><img src=\"%s\"
> border=\"0\"></a><br>&nbsp;&nbsp;- <a
> href=\"%s\">%s</a><br><br>",$a["url"],$a["picurl"],$a["picurl"
> ],$a["title"])
> ;
> }
> ?>
>         </font></p>
>             </td>
>           </tr>
>         </table>
>       </div>
> **********************************************
> 
> 
> 
> new
> **********************************************
>       <div align='left'>
>         <table border='0' cellpadding='0' cellspacing='0' width='95%'>
>           <tr>
>             <td width='100%'><p>
>               <font face='Tahoma, Verdana, Arial, Helvetica' size='1'>
>               <img src='/images/menu-reviews.gif' width='137'
> height='20'><br><br>
> <?php
> $db = mysql_connect( "'db",  "******",  "******");
> mysql_select_db( "net3dual_reviews",$db);
> $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC 
> LIMIT 7");
> $max = mysql_query("select max(num) from hwureviews",$db);
> while($a=mysql_fetch_array($r))
> {
>   printf ("&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"%s\"><img src=\"%s\"
>               border='0'></a><br>&nbsp;&nbsp;- 
>               <a
> href='%s'>%s</a><br><br>",$a["url"],$a["picurl"],$a["picurl"],
> $a["title"]);
> }
> ?>
>         </font></p>
>             </td>
>           </tr>
>         </table>
>       </div>
> **********************************************
> 
> Since you have to put a string value, assign all output to a 
> single string
> called $output.
> Note that I moved your printf() to an echo, and simplified your output
> string by preassigning
> variables.  An extra step, but greatly enhances readability and
> maintenance...
> Also remember that the ".=" is an append operator whereas "=" 
> is assignment.
> 
> even newer
> **********************************************
>  // Assign the stuff before...
>  $output =
>     "
>       <div align='left'>
>         <table border='0' cellpadding='0' cellspacing='0' width='95%'>
>           <tr>
>             <td width='100%'><p>
>               <font face='Tahoma, Verdana, Arial, Helvetica' size='1'>
>               <img src='/images/menu-reviews.gif' width='137'
> height='20'><br><br>
>      ";
> <?php
> $db = mysql_connect( "'db",  "******",  "******");
> mysql_select_db( "net3dual_reviews",$db);
> $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC 
> LIMIT 7");
> $max = mysql_query("select max(num) from hwureviews",$db);
> while($a=mysql_fetch_array($r))
> {
>   $url = $a["url"];
>   $picurl = $a["picurl"];
>   $title = $a["title"];
> 
>   // add in each link to the review
>   $output .= "&nbsp;&nbsp;&nbsp;&nbsp;
>                   <a href='$url'>
>                      <img src='$picurl' border='0'>
>                   </a>
>                   <br>&nbsp;&nbsp;- 
>                   <a href='$picurl'>
>                       $title
>                   </a>
>                   <br><br>";
> }
> ?>
>   // finish the structure HTML
>   $output .= "
>         </font></p>
>             </td>
>           </tr>
>         </table>
>       </div>
>     ";
> 
> // Now fopen() the file, fputs the $output, and fclose() the file.
> **********************************************
> http://www.php.net/manual/en/function.fopen.php
> http://www.php.net/manual/en/function.fputs.php
> http://www.php.net/manual/en/function.fclose.php
> 
> Party on!
> 
> -Szii
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to