kelseyirene Posted December 15, 2009 Share Posted December 15, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/185160-_get-code-in-link-not-working/ Share on other sites More sharing options...
mikesta707 Posted December 15, 2009 Share Posted December 15, 2009 im assuming that the `last` column is a varchar type ("SELECT * FROM AuthorInfo WHERE last='$v'"); try that, you have to surround strings in mysql with quotes, or else it thinks its a number/variable/keyword/something its not Quote Link to comment https://forums.phpfreaks.com/topic/185160-_get-code-in-link-not-working/#findComment-977423 Share on other sites More sharing options...
kelseyirene Posted December 15, 2009 Author Share Posted December 15, 2009 That did it!! Rookie mistake. I thought I'd tried the quotes but obviously I didn't. Thank you thank you! Quote Link to comment https://forums.phpfreaks.com/topic/185160-_get-code-in-link-not-working/#findComment-977424 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.