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




How To Find The Last Accessed Date Of A MySql Database


How to find out the last accessed date of a MySql Database. I have around 200 databases in my server some are used and some are not in Use, I want to remove the database that are not in Use. SHOW TABLE STATUAS gives me last updated Date. In my case there are some database which are not updated at all, but...




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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");.....

Mysql Accessed Remotely
I want to know how you can access a remote mySQL database from a php script.

Also how can I connect to a remote mysql database from mysql administrator?

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.

Pulling Data From A MySQL Database With PHP Date Code??
I am trying to find ways to retrieve data by date from a mysql database.
What I would like to do is to have the option for people to retrieve a file
that was entered in the week before the current day (something like click
here for all drinks added in the last week) I have tried to make this code
work, the only way I can is to manually change the date every day, I would
like it to do it automatically.

Taking Date Of Birth From User And Sending It To A Mysql Database
i have created a form that takes a users date of birth as 3 seperate values $day $month and $year i do not know how to combine these values into a single value called $dob.
I tries using just a singal value to take the date however it did not work, even after I had formated my database.

Using The Date Function To Find Last Week Start And End.
I need to find the start of last week (monday) and the end of last week (sunday) using the date function in a Y-m-d format.

But it needs to work this out regardless of todays date.

Finding a day in the past is not a problem if you know how many days to minus from the date function, but how can I work this to be not dependent on this fact?

How To Find Id In Database
i have a user system, and i am currently working on a update page for the user
i have the whole system down its just that for it too work i have to put in the id in $sql

and i can't set it as a variable because it doesn't get a number

is there somekind of way that i can get id through a session? because thats the only way it would work

Find Similar IPs In Database
I have the following code for finding exact matches for records in my users table containing the same ip address.

SELECT * FROM users WHERE ipaddress IN (SELECT ipaddress FROM users GROUP BY ipaddress HAVING COUNT(*) > 1) This returns a listing of user accounts with the EXACT SAME ip address registered.

What I want to also be able to find is records with similar IP addresses.  For an example,

127.0.0.1
127.0.0.15

would be returned as similar matches.  I currently only want to ensure that the first 3 parts (127.0.0.*) are exact matches and the fourth part of the ip is the wildcard.

REQ How Would I Compare Multiple Date Fields In One Table To Find The Latest Entry Opps
i didn't explain it correctly before
my table is like this

example fields:
ID name username outcome date1 date2 date3 (etc..) - date15 price1 price2 price3 (etc..)

I know that Mysql query order by will compare records on a specific date, but how do i compare
multiple fields within the same record. Want to find the latest date within the record..

Find A Max Value In Mysql With Php ?
How do I a max value in mysql with php?

I can find a max in mysql with:
SELECT MAX(num) FROM codes WHERE num LIKE 'A%'

I try to do it in php and it doesn't work -

$result = mysql_query("SELECT MAX(num) FROM codes WHERE num LIKE 'A%'" , $link);
$row = mysql_fetch_array($result);
$num=$row["num"];

this returns $row as Array?

Accessed Based Off Of IP...
There are certain scripts that I have that only I want to run, both from
home and sometimes work. If I add something like this (below) to the
scripts, will this keep out unauthorized use (if the scripts are found
somehow), or can the REMOTE_ADDR be easily spoofed ?

Should I be checking HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR also ?

$ip = $_SERVER["REMOTE_ADDR"];
if (($ip == "x.x.x.x") or ($ip == "y.y.y.y"))
{
//secret stuff
}
else
{
echo "<META HTTP-EQUIV="refresh" content="0; url=/index.php">";
die();
}

or something like this:

