Dates In Database + Retrieving
What is the best way to store dates into database so the data can be retrieved later on.
For example: I use this to get the date and i store it.
<?php
$date = date('d/m/y');
?>
However, if i wanted it to say '20 March 2007' would this be easy or is there a better way to store them.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Retrieving Database
User choose on ID and submit. I use the URL query method to get the ID and rest of the profile like first_name, last_name, I tried something like this $query = "SELECT * FROM user where user_id= $ID"; echo $_get['first_name']; but it doesnt show, how come?
Problems With Retrieving Url From Database
I am having problems with retreiving the url of the avatar that the user chose, which is stored in a database, and then diplaying it as an image. I have no prob's with the query:
Retrieving Values From The Database
I am retrieving a value from the database and I insert the value as a value of a field The problem is that when the value has spaces then in the filed is viewed only the part of the value before the first space. If the value is not includes any spaces then the value appears in the field correct.
Retrieving Info From A Database
I would like the code below to fetch and display in an html table the Ad_Id, Date, and Type_Job fields from the 1st 10 rows of a table called employment. I'd like the results to be sorted first by date and then by the Ad_Id #. I have replaced my username and password with "user" and "password". Currently, the script returns the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Also, the script is ignoring the css info that I have supplied. Code:
Problem Retrieving Results From Database
I'm trying to retrieve fields from my database with following mysql statement: $query = SELECT g_games.Title FROM g_collections, g_personal_reviews, g_games WHERE (g_games.ID=g_personal_reviews.G_ID AND g_collections.U_ID = '" . $data1['ID'] . "' AND g_personal_reviews.C_ID = '" . $data2['ID'] . "' ) "; $resultset = mysql_query($query); $data = mysql_fetch_array($resultset); 3 Rows in my database comply with the above statement... though I only get 1 to show up on my php page? How can I show all of them? This is the php code I'm using to write the results: while ($data= mysql_fetch_array($resultset)) { echo $data[Title]." "; } My tables are as followed: g_games g_collections g_personal_reviews > this table connects all others with G_ID ("game ID"), C_ID ("Collection_ID"), U_ID ("User ID)... users
Retrieving PDF/MSWord Files From Database
I am able to upload .pdf and .doc files into the MySQL database (using Medium Blob) but I can't retrieve or download them back. Can you help me download them? What I did was the following pages (downloadpage.php and downloader.php):
Retrieving (Data + Fieldnames) From Database To Array?
I'd like to poll a database and get the table contents, as well as the field names from that table. I've been to php.net but this time I cannot find something helpful. I can get the data, and retrieve it into an array noproblem. [1] I can get the data+fieldnames and put it into a list. [2] But I cannot seem to be able to fill an array with the data *and* the fieldnames. If you check both chunks of code, you will se what I'm doing....
Retrieving Database Info Based On User
I'm still quite new to php and mysql but I have been unable to figure this out. I'm attempting to display a specific row and column from a mysql database based on the user. $result = mysql_query("SELECT fbleague FROM users WHERE username = $_SESSION[username]"); fbleague is the column users is the table username is the primary key column $_SESSION[username] is the username variable Then later I try to display it with echo "You are in league $result "; I know $_SESSION[username] is set correctly because I can display that with no problems.
Formatting Dates Taken From Database
<?php echo $_SESSION['MY_date'] ?> This is line of code that gets a date from a session variable. The session variable, MY_date, comes from a database DATE field. The output is like this: 2007-01-01. What I want the output to look like is this: January 1, 2007. How do I do that? or what changes are needed in the above code?
Format Dates In A Database...
what is the best or easiest format for storing dates in a mysql database? I'm wanting to store a lot of things with a date value and want it to be as easy as possible to read the date from it... I've had problems with getting dates in the past because of how I stupidly stored them. I was thinking of simply having day/month/year e.g: 22/05/1988or should I use a unix timestamp?
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.
How Do I Display All Database Entries Between Two Dates
I have two dates in a form " startdate" and enddate" when i display the results i would like to show all results between, and including the two dates. how do i do this... this is my current query: My Variables: $userid = $_GET['idr']; $fromdate = $_GET['fromdate']; $todate = $_GET['todate']; The query: $result = mysql_query("SELECT date, status, time, notes FROM timeclock WHERE userid='".$userid."' ORDER BY time");
Get Dates Between Two Dates, Then Add To Table
I've got a form that inserts data into a database. Basically what it sends is a sets of dates. What I'm wanting is another set of inputs that also sends some dates. But before it adds them to the database I want to query the dates and find all of the dates between the two given ones and add them to the database as well. Code:
Retrieving HTML
I was working on php script that could pull content from another site, and post it on mine. Some of the HTML from the site is not needed and I would like to remove it. How would I remove some of the HTML but keep that part that I need?
Retrieving NT User ID
Does anyone know how to retrieve the NT user id that someone is logged in as? System is running IIS. Have tried HTTP_AUTHENTICATION but that doesnt appear to work under MS - unless someone knows a works around. Alternatively - how can I retrieve a UNC pathname for a specific drive mapping.
Retrieving Records With Between
I am trying to convert my asp website to php. So far so good, but I am having a problem with my SQL Statement that needs to us the Between. Here is what I am using: $sql = "Select * From tblTrack Where DateEntered Between $start and $end"; the vars start and end come from the same form. I don't have a problem when I hard code the dates, but when I use the variables, it won't retrieve anything.
Retrieving URL's
I'm assembling a search spider, and codes from other search scripts look way to hard to understand, so I'm assembling one right now. My question is, could someone show me a very brief example, of how to get all the URLS into an array. Then I just use for() or foreach(), but then I need to know the function to get the file size in kb. How would you do that if you were to use a directory?
Retrieving Full Url?
Is there any way to pull from a variable of some sort the full address in the browser. Including any get variables currently there?... I ask because I have a number of different things, filters and such that should be compounded on each other. example. user has selected to filter a page by some field, user name or whatever depending on the data, then they choose to delete a record... etc. there are many uses i see, very possible with a lot of tweaking, but i thought there might be an easier way.
Retrieving InnerXML In PHP DOM
I'm trying to return the inner XML from a DOM element, but I can't find any methods that allow this. For example, if I have a string: <TEXT>Here is a string with <B>bold</B> text in it</TEXT> then I want to return the enclosed string _including_ the <B> tags: "Here is a string with <B>bold</B> text in it" Using get_content strips out the tags. "Here is a string with bold text in it"
Retrieving A Zip File
I'm doing a sort of download center. Where the user fills out their details and then chooses the program they would like to download and the information is then entered ito a log file. So all this information is fed into a send.php file. What I'm looking is for the send to go to a thank you page and get the file that the user has requested. Code:
Retrieving Information From URL
I want to make it easier for a user to get to a comment on my page and to be able to go directly to that comment when it is typed into the URL. For example, instead of this: http://www.mysite.com/comments.php?id=1 I want them to be able to do this: http://www.mysite.com/1 I am just wondering how to retrieve the "1" from the url instead of having to type id=1 and store it into a variable. I know that the second one is pointing to my homepage instead of comments.php, and thats fine. I am just going to redirect to the other page or include the other page after I retrieve the "1".
Retrieving Max Numeric Value.
I can't see anything wrong with this code at all. Trying to retreive the last(highest) id from the text_id column which is auto-increment and primary key. The conncetion to the DB is fine and working. It appears that the result isn't being drawn though... any ideas? Code:
Retrieving Field From Mysql With Php
I want to select as in the code, an email matching a username, and after I want to make a variable called $email_a to send to this user an email. What is the way to retrieve the email address from the database and insert it into the variable? $query = "SELECT email from users WHERE username = '$username'"; mysql_select_db($db_name); $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
Retrieving Cookies (Opera)
I have a script which sets a cookie which is a history of Mysql queries a person has tried. My problem is that when I run a query 'show tables' when I retrieve that value from a cookie it is stored as 'show=' instead of 'show tables'. This only happens in Opera. Everything is fine in IE and Netscape.The script is in Python but I am hoping someone using PHP has had a similar problem.
Retrieving The CLient IP With Php4.2
I am runing php 4.2 on an apache server. I'v tried several things in order to get the ip address of my visitors, the problem is none of them work. I'v looked over the phpinfo() output several times and found nothing that would provide me with that info also I tried several examples using getenv() and none of them seemed to work. I remeber doing this easily with older versions of php. What changed?
Retrieving NT Logon Name For PHP Authentication
I am in the process of developing an web-based helpdesk system for our Intranet, I would like it if the user did not have to logon to the helpdesk system, but was automatically logged in using the username they logged onto the network with. I'm pretty sure this is possible with PHP, but just haven't discovered how for our setup. Running Apache w/PHP (not our NT server), users use both Win95 and 2k.
Retrieving Hyperlinks From Access
does anybody know a simple way of retrieving a hyperlink from an acces table. After retiving the data array with odbc_fetch_into()the hyperlink is returned as "hyperlink name#..path of document#. maybe sombody has already solved the problem and can save me hours of programing.
Retrieving An Image If Condition Not Met
I'm sure the answer is simple, but the solution is eluding me-I'm not too good at the particulars of scripting. Maybe someone can point me on the right path... Here is the problem: I have a string of php code that retrieves an image, in this case, an image of a book cover from Amazon.com. This works perfectly well, unless, there isn't an image of the book on Amazon's server. When there's no image, a blank hole appears on the final page. What I would like to happen is, if the variable for the image isn't met (i.e. no book cover image), a "No Image" image, from my server, will load in its place. Here is the code that retrieves the image: <img border="0" src=<? echo $i['ImageUrlSmall'];?>> Is there a way to include a command that will retrieve an image from http://www.mysite.com/images/noimage.gif if the first condition is not met?
Retrieving Form Data.
I have two scripts - common.php and edit.php. The working is that common.php contains a form that is used initially for registration and later used again so that registered users can edit their information. edit.php contains the connection to the db to update the form with the current users information. PHP Code:
Retrieving An Object From An Array
I have an array of objects, and I would like to retreive one of the objects based on a given key and value (ie. name='john'). Is this possible and if so what is the syntax?
Retrieving Data From Session Id??
This is what I have done: on Page A: <a href="<?php echo 'pageB.php?item=docs&sSID='.session_id(); ?>">Docs</a> on PageB: <?php if ($sSID) { echo $_SESSION['username']; // THIS IS WHAT I WANT TO READ HERE switch($_REQUEST['item']) { case "docs": echo "doc files"; break; case "reqdocs": echo "other files"; break; case "misc": echo "miscellaneous files"; break; default: echo "Invalid query"; break; } } ?> As you can see on PageB, I tried to read the value of $_SESSION['username'] but it gives nothing. The session file is correctly created in my /tmp folder with the username field containing valid data.
Storing/Retrieving/Executing Php
I want to creating an application where all my php(with html) is stored in the database. So my index.php would find the appropriate the php file associated with the index page. It should execute this new code as part of the original index.php. Can you please let me know if it is doable?
Retrieving Flash Info In PHP
Does anyone know how to retrieve Flash info in PHP? Meaning, I need a script to extract the framerate of a SWF file. Is this possible? How to read flash file's headers, as framerate is probably in the header?
Saving/Retrieving PHP Object
I need to find a way on how to save a session and an object obtained in file1.php and use the session and object information in file2.php. I cannot create a class and then instantiante it in file2.php because I am sending a SOAP request and with it I am getting that session and object information. There are subsequent other SOAP API functions that I need to call using session and object information obtained in file1.php so: Code:
Retrieving Letters From A String
If I have read in a file, which I then convert into a string (say "string1"), how do I make a loop that goes through the string, makes all the letters capitals and writes all the LETTERS (not spaces, periods etc) into a new string ("string2")?
Retrieving Filenames From A Folder
Is it possible to have php retrieve all the filenames in a folder and store the filenames in an array or something, so i could then store those in the database? If there is a way to do this, could I get an example on how to achieve it?
Retrieving Credit Report
Does anyone know how I can code a credit report retrieval page? I am a mortgage professional and am looking to request credit on the site instead of in the loan software.
Retrieving Connected Clients IPs
I am developing a website in PHP and MySQL as a backend. Poeple has to login to avail of the services. I am storing the users ID along with IP addresses who have logged in. And deleting the entry when the user clicks signout. At a certain page I want to check whether the people who have logged in are still online or not. If they clicks signout the entry is deleted from the database and I will get accurate data. But incase the user does not clicks signout and just closes the page, then the web page will be showing the user as online while actually he is offline. Is there any way to retrieve the IP addresses of the users who are connected to the site(browsing the site) dynamically.? Or any other solution to handle this situation..
Retrieving Cookies With Php Same As In Java
Is it possible to pull the cookies of a viewers browser when you are using a php script to track them on your site and return the info to a stats page, just as it would be done using javascript? If it sounds like I don't know what I am talking about, it's because I don't. I am a novice at best. I am running a stats script on my server and using it to track the stats of individuals that view my site page that I have the code snippet on that returns the info back to my stats page. I have done this my embedding the url to the .swf file that pulls that stats in my sites page. Well, it's not an actual .swf file. I have the .htaccess file set like this RewriteEngine on RewriteRule image.swf image.phpand inside the image.php file is this <?PHP $lvc_include_dir = 'include/'; include($lvc_include_dir.'new-visitor.inc.php3'); ?> I am wondering if it is possible to retrieve the cookies as well using php scripting... Either the cookies of my site or of another site that are saved to the viewers computer.
Retrieving Simple Data
Im wondering if someone can point me in the right direction. My Table id item_id pet_id game 58 30892 37359 1 57 30986 37329 1 56 30977 37329 1 55 31213 37329 1 What its used for: It keeps a record of who has read what books. What I would like to do is create a high scores (top 100) list where the person (pet) who has read the most is displayed. My problem is, I cant work out how to make it grab the data and count how many entries there are for each pet_id and then display that. What should I be searching for in the tutorials etc?
Retrieving Hyperlink Parameter Values In PHP
I have a PHP program that creates a page with several links all to the same URL but with different parameter values in the hyperlink e.g. <a href="FILENAME.php?VARIABLE=123">Click Here</a>. How do I retrieve the value of VARIABLE (=123) in file FILENAME.php?
Retrieving A Lost MD5'd Password
I mean, the pass gets md5'd and stored in a database. you cant un-md5 something. so how would vbulleting retrieve your lost pass? it uses if $pass == md5($pass); correct? and there is no way to un md5 somehting. so how the hell does Vbulletin retrieve it? if its md5'd and stored in the database. and when u retrieve it u get the pass that u entered like "cheese" or something of that sort.
Retrieving Variables From Included File
I'm trying to use a variable created in a file I'm including from within a PHP script: include("http://www.domain.com/script.php"); echo $variable; // $variable still empty? The $variable is created inside script.php but is empty when I echo it from the calling script. Is it the way I'm including the script via http? I have to do this since it's on another server.
Retrieving An Attachment From A Piped Mail
Here's the deal : I get from a coworker some mails with a ZIP file attached. I've created an email aliases that resends the mail to a program using the smrsh mechanism. My problem is that I'd like to extract the ZIP file from the mail with this prog, but I don't find out how to do this. read somthing about the RFC 2054, but doesn't help much more...
|