Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Displaying Date From A Database


All I need to do is change the date so it reads, for example, May 1999 when it's displayed on the page. Code:




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Displaying DATE From Database?
I have a database field called `DATE` which has data type date. The purpose of `DATE` as you guessed is to store a date. 2007-11-31

I want to write a script to update a news article posting date. The only way to do this is to break DATE into three separate sections, $year, $month and $day How do I go about doing this?

Please keep in mind, the date is already stored in the database, it does not need to be today's date. It can be any date! Lets work with 2007-11-31 as an example.

View Replies !   View Related
Reading And Displaying A Date From A MySql Database
I've just started using php, and although I am very impressed by it,
there are some things with which I am confounded!

What I'm trying to do is read in a Date from a mySql database and then
display it on screen (the Date is in the usual yyyy-mm-dd format).

If I use SQL on phpadmin
SELECT Date
FROM details
WHERE details.Name = "Paul Lee"
LIMIT 0 , 30

The result comes up 2005-01-01, so this seems to work.
But if I use the following:

$db = mysqli_connect("localhost","root","");
@mysqli_select_db($db, "personnel") or die ( "Unable to select
database" );
$query = 'SELECT Date FROM details WHERE details.Name = "Paul Lee"
LIMIT 0, 30'

$result=mysqli_query($db, $query);

echo "<br>";

echo $result;

mysqli_close($db);

I get "Object id #2" displayed on screen.
I have tried to use the explode function to separate the months, year
and day using the "-" as a delimeter, but this doesn't work, and I
can't seem to get the other php date/time functions to work either.

View Replies !   View Related
Help With Displaying Selecting A Date Range And Displaying Results
I wish to create a simple form that allows the selection of a start date and a stop date with the ability to select what columns to be displayed in the result page.

View Replies !   View Related
Displaying Date
i'm working on K Yank's book and, at some point, i've an insert like this:

$sql = "INSERT INTO Jokes SET
...
JokeDate = CURDATE()";

When i dysplay this on my webpage, the date format is YYYY,MM,DD
and in my country (Portugal), the format is day, month, year
How can i achieve it?

View Replies !   View Related
Displaying Date...
As a final touch to my current project I am trying to display a "Last Updated: " field on the user profile pages of the website. The SQL database is updating the field last_updated automatically any time a record is altered, and this is working fine...

Structure details from phpMyAdmin (in table 'users'): last_updated timestamp  ON UPDATE CURRENT_TIMESTAMP No 0000-00-00 00:00:00

However when I try to output this date I get the result:

Profile Updated: January 1, 1970

The code I am using is as follows... Code:

View Replies !   View Related
Displaying A Date
My current code:

foreach ($page['events'] as $z) {

echo '<b>', $z['date'],  '</b></p>';

}

Which is pulling "date" from a DATE field in the database. Would like it to display as 3-22-2007 ... instead of 2007-3-22 - I know theres a quick answer out there but cant find it.

View Replies !   View Related
Date Is Not Being Pulled From MYSQL Database, Instead Current Date Is Displayed!
I am having trouble pulling a date from a database using PHP at the <a
href="http://www.mytuneslive.com/ameshkin69/"> following page.</a>

Here is the code. As you can see, it is just making the date the
current time. The values in the database are UNIX timestamp, and the
DATE() function is used to convert from UNIX to readable date. Can

<td width="55%" align="left" valign="top"><?php
$row_comment['timestamp'] = date("n d Y g:i A");.....

View Replies !   View Related
Displaying A Date Range
I would like to display a user specified date range e.g Monday to Monday next week or maybe Monday next month. When I have the basic function worked out I would like to get Data from a Mysql Database. here is what I have thought about. Code:

View Replies !   View Related
Displaying A Date With Strtotime
I have successfully used strtotime to format the date on a webpage that is
pulled form a MySQL database in the form yyyy-mm-dd.

However, in another part of the webpage, I have to insert another date that
may contain a NULL entry in the database. If I use strtotime to format this
then it enters the current date, whereas I want it left blank.

View Replies !   View Related
Displaying The Date In A Different Format!
I have a row called Date in the databse which is saved as 0000-00-00 When I try to echo it, it shows like that 2007-04-16 Maybe because I use this normal code: echo $row['Date']; How can I display it like that:16-04-2007

View Replies !   View Related
Displaying Date Format
if i have written a date to a database using CURDATE() and its in the format yyyy-mm-dd, is there a way i can then extract it from the database in another format, eg. dd-mm-yyyy?

View Replies !   View Related
Displaying A Date Before 1970
I am really struggling with displaying a date PRE 1970 in php and mysql. I have a date of birth field in my myqsl db and can echo it out without problem but because i need to echo it out in UK format (DD-MM-YYYY) I get 31 December 1969 on all dated previous to this date. This is the code I use to 'switch' the date around

list($year, $month, $day)= explode("-", $date);
$show_date=date(" d F Y", mktime(0,0,0,$month,$day,$year));

View Replies !   View Related
Displaying Date/time
I'd quite like to have a list of dates/times showin in different timezones i.e.

China: 09:56:01PM, saturday 5 Feburary
India: 01:56:01AM, saturday 5 Feburary

Is there anyway I an do this on the fly using PHP without having to change any sort of timezone/server config variables?

View Replies !   View Related
Date() Not Displaying Correctly
i want to display the time portion of a datetime field.

$thistime = date("H:i:s", $row['test']);

regardless of the value of the field, i get 16:xx:xx as the value for $thistime.

View Replies !   View Related
Displaying Modified Date Of A URL File
I want to display a web page with links to various documents and display the date each document was last modified next to the link. I've found the filemtime command and that works quite nicely for "local" files. However, filemtime doesn't work if the file(s) are refered to by their URLs (which is how I need to do it).

A comment on the manual page (http://www.php.net/manual/function.filemtime.php3) refers to having to use "Socket Operations" but the link posted with that comment doesn't work (it just goes to a page saying the website has been rearranged).

View Replies !   View Related
Date/time Displaying Wrong
How do I set the time display to echo the time, in the timezone the user is in and not the server time. For somereason im in eastern timezone and the host server i9s in central and the time displayed on my laptop is in central.

View Replies !   View Related
Displaying The Latest Submitted Date
I have a MySQL database with one table containing users who submit info and this is tagged to the country they're from. The query below, will list a table GROUPED according to the country and displaying the number of entries in each country.

Eg:
Austria - 2
Australia - 10

I am looking into the possibility of displaying the latest date from the table. For example: Two users in Australia submitted entries on 1 October and 10th October. So the "Last Date Submitted" should show, 10th October under Australia. $list_countries = mysql_query("SELECT country, date_format(date, '%M %d, %Y') AS date, count(country) AS num_of_entries FROM table GROUP BY country") Btw, each entry has its uniqueID too. How do I display the latest date when GROUPING?

View Replies !   View Related
Displaying Date - Show Dd-mm-yyyy
Having set up some info in my database. I wanted to display the date the information was posted. Entering the data into the database the date displays in the format yyyy-mm--dd. How does one go about changing this to show dd-mm-yyyy or even something like 9-sept-05?

View Replies !   View Related
Displaying Date - Doesn't Display The NOW() Value
When I echo $query it doesn't display the NOW() value. Why is this?

$query = "UPDATE notes SET note = '".$note."' WHERE date = NOW()";

View Replies !   View Related
Date Problems - Get The Date From A MySQL Database
Can you help me i have managed to get the date from a MySQL database but it only uses the first record of the date, and displays the same date on all news items.

View Replies !   View Related
Compare Date Of Today And The Date In The Database
i have a db that stores a date in a table with a specific column.

db=test
table=test_date_compare
column name=date_inserted

ok i hv a php form that allows user to input date and it enters in the above column (date) as in format eg: 21/03/2007

now i wat i would like to do is i would like to compare date of today and the date in the database if it is lesser then todays date it deletes that row of data. deleting the row of data i know how but the problem comes wen coparing the date i dunno how to ...

View Replies !   View Related
Converting Database Date To Normal Date
I am looking for a way to convert a date that is stored in a MySQL database like this after useing the date() function in PHP:

2006-08-16 21:03:54

and convert it into a date this:

16 August 2006 @ 11:03:54pm

Does anyone have some insight as to how I would go about doing that?

View Replies !   View Related
Displaying 'new' Icon Based On Date?
I'd like to display a little "new" icon next to all products in a directory which are, funnily enough, new! I've got a date (timestamp) for each product which is inserted on adding a new product and updating a product.

I'd like to do a conditional region using the timestamo but I'm not sure what to use - I could do === [current date] but that would only show the icon for that day and I'd like it to be there for about a week or so.

View Replies !   View Related
Displaying Local Date In Specific Format
i'm trying to decide whether to use PHP or JavaScript to display a date on a website. what i'm wondering is where does PHP take the date from, the server or the client (ie will timezone become a factor). aswell as this, is there a simple way to allow the date to be displayed as: "22nd" "1st" or "14th" instead of "22" "1" or "14"?

View Replies !   View Related
Escaping Quotation Marks From DB? And Displaying By Date
I am populating a text field in my database and I want to have a hyperlink in the text do I:

A) write it out as follows: this great bar <a href="domain">Sherlock's</a> is in erie

or

B) <a href="domain">Sherlock's</a>


