Simple Php Help?!?

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

QBert

Established Member
Impact
10
i keep getting an error when i put <td width="50%" bgcolor="#F3F3F3"> in a print. the error message is "Parse error: parse error, unexpected T_LNUMBER in /home/bertie/public_html/mobster/test3.php on line 41"

anyone know whats causeing this???

also is there a nice big php forum around? have just started on big project and dont wanna clutter up this area with my dumb questions.

<?php

mysql_connect('localhost','bertie_username','wordpass');
mysql_select_db('bertie_mobster');
$result = mysql_query('SELECT * FROM employees ORDER BY id DESC');
while($employees = mysql_fetch_array($result)) {

print "<tr><td width="50%" bgcolor="#F3F3F3"><p align="justify"><font size="2"><b>" . $employees['date'] . "</b></font></td>";
print "id" . $employees['id'] . "";
print "msg" . $employees['msg'] . "";

}
?>
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
it is quite simply you are using double quotes within double quotes you can do either of 2 things your first option is to put a slash before the " in the print statement as follows:-

Code:
print "<tr><td width=\"50%\" bgcolor=\"#F3F3F3\"><p align=\"justify\"><font size=\"2\"><b>" . $employees['date'] . "</b></font></td>";

or you can change the double quotes to single quotes in the statement such as :-

Code:
print "<tr><td width='50%' bgcolor='#F3F3F3'><p align='justify'><font size='2'><b>"  . $employees['date'] . "</b></font></td>";

double quotes cant bwe used in the way you are doing it as php doesnt know where the quotes start and finish


also I notice on your other print lines you have ."" at the end of them, if no more output is coming on that line there is no need for the to have the double quotes and also in that case the last dot is not needed as it signifies more is to come for that statement so you should just have:-

Code:
print "id" . $employees['id'];
 
0
Close
thanks heaps. ive spent the last 3 houers trying to work that out. i new it was going to be somthing simple but just couldent put my finger on it.

100np$'s on there way :)
 
0
Close
glad to be of help mate and cheers for the $NP much apreciated.
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back