Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

87 users online



Retarded Code

Retarded Code

Currently viewing this thread: 1 (0 members and 1 guests)


Page 2 out of 3
tbi

tbi

Status: Offline!

better way ...

PHP:

<?php

print '<tr>
    <td>
      <div align="center"><font face="Verdana" size="1">' 
.$name. </font></div>
    </
td
..................

?>

___________________

sillerdesign|de

Last edited by tbi, August 25th, 2003 03:50 PM (Edited 1 times)

Phil

Phil

with Mr. Jones
Status: Offline!

tbi's is faster.

if your using echo use , not .

___________________

http://www.philbrodeur.com - Expert PHP Development and Tutorials

Jeremie

Jeremie

Neversidian
Status: Offline!

designz: <font face'Verdana'> isnt good html, <font face="Verdana"> is

learn how to code html :/
http://www.w3schools.com

and when outputting a long string of html, its faster to exit php (?>), output the code (with <?php echo $var;?> to echo the vars) and then reenter php (<?php)

___________________

Jeremie - Used to be the Director of Community Development

Adam

Adam

Status: Offline!

or if you have short tags avaiable <?=$Var?>

___________________


Current Project: LivermoreMuscle.com
Sig Hosted by Motorspin

Jeremie

Jeremie

Neversidian
Status: Offline!

i never use short tags Tongue

only <?php should exists !

___________________

Jeremie - Used to be the Director of Community Development

Adam

Adam

Status: Offline!

tag teamed =colgate

___________________


Current Project: LivermoreMuscle.com
Sig Hosted by Motorspin

Designz

Designz

Graphics and web designer
Status: Offline!
Quote:

Originally posted by EvilGenius
designz: <font face'Verdana'> isnt good html, <font face="Verdana"> is

learn how to code html :/
http://www.w3schools.com

and when outputting a long string of html, its faster to exit php (?>), output the code (with <?php echo $var;?> to echo the vars) and then reenter php (<?php)

lol, I know how to code html, I was on about doing it inside PHP tags rather than out side I find it a lot easier to put

PHP:


<?php

echo "<font face='verdana'>This works fine</font><hr color='#ff7f00' size='1'>";

?>

Instead of using the following..

PHP:


<?php

echo "<font face=\"verdana\">Or what ever!</font><hr color=\"#ff7f00\" size=\"1\">";

?>

I find the last one hard to remember most times lol .. so i use ' easier and outputs same results.. Many attempts at my scripts with html inside of php use the ' instead of \"

Some ppl find one way good and others different ..

If the output is the same, who cares.. lol

Phil

___________________

--PowerDesignz--

FreeLance WebDeveloper
--Back from the Dead--

Jeremie

Jeremie

Neversidian
Status: Offline!

why dont you just do
[php]<?php
echo '<font face="verdana">Or what ever!</font><hr color="#ff7f00" size="1">';
?> [php]

use single quotes for php strings and double quotes for html attributes.. only double quotes are valid in html, even if somes browsers treats single ones as double ones, its not EVERY browsers that do so

___________________

Jeremie - Used to be the Director of Community Development

koko775

koko775

Neverside Newbie
Status: Offline!

Re: Retarded Code

PHP:

<?php

mysql_connect
("localhost","soaxorg_funkydwa","pwd"); 
mysql_select_db("soaxorg_articles"); 
$result mysql_query("select * from `thingo`"); 
while(
$r=mysql_fetch_array($result)) 
{     
  
    
$name=$r["name"]; 
    
$email=$r["email"]; 
    
$id=$r["id"]; 
    
$realname=$r["firstname"]; 
        
$site=$r["site"]; 
          
$icq=$r["icq"]; 
    
$aim=$r["aim"]; 
    
$msn=$r["msn"]; 
    
$location=$r["location"]; 
    
$interests=$r["interests"]; 
        
$sig=$r["sig"]; 

$printthis = <<<end_of_string
<tr> 
    <td> 
      <div align="center"><font face="Verdana" size=1>$name</font></div>
    </td>
    <td> 
      <div align="center"><font face="Verdana" size=1> $email
        </font></div>
    </td>
    <td>
      <div align="center"><font face="Verdana"size=1>$site</font></div>
    </td>
    <td> 
      <div align="center"><font face="Verdana" size=1>$date</font></div>
    </td>
    <td> 
      <div align="center"><font face="Verdana" size=1>$forumposts</font></div>
    </td>
    <td> 
      <div align="center"><font face="Verdana" size=1>$num_rowsg</font></div>
    </td>
  </tr>
end_of_string;
echo 
$printthis
 
}

  
echo 
'</table>';
?>

this is the easiest way to do it -- no worries about escaping or anything. variables are parsed, " is usable without escapes, as are '

Grin

CDude

CDude

nothing
Status: Offline!

why did you put the content into a variable before immediately printing it?

___________________

http://celerondude.com

Page 2 out of 3
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0106 seconds.