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

  • Home
  • SEARCH
  • 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 8537729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:58:10+00:00 2026-06-11T10:58:10+00:00

i am learning PHP, and have a piece of PHP code that queries a

  • 0

i am learning PHP, and have a piece of PHP code that queries a Database. I obtain a date that is already in the Database and was wondering whether this piece of code format('dd-mm-yyyy'); would work to format the data from the default ‘YYYY-MM-DD’ to ‘DD-MM-YYYY’ and how the code can be utilsed?

<?php 

    $rfp = $_GET['cid'];
 // Connects to Database 
 mysql_connect("localhost", "root") or die(mysql_error()); 
 mysql_select_db("test") or die(mysql_error()); 
 $data = mysql_query("SELECT rfp_id, issue_date, rfp_status.status FROM company, rfp, rfp_status WHERE company.company_id = rfp.company_id AND rfp_status.status_id = rfp.status_id AND company.company_id = '$rfp'") 
 or die(mysql_error()); 
  echo "<table border=1px cellpadding=15 bordercolor='#0000CC'>";
   #echo "<table border=0 cellpadding=15 bordercolor='#0000CC'>";
echo "<tr align = center bgcolor=white>
<td><b>RFP ID</b></td><td><b>Date Added</b></td><td><b>Status</b></td>" ; 
 while($row = mysql_fetch_array($data)){
      $rid = $row['rfp_id'];  
      $idate = $row['issue_date'];
      $status = $row['status'];

# inserts value into table as a hyperlink

echo "<tr align = center bgcolor=white><td>$rid</td><td><b><a target='_blank' href=view_section_detail.php?rid=$rid>$idate</a></b></td><td>$status</td>";
}

# displays table

print '</table>';

 ?>

Any help would be appreciated

Thanks

  • 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-11T10:58:12+00:00Added an answer on June 11, 2026 at 10:58 am

    You can do it directly in the database query like this using mysql date_format:

    SELECT rfp_id, date_format(issue_date,'%d-%m-%Y') as issue_date... etc
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I Am just learning PHP and loving it so far. I have this code
I'm learning php, and right now I'm stuck. I have code that has to
Right, day 8 learning php and I feel that I have tried to do
Learning php! I have a sql database which contains a table called 'images' which
Alright I am still learning my functions in php but this particular piece of
I'm learning php and OOP programming here. I have below working code I am
I am learning PHP and have been agonizing over how to write my code
I'm learning PHP and I have made a results table that sits within a
I'm still learning php and have run up against what should be a relatively
I have committed to learning C now, I'm good with Python/PHP/Bash but I've decided

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.