Jump to content

What is wrong with this line?


Doug

Recommended Posts

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>';

try this

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

 

if your echoing that line otherwise, and i think its better practice

 

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

 

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>
]

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>';

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.