Do I need to escape all my slashes in side of the DB too? Code:

View Replies !   View Related
Problems Displaying A Date In The Correct Format
I'm having problems displaying a date in the correct format. I'm using pear to extract a date from our back end database (the date is in DATE_FORMAT_ISO_EXTENDED), and I was to display the date in "Wednesday, February 23rd 2005, 11:04" format. Code:

View Replies !   View Related
Date Displaying And Storing In MySQL While In Wrong Timezone
I've only used php to display the current date but I can see that I'm not in the same timezone as the server is. Its 5 hours ahead and I can't get it to show the date as Eastern Time.

I'm developing a site for a non-profit slopitch league so they can submit score sheets and track their season. 2 teams must submit a score sheet for their team within 72 hours of having played the game. Then they are not allowed to enter the score sheet without the administrator's permission. Code:

View Replies !   View Related
Displaying From Database!
I'm trying to display products that are pulled form a database in a certain way using only DIV tags I would like the products to display across the page in rows of 4, however when i use div tags it is just putting one on each row.. whats the best way to display in a row of 4? here is an example script of what im using to experiment with: Code:

View Replies !   View Related
Displaying Database
I'm trying to setup the information in my database in html tables, I'm not sure what I'm doing wrong here. The test table I'm using here is 4x4 for testing purposes, when I actually do the regular data tables it will be much larger. I'm getting this error and I'm not sure what exactly the problem is there. Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/ninercap/public_html/testingarea/php.php on line 5

