crazylegseddie Posted August 19, 2006 Share Posted August 19, 2006 I used the php freaks search full text search facility tutorial to create my search function, which i have managed to link to my table and carry out correct searches. How do I edit the script to now turn the title of my search into a link to the product? all my products are linked like this: categories.php?c=0&p=70 ie 'p=70' being the product id.for those who hasnt seen the tutorial to display the results the code looks like.[code] while($row = mysql_fetch_object($result)) { echo '<strong>Title: '.stripslashes(htmlspecialchars($row->pd_name)).'</strong><br />'; echo '<p>'.stripslashes(htmlspecialchars($row->pd_more)).'</p>'; echo '<p>'.stripslashes(htmlspecialchars($row->pd_more2)).'</p>'; echo '<hr size="1" />'; } ?> [/code]I need the title ie. $row->pd_name to be the link.Any info regarding my query will be cool.THX Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 19, 2006 Share Posted August 19, 2006 Something like this:[code]echo "<a href='categories.php?c=0&p=". $row['product_id']. "'>more info</a>";[/code] Quote Link to comment Share on other sites More sharing options...
crazylegseddie Posted August 19, 2006 Author Share Posted August 19, 2006 Hi thx for reply but i tried to add that code but received this error:Fatal error: Cannot use object of type stdClass as array in C:\Documents and Settings\ben\Desktop\Bens Briefcase\www\whitedisc\searchtemp\search.php on line 64what I needed was to turn the title row (shown below) into a link from the search results if thats possible??[code]echo '<strong>'.stripslashes(htmlspecialchars($row->pd_name)).'</strong><br />'; [/code] Quote Link to comment Share on other sites More sharing options...
crazylegseddie Posted August 19, 2006 Author Share Posted August 19, 2006 I have also tried:[code]echo "<a href='categories.php?c=0p=". $row['pd_id']. "'>".stripslashes(htmlspecialchars($row->pd_name)).'</a><br />'; [/code]but still get the same error message? ??? Quote Link to comment Share on other sites More sharing options...
crazylegseddie Posted August 20, 2006 Author Share Posted August 20, 2006 problem solved with:[code]while($row = mysql_fetch_assoc($result)) { echo "<a href='categories.php?c=0p=". $row['pd_id']. "'>".stripslashes(htmlspecialchars($row->pd_name)).'</a><br />'; echo '<p>'.stripslashes(htmlspecialchars($row['pd_more'])).'</p>'; echo '<p>'.stripslashes(htmlspecialchars($row['pd_more2'])).'</p>'; [/code] Quote Link to comment 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.