davidianstyle Posted February 1, 2007 Share Posted February 1, 2007 I am a complete PHP noob (I just opened up a PHP book and am reading the first chapter). So I have installed MySQL, PHP, and Apache on my computer and did all the necessary setup (I'm pretty sure) I even created a test.php which included <? phpinfo(); ?> and gave me the correct screen however...when I did this: <html> <head> <title>Bob's Auto Parts - Order Results</title> </head> <body> <h1>Bob's Auto Parts</h1> <h2>Order Results</h2> <?php echo '<p>Order processed</p>'; ?> </body> </html> the output looked something like this: Bob's Auto Parts Order Results Order processed '; ?> I don't know why that extra '; ?> keeps showing up... What am I doing wrong? plz help! Thanks. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 1, 2007 Share Posted February 1, 2007 That is odd. That happens to me sometimes when the file upload gets interrupted. Try saving the file again and accessing it? You did save this as a php page, correct? Quote Link to comment Share on other sites More sharing options...
davidianstyle Posted February 1, 2007 Author Share Posted February 1, 2007 Yes. I did save it as a PHP file. I tried resaving and still the same result... Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 1, 2007 Share Posted February 1, 2007 Does this work: <?='<p>Order processed</p>'?> What about <?php $foo = '<p>Order processed</p>'; print $foo; ?> Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted February 1, 2007 Share Posted February 1, 2007 Haha, that is the same PHP book I read when I was learing...well one of them, can't remember which one it is. Is it "PHP for the absolute beginner" by "Andy Harris"? That is a strange that it is displaying like that... Quote Link to comment Share on other sites More sharing options...
davidianstyle Posted February 1, 2007 Author Share Posted February 1, 2007 The first one gives the same result and the second one <?php $foo = '<p>Order processed</p>'; print $foo; ?> gives this: Bob's Auto Parts Order Results Order processed '; print $foo; ?> I am using "PHP and MySQL Web Development" 3rd Ed. by Luke Welling and Laura Thomson Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted February 1, 2007 Share Posted February 1, 2007 Of course I just had to name the wrong book. I would recommend the one I guessed...I found the one your reading a little complicated and I couldn't get what they were saying to stick. The one by "Andy Harris" explained perfectly to where I understood everything. Then again, we all have different learning styles, so it might not be the best one for you. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 1, 2007 Share Posted February 1, 2007 What if you do this: <?php $foo = '<p>Order processed</p>'; print $foo ?> (note, the lack of the closing ; - try this one) Also, check through your phpinfo - what settings are different from default? You can try looking those up, see if any are causing problems? Quote Link to comment Share on other sites More sharing options...
davidianstyle Posted February 1, 2007 Author Share Posted February 1, 2007 unfortunately that did the same thing this time without the semicolon... I'm not sure what you mean by checking the settings. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 1, 2007 Share Posted February 1, 2007 When you did phpinfo() it prints out a bunch of settings, along with their defaults. Find ones which are not default Quote Link to comment Share on other sites More sharing options...
spfoonnewb Posted February 1, 2007 Share Posted February 1, 2007 Try quotes? <?php echo "<p>Order processed</p>"; ?> Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 1, 2007 Share Posted February 1, 2007 works fine this end double or single quotes wiered <html> <head> <title>Bob's Auto Parts - Order Results</title> </head> <body> <h1>Bob's Auto Parts</h1> <h2>Order Results</h2> <?php echo "<p>Order processed</p>"; ?> </body> </html> result X-Powered-By: PHP/4.4.1 Content-type: text/html <html> <head> <title>Bob's Auto Parts - Order Results</title> </head> <body> <h1>Bob's Auto Parts</h1> <h2>Order Results</h2> <p>Order processed</p></body> </html> have you added to the php.ini .html .php Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted February 1, 2007 Share Posted February 1, 2007 I am using "PHP and MySQL Web Development" 3rd Ed. by Luke Welling and Laura Thomson i didn't like that one. that was my first book, as well. i found the coding style to be really bad practice. and not very a definitive guide. i did learn from it tho. when you know nothing, you can learn from an idiot, i guess. Quote Link to comment Share on other sites More sharing options...
davidianstyle Posted February 1, 2007 Author Share Posted February 1, 2007 I tried the double quotes, and they didn't work either...gave this output: Bob's Auto Parts Order Results Order processed "; ?> have you added to the php.ini .html .php How do I do that? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.