Jump to content

Can anyone see the problem :\


illuz1on

Recommended Posts

Hey, I have a problem which I havent been able to overcome, and its killing me!! Please can someone help me fix this piece of code - When beaches.php is reached i want it to display the list of beaches, and when one of those beaches is clicked it displays the 'more info' of that specific beach. And then has a link back to beaches.php to see the list again.

 

Would love any suggestions! Thanks

 

 

<?php

require_once('db.php');

 

if (isset($_GET['view']))

{

$sql = "SELECT * FROM beaches";

$data = mysql_query($sql);

while($record = mysql_fetch_assoc($data))

{

$id = $record['id'];

$name2 = $record['name'];

    $picture = $record['picture'];

    $rating = $record['rating'];

    $desc = $record['desc'];

 

echo "$id, $name2, $picture, $rating, $desc";

 

}

?>

<font class="header">Cape Town Beaches</font><br>

<br>

<?php

$sql = "SELECT * FROM shops";

$data = mysql_query($sql);

while($record = mysql_fetch_assoc($data))

{

 

        echo "<a href="beaches.php?view=$id&name=$name2"><$name2><br></a>";

}

?>

Link to comment
https://forums.phpfreaks.com/topic/41950-can-anyone-see-the-problem/
Share on other sites

<?php
require_once('db.php');

if (isset($_GET['view']))
{
$sql = "SELECT * FROM beaches";
$data = mysql_query($sql);
while($record = mysql_fetch_assoc($data))
{
   $id = $record['id'];
   $name2 = $record['name'];
    $picture = $record['picture'];
    $rating = $record['rating'];
    $desc = $record['desc'];

echo "$id, $name2, $picture, $rating, $desc";

}
?>
   <font class="header">Cape Town Beaches</font>

      

         <?php
$sql = "SELECT * FROM shops";
$data = mysql_query($sql);
while($rec = mysql_fetch_assoc($data))
            {
   $id = $rec['id'];
   $name2 = $rec['name'];
   

         echo "<a href='beaches.php?view=$id&name=$name2'><$name2>
[/url]";
}
         ?>

try this:

 

<?php
require_once('db.php');

if (isset($_GET['view']))
{
$sql = "SELECT * FROM beaches";
$data = mysql_query($sql);
while($record = mysql_fetch_assoc($data))
{
   $id = $record['id'];
   $name2 = $record['name'];
    $picture = $record['picture'];
    $rating = $record['rating'];
    $desc = $record['desc'];

echo "$id, $name2, $picture, $rating, $desc";

}
?>
   <font class="header">Cape Town Beaches</font>

      

         <?php
$sql = "SELECT * FROM shops";
$data = mysql_query($sql);
while($rec = mysql_fetch_assoc($data))
            {
   $id = $rec['id'];
   $name2 = $rec['name'];
   

         echo "<a href='beaches.php?view=$id&name=$name2'><$name2>
[/url]";
}
}
         ?>

this

 

<?php
require_once('db.php');

if (isset($_GET['view']))
{
$sql = "SELECT * FROM beaches";
$data = mysql_query($sql);
while($record = mysql_fetch_assoc($data))
{
   $id = $record['id'];
   $name2 = $record['name'];
    $picture = $record['picture'];
    $rating = $record['rating'];
    $desc = $record['desc'];

echo "$id, $name2, $picture, $rating, $desc";

}
}
?>

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.