function getipaddress()
{
$ip;
if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if (getenv("HTTP_X_FORWARDED_FOR")) $ip =
getenv("HTTP_X_FORWARDED_FOR");
else if (getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = "UNKNOWN";
return $ip;
}

$ip = getipaddress();
if(($ip == "x.x.x.x") or ($ip == "y.y.y.y"))
{
//secret stuff
} else {
echo "<META HTTP-EQUIV="refresh" content="0; url=/index.php">";
die();
}

Can't Find MySQL Extensions (PHP As CGI)
install of Apache 2, PHP5 as CGI and MySQL 4 on
WinXP.
Apache and PHP work fine, MySQL works fine in the command line, but I
can't have PHP to find the MySQL extensions.

I installed phpMyAdmin, and this is how I found out that PHP didn't find
the extensions because I got this error message:

"PHP Startup: Unable to load dynamic library 'C:/Arquivos de
Programas/PHP5/php_mysql.dll'"

I googled for this error message, and I didn't find anything useful
because it seems that I don't have an extensions folder (?!)

I searched for php_mysql.dll on my computer and I didn't find it. Did I
forget to install extensions or something?

These are the folders of the PHP installation folder:

- sessiondata
- uploadtemp

And these are the files:

- IISConfig.exe
- install.txt
- license.txt
- php5ts.dll
- php-cgi.exe

It seems to me that there are files or folders missing...

Find Mysql Row In An Array?
I would like to be able to match values from my mysql table to an array.  For example:

$result = mysql_query('SELECT * FROM db');
while ($row = mysql_fetch_array($result)) {
  if ($array == $row[id]){
  echo "We found your value"}
}

I realize this isn't a functional example, but basically I would like to match the id value with the same value in the array and if it doesn't exist go to the next row of the mysql.  I've tried a few things such as array_filter, with no success. It seems like theres an easy way to do this that I don't know of.

& Symbol Can Not Be Accessed Thru $_REQUEST
I have one page which shows some book category name which is hyperlinked.
If click on it, I need to display all the books in that particular category.
If the category name contains a "&" symbol which can not be accessed through $_REQUEST array.

Find Match In MySQL Table
I have a table with several fields (id, company, city, and others). What I think I want to do is to select all the records (ordering by company asc for display purposes) and loop through them to find the requested id, BUT then I need to know the current row that match occurs in the overall list.

If I am not mistaken, if I do the match on the 'id' in the table with the id requested, then only that one row will be selected. So then for getting the prev/next links to work off the 'ordered by company asc' order and not just the 'id' sort, I need to know where this particular id matched row is in the overall list.

Where Can I Find A Good Mysql Reference ?
i want a clear reference...the manual is a bit confusing...another thing, can i do calculations in mysql ?

Using Data In Vars Accessed By Print_r
how can I access (for use) information obtained through print_r? I am using a mapping library and I can view the data by using print_r, but I now need to use that information in a calculation.

Track Every PHP File That Gets Accessed By A CMS System
I would like to track every PHP file that gets accessed by a CMS system I am using, including those that just get included by PHP
files.

I am running WAMP on a Windows platform, so I can mod code to do this as needed.

Can Objects Be Stored In Arrays And Still Be Accessed ?
In order to have a form modeled, I would like to store the objects,
which represent the form fields in an array of the object representing
the form.

Nevertheless, the values of the objects in the array can be sometimes
accessed, sometimes not. Any explanations?

Here is a similar code:

<?php
class A {
//for example a form field
var $a;

function set_a($arg){
$this->a=$arg;
}//function
}//class

class B {
//for example a form
var $b=array();
}//class

/*
--here the script Output:

1: 1
2: 2

1:
2:

*/

$ob = new B;
$ob->a[1]=new A;
$ob->a[2]=new A;

foreach($ob->a as $index=>$value){
$value->set_a($index);
echo $index.': '.$value->a.'<br />' ;
}

foreach($ob->a as $index=>$value){
echo $index.': '.$value->a.'<br />' ;
}

?>

Security Alert! The PHP CGI Cannot Be Accessed Directly.
I have installed php4.2.2 using the windows installer but i am having problem. I get the message:

Security Alert! The PHP CGI cannot be accessed directly. This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

Logging IP, Username & Time DB Is Accessed..
I've been reading some books and playing around w/ a bit of code, but I still have a question that I cannot locate the answer to using the search feature or in any of the books.

What I would like to do exactly is when I connect to a MySQL DB using PHP I would like to log the IP (which I think I understand how to do), as well as the username & time a specific password in the DB was accessed. I don't expect anyone to code this for me, just help me out by letting me know if I'm on the right path and if I'm correct that what I want is possible.

Find A List Of The Mysql Query Syntax?
Where would I find a list of the mysql query syntax?

Date Dropdown From Mysql Date Entries
For the PHP gurus out there, here is what I want to do: create a dropdown list of available dates from a mysql database date entries. But the dropdown/s should have 3 separate fields in month, day and year which in effect shows only those months, days and years that have corresponding entries from the database.

Planning to use this in the archive section of an online news publication so people can select issues to view via dropdown list that have corresponding entries only.

UNIX Mktime To MySQL Date Or Date
A form that sends a starting date and an ending date. I have figured out how to tell the difference between the two and even rip the difference into an array because I need to compare the individual dates against a mySQL database to pull results from a particular date in a series. This is no problem. My problem is that teh mySQL database uses DATE as a field definition and this can not be changed. I managed to pull the date differences using some cleaver mktime stuff but no I do not know how to get this 1072242000 into this 2003-12-24...

Is there a function that reverses the mktime result into a usable date format? I would take anything at this point and I can explode and then array it to get what I want - but there has to be something. Code:

Formatting Date From MYSQL Date Field
i've got a date field in my table, but the default format is YYYY-MM-DD... is there any way i can pull the date out of the database and format it differently... like DD.MM.YYYY or like April 13, 2003?

Cannot Find MySQL Header Files Under - Compiling PHP5 (Suse 9.0)
I have compiled and installed MySQL and Apache 2. I am now trying to compile
PHP5 module for apache but am having real problems with it. I keep getting
the message:

"Cannot find MySQL header files under" and then a file path. I have tried
various paths and no path at all but I still can't get it to work. Is there
something else I need to download that is not part of the Standard MySQL
source download?

DATE Doesn't Get Into Database
I have a HTML-form with a 10width field in which you can enter a date. But whatever I enter. In the database I always find 0000-00-00. The variable comes through. I checked that. Does anybody know what I do wrong ?

Date Database?
The admin assistants can enter the number of hours that each employee has worked on a particular date in a particular month (hours are variable depending upon customer demand) and at the end of the month need to run off a pay slip for each employee containing the following data:

I know how to add, delete and modify the data, the only thing im not sure of is the databse structure for the dates.

What Is Indexing In Mysql And How It Will Be Useful And How We Can Retrieve Database Content Easily From A Database Table Containing About 5lakhs Datas
I need to select data from a database table containing huge amount of
data. Now I am storing data using one primary key and I am just using
simple select statement, and this process gives me the output but it is
taking long to execute the query. As much I had heared I want to use
some indexing or cluster indexing which might help me but I am not so
familiar with these things.

Inserting Date Into Database
I have a pretty simple news code that inserts the data, and then is retreaved, with a pretty simple scheme. I have a date column set at timestamp(14), and I'm trying to insert NOW() as the date. I browse with phpmyadmin and all it has is 14 zero's. PHP Code:

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:

Inserting Date In Database
I have form which allows a user to select a date as part of the form.
On submitting i am getting no update to the database and no error message.
To try and test it i created a shorter version which sets up the variables except the date.This gives the same result.ie no update. Code:

Filtering Results By DATE Value In Database
I have this code in my page for displaying some data from a database, sorted by date. i had posted a messed up version of this a while ago but I couldnt get it working even after a few suggestions. PHP Code:

What Is The Proper Date Format For A Txt Database?
I would like to know what format should be used when writing to a txt file. I am trying to search between a start date and a ending date and list any variables For example.

if (($sDate <= $jdate && $eDate >= $jdate))

then I have it list the variables it will work if searching between months and days but it does not work if I have different years. I will get all years printed out.

my date format is m/d/Y 6/13/2001

If I search for example start date = 6/01/2001 and the ending date = 6/09/2001

I will get the correct month and day dates but I also get anything from the year before and including year in the future.

Date & Time Format In Database.
I'm using MySQL database, the problem is I've setup that user input the Date format in dd/mm/yyyy (example: 14may2007) and Time (example: 12:00pm). How do I convert it to Date & Time format in database format before insert into database? Sorry, noob here.

Calculating Dates From A Date In The Database?
I`m using this format of dates:

$entry_date = strftime("%B %e, %Y %H:%M:%S", time());
And that time gets saved into the database (birth in ownedpets database):

$res = mysql_query("SELECT id, owner, pet_type, pet_name, birth, food, play, datetime FROM ownedpets WHERE id=$id");
$rows = mysql_fetch_row($res);
mysql_free_result($res);

So let`s say in this case, the database birth value ($rows[4]) is October 19 2007 20:00:00. What do I do to tell php to check to see if the current date (hours and all don`t matter) is 21 days after the $rows[4]?

Why I`m looking for this task:
For the pets system, if the pet is 21 days after it`s birth, it will be an adult. But if it is not 21 days after it`s birth, it will still be a baby.

Today's Date In Database Insertion
How do I insert today's date in a certain database row without using the date() function for a string?  For example, when you use PHPMyAdmin to insert a new table row and there's a column with the type "date", it gives you options such as CURDATE, NOW, etc.  How would I use that in a database query?

Convert Date From A Database Query
I have a simple database for events. I have a column named "date" that I would like to display as "March 8, 2007" on the webpage. What do I need to add to change the date format? Here is my php code:

Put Today's Date Into A MySQL "date" Formated Field
My MySQL table has a field that is set as type "date." I need to get
today's date, and insert it into that field. The default for that MySQL
field is 2006-00-00.

I know about the date() function. I have tried date("Y-m-d") and
date("U"), neither worked. The date field was just filed with all
zeros.

Can anybody point me in the right direction?

Inserting A Date Into A Microsoft Access 97 Database
I was wondering if anyone could help me insert a short date into microsoft access 97 using php? i can insert text no problem but i can't seem to be able to insert a date properly. i have been using

//$date = "#" . "$sqlmonth" . "1" . "$cboyear" . "#";

$strSQL = "INSERT INTO tblSupport (tDate) VALUES ($date)";
$result = odbc_exec($connect, $strSQL);

Note: i can insert a date if i hard code it like putting in #01

Insert Server Date / Time Into Database
I currently have the following to insert a variable into a database:

$zip = $db->escape($_POST['zip']);
$db->query("INSERT INTO zip SET zips = '$zip'");

I would like to also add the date & time the submission was made.

Convert User Entered Date And Time To Unix Timestamp Before Inserting To Database
How do you convert a user inputted date to a unix timestamp before
insterting it into your database? I have a form, with a textfield for
a date that the user inputs in the format mm-dd-yyyy and three dropdow
boxes for hours, minutes, and AM/PM. All of these need to be considered
together and converted to one Unix Timestamp and then inserted to the
MYSQL date field. The type of field is INT (11) so that I can instead
of the standard 0000-00-00 format of MYSQL so that I can do better
calculations and queries.

Sort Results By Date/time, Limit 5 Database Entries Of Today &/or Upcoming Days
I'm designing a website for my fraternity and in the database I have entries which contain past events, todays events, and upcoming events.  My problem is that I can not figure out how to sort the query results to display:
 
1) only past events based on the CURRENT DATE
2) only the events which fall on the CURRENT DATE or after, limiting the results to 5 entries
3) all events that fall on CURRENT DATE or afterwards

