Jump to content

Recommended Posts

Hello,

 

I am a newbie, and I am not a programmer, and I really need some help! I have several questions about what I am trying to accomplish, but would really appreciate help on any part of it. I am using Dreamweaver MX 2004, php, MySQL, and phpMyAdmin. I am trying to make a search page based on the info in my database, and then have it display on a results page. So far everything is going pretty well, except I want the info from one of the fields that displays on the results page to be a hyperlink, so users can click the link, and go to a static page I have with more info there. This is about books, and I want the users to be able to search for a certain book by either title, author, etc. When the search results display, I would like the title of the book to be a hyperlink, so they can click that, and it would take them to a static page I already created which has a book review there about that particular book.

 

Also, where the search results is displayed, I would like to have a small image of the book display near the title of the book. I am having difficulty doing that using MySQL, however; I finally (maybe by accident) have the image displaying, but along with it displays some text with the folder and filename of the image showing. Thank you for any help that you may be able to offer!

Link to comment
https://forums.phpfreaks.com/topic/59022-images-in-search-results-page/
Share on other sites

This is the code I have for the search page, and I'm currently using it as a test page to try and get things working, and not for the final product. Also, I have a field called Images in my MySQL database, but I wasn't sure what to put in there. I've tried putting: /images/filename.jpg  but I don't know if it should be set to text or blob? I will try to insert the code here. Thanks!  Cynthia

 

<?php require_once('Connections/Books_Conn.php'); ?>
<?php
mysql_select_db($database_Books_Conn, $Books_Conn);
$query_Recordset1 = "SELECT * FROM Reviews";
$Recordset1 = mysql_query($query_Recordset1, $Books_Conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<form name="form1" id="form1" method="post" action="">
Book Reviews:
<input name="Books" type="text" id="Books" />
        
   <input type="submit" name="Submit" value="Submit" />
</form>
<p> </p>
<p> </p>

<table border="1">
  <tr>
    <td>ID</td>
    <td>Title</td>
    <td>Author</td>
    <td>Illustrator</td>
    <td>Publisher_Date</td>
    <td>Category</td>
    <td>AgeLevels</td>
    <td>Location</td>
    <td>Images</td>
  </tr>
  <?php do { ?>
  <tr>
    <td><?php echo $row_Recordset1['ID']; ?></td>
    <td><?php echo $row_Recordset1['Title']; ?></td>
    <td><?php echo $row_Recordset1['Author']; ?></td>
    <td><?php echo $row_Recordset1['Illustrator']; ?></td>
    <td><?php echo $row_Recordset1['Publisher_Date']; ?></td>
    <td><?php echo $row_Recordset1['Category']; ?></td>
    <td><?php echo $row_Recordset1['AgeLevels']; ?></td>
    <td><?php echo $row_Recordset1['Location']; ?></td>
    <td><?php echo $row_Recordset1['Images']; ?><img src="<?php echo $row_Recordset1['Images']; ?>" /></td>
  </tr>
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.