Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8660813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:21:06+00:00 2026-06-12T16:21:06+00:00

I have a php page where I am getting latest blog posts from db

  • 0

I have a php page where I am getting latest blog posts from db like this

$result = mysql_query("SELECT * FROM wp_posts ORDER BY ID DESC LIMIT 3")ordie(mysql_error());

Now from here I want to redirect to actual wordpress post

<a href="#" target="_blank"><?php echo $row->post_title; ?></a>

How do I get the permalink? any help? thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:21:08+00:00Added an answer on June 12, 2026 at 4:21 pm

    WordPress generates your URLs instead of storing them,

    try this query from Dave Heavy Industries

    SELECT wpp.post_title, wpp.guid, wpp.post_date, CONCAT(wpo_su.option_value, REPLACE( REPLACE( REPLACE( REPLACE(wpo.option_value,'%year%',date_format(wpp.post_date,'%Y')) ,'%monthnum%',date_format(wpp.post_date,'%m')) ,'%day%',date_format(wpp.post_date,'%d')) ,'%postname%',wpp.post_name ) ) as permalink FROM wp_posts wpp INNER JOIN wp_options wpo on wpo.option_name='permalink_structure' and wpo.blog_id=0 INNER JOIN wp_options wpo_su on wpo_su.option_name='siteurl' and wpo_su.blog_id=wpo.blog_id WHERE wpp.post_type = 'post' AND wpp.post_status = 'publish' ORDER BY wpp.post_date DESC 
    

    then you can get the link like

    <a href="<?php echo $row->permalink; ?>" target="_blank"><?php echo $row->post_title; ?></a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this PHP page where the user can select and un-select items. The
I am getting this error on my index.php page where i have also included
I have one php page like this <script type=text/javascript src=js/jquery.min.js></script> <script type=text/javascript> window.onbeforeunload =
i have a php page that redirects (if successful) to another php page like
I have a php page which creates URL like: vendors/London City/cat-DJ & Entertainment/keywords which
I have php page that has jquery ajax call. the begging of this page
I have a php page that recalls data from an SQL table, and then
i have tried following code in order to pass values to another php page,
On my index page I have a link to my login.php page with this
I'm a newbie for PHP5 and In my php page I'm getting this error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.