Jump to content

$_GET code in link not working


kelseyirene

Recommended Posts

I'm setting up a book database and have a page for photos of authors, where visitors can click on the photo and go through to a page with more information. The table I'm drawing from is TitleInfo with num, title, author_first, author_last, isbn. I set up a similar code for book covers and that works fine, but I adapted it and it no longer works. When the link clicks through, it says "Unknown column '(author's last name)' on line 13." I know that the column exists. How do I make it work? Help!

 

Here's the code for the link

 

<?

include("connect.php");

$sql=mysql_query("SELECT * FROM AuthorInfo ORDER BY last") or die ('Error: '.mysql_error());

while($r=mysql_fetch_array($sql))
{
    $lname=$r['last'];
        
    echo "<a href='authorss.php?type=$lname'>";
    echo "<img src='images/" . $lname . ".jpg' hspace=5 vspace=5 border=0 height=200 align='left'>";
    echo "</a>";
}

?>

 

Here's the code for authorss.php (I know right now it's really simplistic, but I need the page to get the information before I start designing, etc):

 

<?

include("connect.php");

$v=$_GET['type'];

$query=mysql_query("SELECT * FROM AuthorInfo WHERE last=$v") or trigger_error (mysql_error());

while($r=mysql_fetch_array($query))
{
    $v1=$r["last"];
    echo $v1;
    echo "<br>";
}

?>

 

Help! Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/185160-_get-code-in-link-not-working/
Share on other sites

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.