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 7586173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:21:37+00:00 2026-05-30T19:21:37+00:00

I am currently still learning PHP so some things I still struggle with. I

  • 0

I am currently still learning PHP so some things I still struggle with.
I have been taking it slowly and reading tutorials which has helped but I can’t figure this one out.

I have a database table (in mysql) with let’s say, 100 urls. There is a column called ‘url’ and a second column ‘text’. I already have the pagination code which works, so will also be using that.

What I want to do is echo out the URLs (which are all in folder called blog in the root of my site), but use the text as the link.

So for example the first three rows in my table might be:

url
001.php
002.php
003.php

text
random text
some random text
more text

when echoed out the links show the text from the column text like:

random text
some random text
more text

and will open to the relevant url when clicked

I’m guessing it will need some kind of loop to collect all the URLs and save me adding the link text in manually, and then my pagination code will split them up.

This is my first time asking a question on here, so if it wasn’t clear enough or you need more info, let me know.

I have done multiple searches on the internet but can’t seem to find a tutorial.

  • 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-05-30T19:21:39+00:00Added an answer on May 30, 2026 at 7:21 pm

    Assuming you connect to a local mysql server with username “root” and password “root”, and have your url’s stored in a table named url_table in a database named url_database you could do something like:

    $connection = mysql_connect("127.0.0.1","root","root"); // Connect to the mysql server
    mysql_select_db("url_database"); // Open the desired database
    
    $query = "SELECT url,text FROM url_table"; // Query to select the fields in each row
    $result = mysql_query($query); // Run the query and store the result in $result
    
    while($row = mysql_fetch_assoc($result)) // While there are still rows, create an array of each
    {
        echo "<a href='".$row['url']."'>".$row['text']."</a>"; // Write an anchor with the url as href, and text as value/content
    }
    
    mysql_close($connection); // close the previously opened connection to the database
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im currently learning python (in the very begining), so I still have some doubts
I'm evaulating Dynamics CRM 2011 currently so I'm still learning how things work. If
i'm currently learning the yii framework and have read their documentation. but i still
Ok I am learning php and trying out classes and functions. Currently I have
Currently we have a hybrid ASP/PHP setup connecting to a SQL Server 2005 database.
Currently I'm doing some unit tests which are executed from bash. Unit tests are
Still learning asp.net and mvc, please be gentle :) Currently setting up an MVC
I'm currently in the process of learning C++, and because I'm still learning, I
Since im currently still learning jQuery and am new to it i need a
Currently I'm working on enhancing a project that has been developed by an external

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.