<?php

$dbh=mysql_connect ("localhost", "", "") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("");
function display_db_table(testtable)
{
$query_string = "SELECT * FROM testtable";
$result_id = mysql_query($query_string);
$column_count = mysql_num_fields($result_id);

print("<table border=&#391;'>
");
while ($row = mysql_fetch_row($result_id))
{
print("<tr align='left' valign='top'>");
for ($column_num = 0;
$column_num < $column_count;
$column_num++)
print("<td>$row[$column_num]</td>
");.

View Replies !   View Related
Displaying All Database
I have a page which displays teaser info (a name and a photo) from a list of records in a mysql database. I would like the user to click the name and then be sent to another page which displays all of that given record's information. This is all i have, just the code that brings up the list of names/photos.

<?php
$sql = "SELECT col_2, col_19 FROM ft_form_1";
$query = mysql_query($sql);
while($row = mysql_fetch_assoc($query)){
    echo $row['col_2'].'
';
    echo '<img width="100" height="100" img src="' . $row['col_19'].'">
';   
}
?>

View Replies !   View Related
Displaying Database...
I work for an environmental company that is making me develope an internal site that provides various functions... Since I am not really a coder I find it hard to perform such tasks (I am primarily a graphic artist)....

One of the things I need to do... is have a section that employees can go to to search our projects that we have performed....

the database will have various table headers that will include items like: Code:

View Replies !   View Related
Not Displaying First Record In Database
this code is not showing up first record in database:
the table should start off by clan id = 1 and clan name = name1
page: PHP Code:

View Replies !   View Related
Displaying Content From Database
need some simple help with displaying content from a mySQL database using PHP. i want to know how to write a php script to display the latest entry in a table to an html page. and also how to adapt the script to display the latest x amount of entries.

View Replies !   View Related
Searching Into The Database And Displaying
I have written to search from oracle database table and then prints out the information. Here is my code:

View Replies !   View Related
Displaying Data From Database
I know the basics of displaying data from mysql database. Let me explain with an example:
I have 4 rows and 1 column in my table.

1st row : "rat, cat, elephant"
2nd row : "cat, lion, tiger"
3rd row : "elephant, rat, lion"
4th row : "cat, tiger, bear"
I have these data. (i.e) few words separated by comma. Some words repeat. Now i want to display information from this table as :
rat
cat
elephant
lion
tiger
bear

(i.e) I want to display all the names but without repetition. How do i do it ?

View Replies !   View Related
Way Of Displaying The Images, From The Database
Im kind of a novice at PHP programming and need some help on what may be a simple problem, with hopefully a simple solution.

I am trying to write my own photo gallery. I need a way of displaying the images, from the database, as a block like below Code:

View Replies !   View Related
Displaying Images Frm A Database
It gets the data I want from the database and then outputs it into rows and columns. What I want is to display the actual image itself. Code:

View Replies !   View Related
Displaying Database Images
I need to display a thumbnail of a large image that is contained in a database. I cannot upload a thumbnail into the database for various reasons. I have a function that resizes images before inserting into a database, and I know how to display image data from the DB into the browser so I have a rough idea of what's involved. My problem is that I need to get an image from the DB, resize down it and display it in the browser on the fly.

View Replies !   View Related
Displaying 2 Database Column
i am quite new to PHp so excuse the simple question. I have a database with 2 columns, Currency and Price, I want to display both these in one HTML table row, so that the displayed result is something like €2.13. I have tried this:

<?php echo $row['Currency'] && $row['Price'] ?>

But it doesn't work, as you can see here , that code has been used for the "price" column, but only the Price data is displaying, is && the correct operator to use?

View Replies !   View Related
Displaying Certain Things From Database
I need to get information out of a certain field of a database to show on a page. As I need to get on a webpage the events in date order and only events within the next 2 weeks to be shown.

View Replies !   View Related
Displaying Database Information
<?php

$title="Waiting List";

include(header.inc);

$link = mysql_connect($location, $user, $password);

$db = "project";

mysql_select_db($db, $link);

function display_db_table()

View Replies !   View Related
Displaying Only One Record From Database
For some reason it is only displaying one entry from the database insted of all 13.

$sql = "SELECT * FROM search ORDER BY search_id asc";
$result = mysql_query($sql, $conn) or die(mysql_error());
while ($newArray = mysql_fetch_array($result)) {
$search_id = $newArray['search_id'];
$search_word = $newArray['search_word'];

}


echo "$search_id<br>";

View Replies !   View Related
Problem Displaying Image From Database
I used the code below to pull out an image from a mysql database
but nothing shows on the page and there was no error message to
indicate any problem.What could be wrong.The image is actually in the
database with all the details:

<?php
if(isset($_GET[loginid]))
{
$con=mysql_connect("localhost","name","pass");
if(!$con)
{
die('Could not connect to database:'.mysql_error());
}
mysql_select_db("datab",$con);
$id = $_GET[loginid];
$query = "SELECT name, type, size, content " .
"FROM image WHERE id= '$id'";
$result = mysql_query($query) or die('Error, query failed');
$file=mysql_fetch_array($result);
$name=$file['name'];
$type=$file['type'];
$content=$file['content'];
header('Content-length: '.strlen($content));
header("Content-type: $type");
header("Content-Disposition: inline; filename=$name");
echo $content;
}
mysql_close($con)
?>

View Replies !   View Related
Displaying Values From A Database From An Include
I've got a URL going to a template, e.g. www.mydomain.com/product.php?id=product_a

where the template is product.php the tag after the ? refers to the product that should be displyed in the template, in this case product_a

Inside the template (product.php) I've got:-

<? $url = $id.".htm"; include("$url"); ?>

This works fine so far. How ever I've also got an include inside the the template (product_a.php), called product_info.php, which is another php file that displays the product version and the platforms that it sits on. so in the the include (product_info.php) I have:-

<?php

$db = mysql_connect("localhost", "username", "password");
mysql_select_db("DATABASE",$db);
$result = mysql_query("SELECT version FROM table1 WHERE id = id",$db);

do { if ($myrow[0] != "") { echo "$myrow[0]n"; } }

while ($myrow = mysql_fetch_array($result));?>

however this displays all the version numbers within the table (for every product)

I just want it to display the version number of the value of $id (www.mydomain.com/product.php?id=product_a)

View Replies !   View Related
Displaying Image Stored In Database
The user can browse and upload an image and the image is stored successfully in a seperate binary table (with userid and bin_data, filesize, filename, filetype). The photo is displayed properly when I point my broswer to a script called fileshow.php:
PHP Code:

View Replies !   View Related
Problem Displaying One Column Of One Row From A Database With PHP.
I have a small script with PHP that queries a MySQL database to pull
out one row, where I want to be able to access each of the columns
separately. I have tried several different variations and am able to
get the entire row to print, but when I attempt to access the
individual columns I get an error. Here is what I have so far:

if (isset($_POST['memberNo'])):
$link = mysql_connect('...','...','...');
mysql_select_db("...");

//Perform a test query
$query = "SELECT * FROM users WHERE 'id' = " . $_POST['memberNo'];
$result = mysql_query($query) or die(mysql_error());

$line = mysql_fetch_assoc($result);
print $line;

//Close connection
mysql_close($link);

The point of this code is to retrieve the user information to validate
the login information sent in the previous form. I do not get an
error with this code, but it also does not print anything. I know
there is an entry in the database that matches data sent in the
$_POST['memberNo'] variable, it is the only entry in the database.

Changing the 'print $line;' to 'print $line["id"];' does not display
anyting either.

View Replies !   View Related
Displaying Database And Getting Unwanted Results...
I want to display everyone in the database, but only if the 'level' field is larger than 0.  Well, this works fine for most of the database... but if the last entry in the database is 0, then it prints it anyways.

Is there anyway around this?  I tried adding an if statement before the last bit where I echo out the table rows, but it was killing the entire table, or still showing the same results. Code:

View Replies !   View Related
Displaying Results From Database In A Particular Format
How do I display results from a database in a particular format.  For example the following text in this format including the lines in stored in the database:

Quote“Hello,

Welcome to the news for 11/06/07.

Thanks”
When I echo the results using the usual, <? echo $row_news[‘news’]; ?> it doesn’t echo the information in the database in the format it is stored for example it will display like this.  Quote“Hello, Welcome to the news for 11/06/07. Thanks”  How do I get it to display in the format it in displayed in the database?

View Replies !   View Related
Database Connectivity - Not Displaying Any Error
While connecting the database my script is not displaying any error and also not store the information to the database. Code:

View Replies !   View Related
Displaying Database Information In Columns
I have a database with products in and I want iT to automatically show every product on the page. Now I am able to do this easy enough but what I am struggling to do is that I want the products to be displayed in 3 columns. I can get them to display one under the other easy enough but I want them to be in rows with 3 columns instead.

View Replies !   View Related
Displaying Multiple Items From Database
what i have is a page that has four sections. what i want to have is when the page opens, in that page i want the lastest two items for each section from a database to be displayed. the items to be displayed are an image, a title and a description. but i also want the description to be shortend to say about 25-30 words or about 100 chars, if thats easier?

so in the end i have 4 sections, each showing the lastest two items for each section.

would the best way to do this be to have a seperate table in the database for each of the sections? or would i be able to do it from one table?

would i have to creat a query for each of the sections?
e.g:
SELECT * FROM table WHERE section=section

View Replies !   View Related
Displaying Daily Info From Database.
I run a site specifically about a theme park, and am looking for a simple script to display current info on the main page out of a database.

It would look something like this...

Today's Park Information
Operating Hours: (Hours Here)
Regular Live Shows: (Show/Time) (Show/Time) etc
Special Events/Concerts: (Event/Time) etc

Problem is I'm a complete newb, all I know of PHP is how to use include to put my navigation bar and such onto a page, and to do extremly simple adjustments to forum interface scripts, etc...

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved