Hows it going. Im brand spanking new to PHP and just lost my virginity to it today. The experience has been also similar, Awkward, and just going the wrong way about it, not to mention premature emotional ejacutlation after the installation and finding out that it wasnt satisfied with the work that I did, and refused to co-operate.
Anyway, long story short XAMMP saved the day. and I decided to test the PHP with a task from the dummies guide. Heres the sample code,
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line<p>

<?php echo “This is a PHP line”; phpinfo();?>
</body></html>

The highlited text contained a Parse error when I viewed it in firefox on my local host, so remembering that the word "this" is a function or something like that, I cut the word out and the page worked perfectly in firefox.
So my question is, how can you get php to read function texts as normal content text. Im sure its as simple as adding a character before the word and if so which one? and if not, how do you work around this?
Thanks in advance and sorry if the code isnt in exact format ie []

You haven't used standard single or double quotes around the phrase (“This is a PHP line”; ) If you replace the quotes with standard ones (Vertical not angled) you won't have an error.

Thanks for the info. I have another code as part of the exercise for dummies, though I should get my hands on the retards guide to php =D
It contains errors also and was wondering if you could give it a quick lookover. I copied and pasted the text straight from the e-book so I think the author has sold everyone who has read it short.
example
<?php
/* Program: mysql_up.php
* Desc: Connects to MySQL Server and
* outputs settings.
*/
echo; <html>
<head><title>Test MySQL</title></head>
<body>;
$host=”localhost”;
$user=”root”;
$password=””;
$cxn = mysqli_connect($host,$user,$password);
$sql=”SHOW STATUS”;
$result = mysqli_query($cxn,$sql);
if($result == false)
{
echo “<h4>Error: “.mysqli_error($cxn).”</h4>”;
}
else
{
/* Table that displays the results */
echo “<table border=’1’>
<tr><th>Variable_name</th>
<th>Value</th></tr>”;
for($i = 0; $i < mysqli_num_rows($result); $i++)
{
echo “<tr>”;
$row_array = mysqli_fetch_row($result);
for($j = 0;$j < mysqli_num_fields($result);$j++)
{
echo “<td>”.$row_array[$j].”</td>\n”;
}
}
echo “</table>”;
}
?>
</body></html>

Please use the CODE tags, found here http://www.daniweb.com/forums/misc-explaincode.html?TB_iframe=true&height=400&width=680
It will help us examine your code.

<?php
/* Program: mysql_up.php
* Desc: Connects to MySQL Server and
* outputs settings.
*/
//echo; <html><head><title>Test MySQL</title></head><body>;
echo "<html><head><title>Test MySQL</title></head><body>";
//$host=”localhost”;
$host = "localhost";
//$user=”root”;
$user = "root";
//$password=””;
$password = "";
$cxn = mysqli_connect($host,$user,$password);
//$sql=”SHOW STATUS”;
$sql = "SHOW STATUS";
$result = mysqli_query($cxn,$sql);
if($result == false)
{
//echo “<h4>Error: “.mysqli_error($cxn).”</h4>”;
echo "<h4>Error: ".mysqli_error($cxn)."</h4>";
}
else
{
/* Table that displays the results */
//echo “<table border=’1’>
//<tr><th>Variable_name</th>
//<th>Value</th></tr>”;
echo "<table border=\"1\"><tr><th>Variable_name</th>
<th>Value</th></tr>"; 

for($i = 0; $i < mysqli_num_rows($result); $i++)
{
//echo “<tr>”;
echo "<tr>";
$row_array = mysqli_fetch_row($result);
for($j = 0;$j < mysqli_num_fields($result);$j++)
{
//echo “<td>”.$row_array[$j].”</td>\n”;
echo "<td>”.$row_array[$j].”</td>\n";
}
}
//echo “</table>”;
echo "</table>";
}
?>

Looks like you can not copy and paste out of the e-book, since you retain special character formatting (angled-quotes).

Hope this helps

Thanks a million to everyone who posted their help comments, I really appreciate it.
I think your'e right langsor, although Its a pain in the ass reading then typing as opposed to copying and pasting i'll have to do it, plus I think that I might actually LEARN some of the code doing it this way.
and no I'm note using wordpad, I learned the hard way a while back after trying to make a website using word pad.
It wasnt pretty!
Could you tell me is there any software (freeware, opensource) that checks syntax for you? or better still is there something like notepad available but aimed more towards scripting with syntax error checking functions on it?
Thanks a bunch!

Vtek,

1st Page 2000 is free, I think they charge for v2006 but 2000 is very capable (it's the one I use).

It doesn't go as far as you want but it colour-codes scripts such that many errors are easy to spot.

(I'm so pleased you're not using Word or Wordpad)

Airshow

Thanks Airshow. I maybe a newb but im not completley out of touch =D
I got 1stpage so thanks for the link.
I also came accross a program called Dev-PHP, Ever heard of it?

http://dev-php.software.informer.com/

It looks pretty cool and just as in depth as first page but I dont think I configured it properly, as Im getting a couple of error messages when trying to use some specific functions.

Since you are new to PHP you should get into good practices now. NEVER use " unless you are using a variable. Use ' instead. On small files this isn't so important but on heavy servers or heavy scripts that can save you a lot of page load time.

As for IDE's. Zend is one of the best in my opinion. I use 5.5.1, the new one blows. EditPlus is nice too. IDE's are a personal preference. I used notepad for years. I hate dreamweaver as many experienced programmers do as well, but its not bad for beginners.

I would recommend an IDE that will allow debuggers and use the zend debugger. This will teach you how to fix many small issues veteran programmers miss, like php warnings. I programmed for almost 5 years before i used a debugger and i will never go back to not using one.

Cheers for the info SoN9ne.
Ill go get zend now and take a look at it.
I like dreamweaver personally as I use it for designing rather than coding. and yes I am a beginner which is probably another reason why. I also like the fact that I can see everything live as I work both in the script panel and the design panel, that way I can learn a little more html that I may not have known already. My problem is not being able to have any visual representation of the code Im typing, Im sure when I become more experienced with php this wont be an issue and maybe the nature of the script or the ide wont have a visual representation for me to reference to so I'll just have to get used to it that bit quicker.
nice one for the advice anyway and i'll keep it in mind as I continue to learn.

Hey,

On the subject of development environments. I'm sure the Zend IDE is a good suggestion, however I too use Dreamweaver but just in Source view mode. I also have an Apache server running locally with PHP support, so I can make changes in source view, hit F12 for my browser and view the changes live running on my local server. It's pretty easy to point Dreamweaver to launch from your server environment too.

There are plenty of good builds of Apache with PHP and MySql and more all ready to roll for your PC environment (I run on Windows XP Pro), but the one I use that works great and is easy-breezy to install is found here, and free: http://www.indigostar.com/indigoampp.html

Good luck to you

This article has been dead for over six months. Start a new discussion instead.