Jump to content

Recommended Posts

Change your code to

<?php
$con = mysql_connect("localhost","apnimusk","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("apnimusk_naat", $con);

$result = mysql_query("SELECT * FROM album");

while($row = mysql_fetch_assoc($result))
{
    echo "<pre>".print_r($row, true)."</pre>";
    echo $row['name'] . " " . $row['age'];
    echo "<a href='?id='".$row['id']."'>".$row['age']."</a><br />'";
}

mysql_close($con);
?>

And post the output here.

Array

(

    [id] => 1

    [name] => Timmy Mellowman

    [age] => 23

)

 

Timmy Mellowman 2323

'

 

Array

(

    [id] => 2

    [name] => Sandy Smith

    [age] => 21

)

 

Sandy Smith 2121

'

 

Array

(

    [id] => 3

    [name] => Bobby Wallace

    [age] => 15

)

 

Bobby Wallace 1515

'

 

Array

(

    [id] => 7

    [name] =>

    [age] => 0

)

 

00

'

 

Array

(

    [id] => 8

    [name] =>

    [age] => 0

)

 

00

'

You need to add more code to display a new page, eg

<?php
$con = mysql_connect("localhost","apnimusk","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("apnimusk_naat", $con);

// check to see if id is set
if(isset($_GET['id']) && is_numeric($_GET['id']))
{
   echo 'Your have requested ID #'.$GET['id'].'<br />';
   echo '<a href="sadasdas.php">Back</a>';
}
// no id requested, display results
else
{
   $result = mysql_query("SELECT * FROM album");

   while($row = mysql_fetch_assoc($result))
   {
       echo '<a href="?id='.$row['id'].'">'.$row['age'].'</a> - ' . $row['name'] . " - " . $row['age'] . '<br />';
   }
}

mysql_close($con);
?>

can some explain me in detail please what i change in this code for makeing hyper link

echo "<a href='?id='".$row['id']."'>".$row['name']."</a>'";

remowe one ' after =

 

after click link in variable $_GET['id'] is value of id

where i put this code

can some explain me in detail please what i change in this code for makeing hyper link

echo "<a href='?id='".$row['id']."'>".$row['name']."</a>'";

remowe one ' after =

 

after click link in variable $_GET['id'] is value of id

where i put this code

No need to do that, I have already fixed that.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.