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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:26:10+00:00 2026-06-17T05:26:10+00:00

I have a php look up from a drop down list. This will look

  • 0

I have a php look up from a drop down list. This will look up changes to a specific staff’s time card and return to a table. Works really well but I am having trouble returning the results from Line 2 and 5 and 7 to show real time not unix time, 2 is date effected, 5 is date requested and 7 in date approved/changed.
This is the code i am using.

<table border="1" width="75%" cellpadding="2" cellspacing="0">
<tr>
<td align="center">Date Effected</td>
<td align="center">Status requested</td>
<td align="center">Requested by</td>
<td align="center">Date requested</td>
<td align="center">Amended by</td>
<td align="center">Date amended</td>
</tr>
<?php
$host = "host";
$user = "USER";
$pass = "PWORD";
$dbname = "DB";
$loc = $fgmembersite->UserLocation();
$term = $_GET['button'];
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().":    ".mysql_error()."<BR>");
mysql_select_db($dbname);
$query= "select * from $loc where User_id=$term";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while ($line = mysql_fetch_row($result) )
{
echo '<tr>';
echo '<td align="center">'.$line[2].'</td>';
echo '<td align="center">'.$line[3].'</td>';
echo '<td align="center">'.$line[4].'</td>';
echo '<td align="center">'.$line[5].'</td>';
echo '<td align="center">'.$line[6].'</td>';
echo '<td align="center">'.$line[7].'</td>';
echo '</tr>';
}
?>
</table>

any help gratefully revived. 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-17T05:26:11+00:00Added an answer on June 17, 2026 at 5:26 am

    First, stop using mysql_ functions. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements as your code is vulnerable to SQL injection and use PDO or MySQLi – this article will help you decide which.

    If I understand correctly, you’re storing the date as a unix timestamp and need to convert it. It can be done with MySQL or PHP.

    With MySQL, you can use FROM_UNIXTIME().

    mysql> SELECT FROM_UNIXTIME(1196440219);
        -> '2007-11-30 10:30:19'
    

    Manual

    With PHP, you can use date.

    echo date("F j", 1196440219);
       //November 30
    

    Manual

    I would also recommend that you specify a column list in your query, and use those columns rather than the index value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have php code that returns this from a database, [ { Time: 2012-11-27
I have a directory with files that look like this: 001_something.php 002_something_else.php 004_xyz.php 005_do_good_to_others.php
I have created an html form. it consist of several drop down list for
So, basically I have this select / drop down menu that I use AJAX
I have had a look at this link: https://www.owasp.org/index.php/Input_Validation_Cheat_Sheet which discuss the use of
I have a php page that contains a form with 7 drop down boxes.
I have written PHP code which connects to MYSQL to look up information, sends
I have buttons on a page that look like: <p> <a href=view.php> <input type=button
I have PHP script works without problems, like this : while($row4 = mysql_fetch_array($result4)) {
I have PHP snippets like this ( snippet.php ): <?php $some_param = some_function(); ?>

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.