Jump to content

syntax


alienmojo

Recommended Posts

echo "<table border='5'>
  <tr>
  <th>Picture</th>
  <th><a href="results.php?sort=1">Price</a></th>
  <th><a href="results.php?sort=2">Baths</a></th>
  <th><a href="results.php?sort=3">Bedrooms</a></th>
  <th>State</th>
  <th>City</th>
  <th><a href="results.php?sort=4">Square Feet</a></th>
  </tr>";

 

theres my code thats the part getting this error

 

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\Documents and Settings\marquis taliaferro\Desktop\web page\results.php on line 203
Link to comment
https://forums.phpfreaks.com/topic/37408-syntax/
Share on other sites

Or:

echo '<table border='5'>
  <tr>
  <th>Picture</th>
  <th><a href="results.php?sort=1">Price</a></th>
  <th><a href="results.php?sort=2">Baths</a></th>
  <th><a href="results.php?sort=3">Bedrooms</a></th>
  <th>State</th>
  <th>City</th>
  <th><a href="results.php?sort=4">Square Feet</a></th>
  </tr>';

 

If you want to use a " inside of a string, you need to either mark the string with ' or escape them like Fert said. Same for ' and \'.

Link to comment
https://forums.phpfreaks.com/topic/37408-syntax/#findComment-178810
Share on other sites

or, another answer:

echo <<<html
<table border='5'>
<tr>
<th>Picture</th>
<th><a href="results.php?sort=1">Price</a></th>
<th><a href="results.php?sort=2">Baths</a></th>
<th><a href="results.php?sort=3">Bedrooms</a></th>
<th>State</th>
<th>City</th>
<th><a href="results.php?sort=4">Square Feet</a></th>
</tr>
html;

 

then you can use either....

 

just a question. is it supposed to be <th> or <td>?

Link to comment
https://forums.phpfreaks.com/topic/37408-syntax/#findComment-178950
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.