0

ok so what i want this to do is to get the gallery name, then place it in a hyperlink, with the href including the gallery name so on the page im re-directing to i can use $_GET and get some information without a session etc. But there is nothing displayed its just a blank screen!

and here is the code:

<?php 
SESSION_start();
$username = $_SESSION['username'];
include("dbcon.php");
dbcon();

$result = mysql_query("SELECT * FROM gallery
 WHERE username='$username' AND name='yes'") or die(mysql_error()); 

while($row = mysql_fetch_array( $result )) {
echo '<a href="upload.php?gall=';
echo '$row[gallery]">';
echo '$row[gallery]</a>';

} 

?>

any help will be much appreciated,

many thanks,

jakx12

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by ShawnCplus
0

Check to see if your session data contains anything. Echo it out. Your loop code looks a bit odd but seems ok. There's no validation.
Your query variables aren't " . escaped . " nor {braced}, do one or the other.

In addition, you must check that the gallery name is valid for url use.

Either encode the data (url_encode(), I think) or just use the primary key (the gallery id) for url use.

0

I think someone fixed a very similar problem for you before.
You cannot surround variables with single quotes, ie., '. You either have to use no quotes at all or use double (") quotes.

Read through a few sections of this http://www.w3schools.com/PHP/

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.