Jump to content

Recommended Posts

Hi

I'm using wordpress and I want to create a link that will use the slug of an item from the database. For example if the user clicks on view of an item, then the link must direct the user to a page that will have more information of the item.

I have this

<?php global $wpdb;
$bras = $wpdb->get_results("SELECT * FROM bras;");
?> [/size][/font][/color]


<table>
<?php foreach($bras as $bra): ?>


<td><?php echo $bra->title ?><br />
<img src="<?php echo bloginfo('template_directory').'/img/'.$bra->filename; ?>" /><br />
<?php echo $bra->content ?><br />
<?php echo $bra->price ?><br />


<a href="#" />View</a>


<?php endforeach; ?>
</td>
</table>

and then the user will click view and then get directed to bras_view which will then give the information of the item,

Link to comment
https://forums.phpfreaks.com/topic/273137-how-to-make-a-link-use-a-slug/
Share on other sites

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.