Reply
Huge Problem!!!! I Think?!
Old 04-19-2004, 03:44 PM Huge Problem!!!! I Think?!
Super Talker

Posts: 121
Sorry to paste such a huge bit of coide but i get this error:

Parse error: parse error in /home/nanothre/public_html/guestbook/index.php on line 170

when i try and view the page

here is my code

PHP Code:
<?

//set variables
$db_host "localhost";
$db_username "nanothre_liam";
$db_password "******";
$db_name "nanothre_guestbook";

//connect to database
if ($submit) {
mysql_connect($db_host,$db_username,$db_password) or die(mysql_error());
mysql_select_db($db_name) or die(mysql_error());

//run query to retrieve data from database for posts
$query "SELECT name, email, message, date, FROM guestbook order by id DESC LIMIT 10";
$result mysql_query($query);

//set table properties
echo "<br><table align='center' width='85%' border='1' bordercolor='#333333'>";

//loop to add entries of database
while($r=mysql_fetch_array($result))
{

echo 
"<tr>";
echo 
"<td bordercolor='#CCCCCC'>$r[message]</td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td bordercolor='#CCCCCC'>Posted By:
<a href='mailto:$r[email]'>$r[name]</a> $r[date]</td>"
;
echo 
"</tr>";
}
echo 
"</table>";
?>

</p>
</td>
</tr>
</table>
</div>
</body>
</html>                  <<<<<<<<<<<Line 170
Thanks!
vegancoder is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 04-19-2004, 06:33 PM
wipeout's Avatar
Skilled Talker

Posts: 90
Location: Canada
Ok try removing the HTML.... becuase its php anyway....
HTML is not a needed declaration.
__________________
PHP Code:
<?
  $User 
'wipeout'
  
$Class 'zombie'

  
phpGroupy('$User, da ,$Class')
?>
wipeout is offline
Reply With Quote
View Public Profile Visit wipeout's homepage!
 
Old 04-19-2004, 06:40 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Encoding Numbers as Base 36
Posts: 3,108
Location: Toronto, Ontario
You missed a } for the if.

PHP Code:
<?

//set variables
$db_host "localhost";
$db_username "nanothre_liam";
$db_password "******";
$db_name "nanothre_guestbook";

//connect to database
if($submit)
{
    
mysql_connect($db_host,$db_username,$db_password) or die(mysql_error());
    
mysql_select_db($db_name) or die(mysql_error());

    
//run query to retrieve data from database for posts
    
$query "SELECT name, email, message, date, FROM guestbook order by id DESC LIMIT 10";
    
$result mysql_query($query);

    
//set table properties
    
echo "<br><table align='center' width='85%' border='1' bordercolor='#333333'>";

    
//loop to add entries of database
    
while($r=mysql_fetch_array($result))
    {
        echo 
"<tr>";
        echo 
"<td bordercolor='#CCCCCC'>$r[message]</td>";
        echo 
"</tr>";
        echo 
"<tr>";
        echo 
"<td bordercolor='#CCCCCC'>Posted By:
        <a href='mailto:$r[email]'>$r[name]</a> $r[date]</td>"
;
        echo 
"</tr>";
    }
    echo 
"</table>";
}   
// <<<<<<<<
?>

</p>
</td>
</tr>
</table>
</div>
</body>
</html>
__________________
Devlog - Latest PHP Article: MVC with the Zend Framework
::The New Tech - Technology Forum
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Old 04-20-2004, 07:08 AM
Super Talker

Posts: 121
thank you, simple mistake messed it all up
vegancoder is offline
Reply With Quote
View Public Profile
 
Old 04-21-2004, 12:52 PM
j0e
Average Talker

Posts: 23
Location: UK
Did that fix it?

I have always had problems when doing something like:
PHP Code:
echo "some text $array['value'] and some more text"
Shouldn't it be:
PHP Code:
echo "some text ".$array['value']." and some more text"
...?
j0e is offline
Reply With Quote
View Public Profile
 
Old 04-21-2004, 01:56 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Encoding Numbers as Base 36
Posts: 3,108
Location: Toronto, Ontario
No, shold work like that. Problems come when you're trying to access a multi-dimension array, I think. Ex:

PHP Code:
echo "blah $array['key']['key'] blah";
// should be
echo "blah {$array['key']['key']} blah";
// or
echo "blah " $array['key']['key'] . " blah"
__________________
Devlog - Latest PHP Article: MVC with the Zend Framework
::The New Tech - Technology Forum
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Reply     « Reply to Huge Problem!!!! I Think?!
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14168 seconds with 13 queries