this as apposed to [this]

Reply

Join Date: Jul 2009
Posts: 7
Reputation: vtek is an unknown quantity at this point 
Solved Threads: 0
vtek vtek is offline Offline
Newbie Poster

this as apposed to [this]

 
0
  #1
Jul 27th, 2009
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 []
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 211
Reputation: chrishea is an unknown quantity at this point 
Solved Threads: 32
chrishea's Avatar
chrishea chrishea is offline Offline
Posting Whiz in Training

Re: this as apposed to [this]

 
0
  #2
Jul 27th, 2009
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.
Last edited by chrishea; Jul 27th, 2009 at 8:40 pm.
Chris
See my list of PHP development tools at:
InnovationsDesign.net
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 7
Reputation: vtek is an unknown quantity at this point 
Solved Threads: 0
vtek vtek is offline Offline
Newbie Poster

Re: this as apposed to [this]

 
0
  #3
Jul 27th, 2009
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>
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: this as apposed to [this]

 
0
  #4
Jul 27th, 2009
Replace ” or “ with " (just a regular quotation).

Replace ’ with ' (just an apostrophe)
Google is your friend.

Use [code] tags.

If you have found a solution to your problem, please mark the thread as SOLVED.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 381
Reputation: langsor is an unknown quantity at this point 
Solved Threads: 33
langsor langsor is offline Offline
Posting Whiz

Re: this as apposed to [this]

 
0
  #5
Jul 27th, 2009
Please use the CODE tags, found here http://www.daniweb.com/forums/misc-e...=400&width=680
It will help us examine your code.

  1. <?php
  2. /* Program: mysql_up.php
  3. * Desc: Connects to MySQL Server and
  4. * outputs settings.
  5. */
  6. //echo; <html><head><title>Test MySQL</title></head><body>;
  7. echo "<html><head><title>Test MySQL</title></head><body>";
  8. //$host=”localhost”;
  9. $host = "localhost";
  10. //$user=”root”;
  11. $user = "root";
  12. //$password=””;
  13. $password = "";
  14. $cxn = mysqli_connect($host,$user,$password);
  15. //$sql=”SHOW STATUS”;
  16. $sql = "SHOW STATUS";
  17. $result = mysqli_query($cxn,$sql);
  18. if($result == false)
  19. {
  20. //echo “<h4>Error: “.mysqli_error($cxn).”</h4>”;
  21. echo "<h4>Error: ".mysqli_error($cxn)."</h4>";
  22. }
  23. else
  24. {
  25. /* Table that displays the results */
  26. //echo “<table border=’1’>
  27. //<tr><th>Variable_name</th>
  28. //<th>Value</th></tr>”;
  29. echo "<table border=\"1\"><tr><th>Variable_name</th>
  30. <th>Value</th></tr>";
  31.  
  32. for($i = 0; $i < mysqli_num_rows($result); $i++)
  33. {
  34. //echo “<tr>”;
  35. echo "<tr>";
  36. $row_array = mysqli_fetch_row($result);
  37. for($j = 0;$j < mysqli_num_fields($result);$j++)
  38. {
  39. //echo “<td>”.$row_array[$j].”</td>\n”;
  40. echo "<td>”.$row_array[$j].”</td>\n";
  41. }
  42. }
  43. //echo “</table>”;
  44. echo "</table>";
  45. }
  46. ?>

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

Hope this helps
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 816
Reputation: Airshow is on a distinguished road 
Solved Threads: 116
Airshow's Avatar
Airshow Airshow is offline Offline
Practically a Posting Shark

Re: this as apposed to [this]

 
0
  #6
Jul 27th, 2009
Vtek,

Are you editing in MS Word? Guaranteed grief.

Use notepad, or my favourite 1st Page 2000/2006 by Evrsoft

Airshow
Last edited by Airshow; Jul 27th, 2009 at 10:45 pm.
50% of the solution lies in accurately describing the problem!
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 7
Reputation: vtek is an unknown quantity at this point 
Solved Threads: 0
vtek vtek is offline Offline
Newbie Poster

Re: this as apposed to [this]

 
0
  #7
Jul 28th, 2009
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!
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 816
Reputation: Airshow is on a distinguished road 
Solved Threads: 116
Airshow's Avatar
Airshow Airshow is offline Offline
Practically a Posting Shark

Re: this as apposed to [this]

 
0
  #8
Jul 28th, 2009
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
Last edited by Airshow; Jul 28th, 2009 at 9:07 am.
50% of the solution lies in accurately describing the problem!
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 7
Reputation: vtek is an unknown quantity at this point 
Solved Threads: 0
vtek vtek is offline Offline
Newbie Poster

Re: this as apposed to [this]

 
0
  #9
Jul 28th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 816
Reputation: Airshow is on a distinguished road 
Solved Threads: 116
Airshow's Avatar
Airshow Airshow is offline Offline
Practically a Posting Shark

Re: this as apposed to [this]

 
0
  #10
Jul 28th, 2009
Vtek,

I don't know Dev-PHP. Maybe I will take a look ... thanks.

Airshow
50% of the solution lies in accurately describing the problem!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC