Php T_STRING problem

software development

#1

I am trying to do this tutorial: http://www.webmonkey.com/webmonkey/03/40/index0a.html?tw=programming

It is a simple tutorial on creating a blog using flash and mysql. I created a simple php file as per the instructions. Here it is:

<?php mysql_pconnect ("yourHost", "yourUserName", "yourPassword"); mysql_select_db ("blog_db"); $qResult = mysql_query ("SELECT * FROM blog_entries ORDER BY id DESC"); $nRows = mysql_num_rows($qResult); $rString ="&n=".$nRows; for ($i=0; $i< $nRows; $i++){ $row = mysql_fetch_array($qResult); $rString .="&id".$i."=".$row['id']."&"."&title".$i."=".$row['title']."&". "&date".$i."=".$row['date']."&"."&entry".$i."=".$row['entry']."&"; } echo $rString."&"; ?>

I created using my host user and password information. I uploaded it to my http folder on the server.
This is the error I get:
Parse error: syntax error, unexpected T_STRING in /home/.metrik/kason/kason.info/http/flash_mysql.php on line 4

I am pretty new to php, so I don’t really know what is wrong. Is this a dreamhost issue that I have to work around or is the code wrong? Thanks a bunch!!!


#2

Hmmm. Maybe the double quotes.
Try this:
$db=‘blog_db’;
mysql_select_db ($db);
Silk

My website


#3

Thanks for the quick reply. I figured out the problem while trying your fix. It was a rookie mistake I guess… I made the php file with textedit on a mac. I changed it to pure text, but when i opened it up in notepad there was a bunch of crap in it. I removed the excess stuff and it fired right up. Thanks!!