Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

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

Posts: 121
Trades: 0
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
 
 
Register now for full access!
Old 04-19-2004, 07:33 PM
wipeout's Avatar
Skilled Talker

Posts: 90
Location: Canada
Trades: 0
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
 
Old 04-19-2004, 07:40 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
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>
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 04-20-2004, 08:08 AM
Super Talker

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

Posts: 23
Location: UK
Trades: 0
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, 02:56 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
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"
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Huge Problem!!!! I Think?!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.23089 seconds with 12 queries