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

Member Avatar for diafol

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.

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/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.