Jump to content

[SOLVED] SQL selection line


illuz1on

Recommended Posts

ok worse than i thought...

 

getting

Parse error: parse error, unexpected '{' in /home/capetown/public_html/dev/beaches.php on line 19

 

<?php
$action = mysql_real_escape_string($_GET['action']);
  if (isset($_GET["action"])) {
    if ($result = mysql_query("SELECT * FROM beaches WHERE ocean=$action");
      if (mysql_num_rows($result)) {
        while($row = mysql_fetch_array($result)) {
          extract($row);
          echo "";
        }
      }
    }
  } else {
    echo "";
  }

?>

Thanks alot - that worked out but again, I have run into another problem:

 

This is the whole pages code, it loads and does everything - but doesnt display the beaches when either Atlantic or Indian is selected - just shows nothing..

 

<?php /* Created on: 4/23/2007 */ ?>
<?
include("db.php");
?>
<html>
<body>

Cape Town Beaches<br>
<br>
<a href="beaches.php?action=atlantic">Atlantic Ocean</a> | <a href="beaches.php?action=indian">Indian Ocean</a> | <a href="beaches.php?action=all">All Beaches</a><br>
<br>
Show me the Cape Town Alive guide to a going to the right beach! <a href="beaches.php?action=guide">click here</a><br>
<hr>
</body>
</html>	
<?php
$action = mysql_real_escape_string($_GET['action']);

  if (isset($_GET["action"])) {
    if ($result = mysql_query("SELECT * FROM beaches WHERE ocean=$action")) {
      if (mysql_num_rows($result)) {
        while($row = mysql_fetch_array($result)) {
          extract($row);
          echo "$action <table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">
        <tr> 
          <td class=\"header\">$name - <img src=\"images/rating$rating.gif\"></td>
          <td> </td>
        </tr>
        <tr> 
          <td colspan=\"2\"><hr></td>
        </tr>
        <tr> 
          <td colspan=\"2\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
              <tr> 
                <td width=\"10%\"><img src=\"images/beaches/$picture.jpg\" width=\"87\" height=\"87\"></td>
                <td width=\"90%\" valign=\"top\" class=\"content_text\">$sdesc</td>
              </tr>
            </table></td>
        </tr>
        <tr align=\"right\">
          <td colspan=\"2\" class=\"read_more_text\"><hr></td>
        </tr>
        <tr align=\"right\"> 
          <td colspan=\"2\" class=\"read_more_text\"><a href=\"morebeach.php?id=$id\">show 
            more information</a> | <a href=\"addshort.php?id=$id\">add to shortlist</a> 
            | <a href=\"gallery.php?id=$id\">gallery</a></td>
        </tr>
      </table></td>
  </tr>
</table>";
        }
      }
    }

  } else {
    echo "This is where a nice writeup of the beaches would go!";
  }

?>
</body>
</html>

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.