Example:   
Today is  September 15, 2007

Problem 1) Displaying all events that happened before September 15, 2007
Problem 2) Displaying only 5 results that fall on September 15, 2007 or after
Problem 3) Displaying all events that are happening on or after September 15, 2007

And obviously I would like the CURRENT DATE to change depending on what date it is, currently.

Ok so now I've been very redundant in my explanation of my problem here is the code and a link to what that particular page looks like. Code:

Copy And Paste On MySQL To MySQL Database
Would there be any issues if i literary Copy and Paste a mysql db from one server to another mysql db server? When i say "copy and paste" is just like tranferring one word doc from one pc to another pc.

I tried the copy and paste already and the new server had recognize the DB i had pasted. I just want to confirm if there would be issues doing it so.. Or should i use Mysql.com Migration toolkit?

Date Mysql Vs Php
I had a question regarding php gathering a MYSQL and then formating the date. This was answered, however, like most things in life, there was more than one way to do it.

The question now is this: What is the most optimal way of handling date formating. This might even be important for other such queries. Should PHP be used or MSQL? Is there a speed issue?

DATE, Php/MySQL...
I want the date print it like this d-m-Y how i can do this? I know that is default at MySQL (y-m-d) but i want to change it? Code:

Using Date With PHP And MySql
how do you sort a date, mysql way of storing the date seems somewhat strange, to what I learned from using access and ASP, with asp you could read in a variable in to a specific ASP and arrange its formating, I can't seem to find a way to do this with PHP date() only seems to insert the current date, is there a way or does it require a little coding?

Php And Mysql DATE
I have a mysql database and a vairable thedate of the type DATE. I search for a specific date, and when I try this: date("d-M-Y", $thedate) I get 31-Dec-1969, but $thedate is 1999-04-03. What could be the problem?

MySQL Date
i have my database and in that db there is a table. one of the columns is a date column, so the format is YYYY-MM-DD all i want is to be able to format the date when i retrive it from the DB say the db value is 2007-08-02 i want my php script to display Tuesday, 2nd August 2007.


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