Jump to content

What is wrong with this line?


Doug

Recommended Posts

<a href=pictures1.php?user_id= ' . $row['user_id'] . '>' . $row['name'] . '</a>';

 

The program ignores  ' . $row['user_id'] . ' so does not go to the correct page. Why would this be? ' . $row['name'] . ' works.

 

Any answers greatly appreciated

 

Link to comment
Share on other sites

why have u got . before and after the vars? think it should be

 

<a href=pictures1.php?user_id= $row['user_id'] >'$row['name']</a>';

 

and if its not allready in php then u need to do

 

<a href=pictures1.php?user_id= <?php  echo $row['user_id']  ?>> <?php echo $row['name'] ?></a>';

Link to comment
Share on other sites

Thanks but none of those lines seem to work.

Here is the whole code. 

[code<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>OneSevenoaks - latest pictures</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="onesevenoaks2.css" type="text/css"
media="screen" />
</head>
<body>


<div id="pictures">
<?php


  
require_once('appvars.php');
  
require_once('connectvars1.php');

  

// Connect to the database 
  
$dbc = mysqli_connect(DB_Host, DB_User, DB_Password, DB_Name); 





// Retrieve the user data from MySQL
  
$query = "SELECT picture, name, user_id FROM pictures order by join_date desc";
  
$data = mysqli_query($dbc, $query);

  


// Loop through the array of user data, formatting it as HTML
  



echo '<h4>Pictures:</h4>';
  
                
       
echo '<table>';

  
while ($row = mysqli_fetch_array($data)) {
    if (is_file(MM_UPLOADPATH . $row['picture']) && filesize(MM_UPLOADPATH . $row['picture']) > 0) {
    

  echo '<img src="' . MM_UPLOADPATH . $row['picture'] . '" alt="' . $row['name'] . '" style="width:150px; maxheight=110px; margin: 5px; padding: 

5px" />
  


<a href=pictures1.php?user_id= ' . $row['user_id'] . '>' . $row['name'] . '</a>';



    }
}




echo '</table>';

  





mysqli_close($dbc);

?>

</div>
<hr>
<p><a href="addpicture.php">Add pictures of your own!</a><br />
<a href="pictures.php">Go back to pictures page</a><br />
<a href="index5.php">Go to the Homepage</a></p>


</body> 

</html>
]

Link to comment
Share on other sites

Try replacing that whole echo statement with this:

echo '<img src="' . MM_UPLOADPATH . $row["picture"] . '" alt="' . $row["name"] . '" style="width:150px; maxheight=110px; margin: 5px; padding: 

5px" />
  


<a href="pictures1.php?user_id=' . $row["user_id"] .'"> '. $row["name"] . '</a>';

Link to comment
Share on other sites

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.