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.





How To Edit/update Timestamp?


I have tried the sql query below but it didnt work:

mysql_query("UPDATE `php_blog` SET `timecode` = '".mktime (0,0,0,10,31,2006)."' WHERE `id`='1'");

The browser returned:
QuoteCan't modify the column 'timestamp' to the table 'php_blog' in the database.

Query was empty
I am trying to change the timestamp manually.




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Edit/Update Db
I'm a complete newb and im not sure how I should go about the following: Retrieve data set from the db and display in a table - Easy enough Allow user to edit fields in table based on user credentials Update DB with contents of table The bit that im finding tricky is the editing of the table data and how to get this to my page to form the SQL statements.

View Replies !   View Related
Edit/update - All In One PHP Pages?
Let me explain how I'd generally do things. For a page where the user
edits data, I'd generally call it something like editfred.php (for
example), the page which updates the data would be called
updatefred.php and equally the page which processes a delete would be
deletefred.php. I like splitting the pages up this way, it feels less
cluttered and more organised than throwing all the functionality in one
fred.php.

Here's the problem though. If the user enters erroneous data into the
form editfred.php which is subsequently processed by updatefred.php
then that error needs to be reported to the user. Traditionally what
I've done is have updatefred.php list any errors it finds and then
provide a link to go back or ask the user to hit the back button on
their browser. This is no longer viable, instead I'd like to
automatically throw them back to editfred.php with all their data
already filled in and the fields causing errors to be highlighted. My
question is: what's the best way to do this?

There springs to mind several ways:

1) combine editfred.php and updatefred.php. Again, I'm not keen on this
but it does seem the most logical and programatically easiest.

2) use sessions to store the data, editfred.php would then check
for data in the session each time it's loaded. Is there a maximum data
size for use with session objects?

3) write code to wrap and store the data in a cookie which could then
be read by editfred.php, similar to sessions I believe. However max
cookie size is 4Kb which wouldn't be enough on some forms.

4) store the data from editfred.php in a table in the database which
again editfred.php would check for when loaded. overhead of db access
each time however.

View Replies !   View Related
Update TIMESTAMP
How do I do to update my TIMESTAMP field?

View Replies !   View Related
How Can I Retrieve, Edit, And Update Text?
I'm trying to retrieve a text value from a MySQL database, put it into
an updateable form, allow edits, and send back the edited text back
into the MySQL database. I've been able to successfully retrieve the
text and put it into the editable form, using htmlspecialchars
function. But, I can't find a way of accepting the edited text and
sending back to the database.

Here's my code for retrieval.

<?php

@ $db = mysql_connect('localhost', '<database>', '<password>');
if (!$db)
{
echo "Error: Could not connect to database. Please try again
later.";
exit;
}
mysql_select_db("<database>");

$query = "select * from albert where ".$searchtype." like
'%".$searchterm."%'";

$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
$title = $row['title'];
$teaching = $row['teaching'];
$teaching = wordwrap($teaching, 60, "
", 1);
$teachnum = $row['teachnum'];
}
if ($result)
{

echo '<textarea name="newteachnum" rows="1" cols="4"
wrap="off">'
echo htmlspecialchars($teachnum)."
";
echo '</textarea>'
echo '<textarea name="newtitle" rows="1" cols="60"
wrap="off">'
echo htmlspecialchars($title)."
";
echo '</textarea>'
echo '<textarea name="newteaching" rows="20" cols="80"
wrap="on">'
echo htmlspecialchars($teaching)."
";
echo '</textarea>'


}
?>
<form action="teach_update.php" method="post">
<input type=submit value="Submit">
</form>

Here's the code to update the database.

<?php

@ $db = mysql_connect('localhost', '<database>', '<password>');
if (!$db)
{
echo "Error: Could not connect to database. Please try again
later.";
exit;
}
mysql_select_db("<database>");

$newtitle = addslashes($newtitle);
$newteaching = addslashes($newteaching);
$newteachnum = addslashes($newteachnum);

$query = "update albert set title =". $newtitle . " and teaching =
". $newteaching . " where teachnum =" . $newteachnum ;

print $query; //the print shows nulls for $newtitle, $newteaching,
and $newteachnum. It seems like those values are not being held in
memory from the calling program teach_edit.php

//$result = mysql_query($query) or die("Could not update!");

// if ($result)
// {
// echo mysql_affected_rows()." text item updated into
database.";
// }
?>

View Replies !   View Related
Simply Edit And Update Script
Can anyone provide a simple edit/update script. I have only one field that requires updating and the structure is as follows:

user_id = username
User_password = password
url = redirection url

I would like to have th option to edit these three fields and I have tried everything. Can anyone help with a simple script?

View Replies !   View Related
Database Update/edit And Delete
i have spent the last few days trying to create a simple script to add/edit and delete entries in a mysql database with php. i have 1 database with 40 tables, each table has 3 fields (id, header and body)

i created an input page with input fields for header and body. the table to store the information in is selected from a drop down menu. all this works fine.

for some reason i cannot get the edit and delete page top work at all. would someone mind taking a look at the code and let me know what i am doing wrong? Code:

View Replies !   View Related
Edit Page To Update Tables
Ok i have 2 pages here.. An edit page and a send edit page. Problem i'm having is when i hit adjust(submit) the values goto the next page but do not update the database tables that i have I think it's my update code that I'm using.. but i'll post both pages Code:

View Replies !   View Related
UPDATE Timestamp OR Datetime?
When i'm grabbing a row from my database and then trying to UPDATE those details it's not updating and I don't see why:

DB Structure
story_id (int 1)
published_web_date_time (timestamp / datetime 0000-00-00 00:00:00)

Now in the structure above i've tried both published_web_date_time as both a timestamp and datetime field as I was told you can't update a timestamp field in MYSQL using PHP, which I thought was wierd?  But nomatter what I change published_web_date_time to field wise it still does not update.

If you look at my form below when I GET the data I get the published_web_date_time split into two textfields as shown in the form below, but when it comes to updating these textfields with new values it does not save the data to the database upon sumbit? Code:

View Replies !   View Related
Timestamp Field Update
I have 2 timestamp fields in a table. recieved, and resolved. I have problems catching the resolved time with this code: Excuse the messy HTML Code:

View Replies !   View Related
Unix Timestamp Update
I'm creating login using PHP/MySQL. I have Unix Timestamp (eg.1005882301). What will be the easiest way to update this filed to current date/time everytime when user log in? Should I rather use some other mysql date/time field type?

View Replies !   View Related
Timestamp Comparison With Java.util.Date.getTime() Timestamp
I am forced to have to compare the value of some PHP timestamp with a
Java-based java.util.Date.getTime() timestamp. Let me show you how
they look:

View Replies !   View Related
Converting An SQL TIMESTAMP Into Unix Timestamp
I look over the docs on MySQL, and I'm assuming MS SQL will be quite similar. I am trying to decide how best to pull this off. I am anticipating a need to take the typical SQL TIMESTAMP and convert it to an Unix Timestamp...

Now, as I look at this a TIMESTAMP stores namely a "numerical" format in a 14 Digit String. I'm just wondering if anyone has a suggestion as to how I might split this into the componenets (4d Year/3d Month/2d Day/HH MM SS) so that it could be passed through mktime() (which will give me the unix version).

Actually, I think I may have an approach.. perhaps using the php substr() function..
since it returns a "defined" portion of a string.. if $x was our timestamp, we'd have to pass it through the substr() function a few times, to pull out the pieces we wanted.

View Replies !   View Related
Update Query - Way To Update All Records That Meet Only A Part Of Field
I know that if you use the following code..

UPDATE
table
SET
field = ""
WHERE
field1 = ""

than it will change `field` in all records that meet the criteria of field1. What I need to know is there a way to update all records that meet only a part of field1

ie...

UPDATE
table
SET
field = "yummy"
WHERE
field1 = "apples|oranges"

if field one contains apples|oranges|grapes

it would still pick up that record.

View Replies !   View Related
Update A Record On The Db It Update ALL The Records
When iam trying to update a record on the db it update ALL the records their, i don't know where is the erorr ! Here is the action file.

$select="UPDATE dir_all SET wbname='$sitename', wbdisc='$sitedisc', wblink='$sitelink' WHERE id='$id'";
mysql_query($select) or die($select);
?>

View Replies !   View Related
Update Query - How Do You Update A Value In The Database In A Certain Row?
I am trying to make a little thing that allows you to edit something that you have previously submitted to be in the database. How do you update a value in the database in a certain row?  Right now when I run my script, it submits the updated info into into every row in the database.  How do I just make it so it inserts it into row x? (x being some random number that I will have passed to it).

View Replies !   View Related
Db Update And Real Time Update
i wanted to put together my first pages using prototype but i'm kinda stuck. situation:

i got a list of pages in the backoffice. in the list you got pagenames, id's, editors and if they're active or not. the active part part is represented by an in/active image.

now instead of having to edit the page and change a checkbox to toggle the active status of the page, i was planning to make it able to click on the image in the list itself to toggle the status of the page. thus updating the db when you clicked and refresh the list using ajax. Code:

View Replies !   View Related
Update Query - Update All Tables Field Value To "0"
i wanted to update all my tables field value to "0", but the problem is i got 20 fields

the usual way "update table1 set field1=0,field2=0,field3=0....field20=0 where id='my_id'";

is there a way to update all fields without specifying the fields to update?

View Replies !   View Related
Mysql_query("UPDATE `sections` SET Section1='$update'");
Why won't this mysql_query thing update what's in my database? BTW there is currently nothing in any field: PHP Code:

include "db_connect.php";
$update = $_POST['section1'];
mysql_query("UPDATE `sections` SET section1='$update'");

View Replies !   View Related
EDIT CSS
i need a script that will allow my to edit the css file through a website. Like without going through the cPanle I could just click a link throught the site and it will allow me to edit it.

View Replies !   View Related
PHP Edit Itself?
Can a PHP script edit itself? And if so would it be faster to store/retrieve information this way instead of using a database? Or would it be slower?

View Replies !   View Related
Hex Edit
If you open up a .doc file in a hex editor, you can change the values of the text without corrupting the document. How could I mimic how a hex editor reads and edits a file in php?

View Replies !   View Related
Edit/replace?
How would I edit or replace a field of a row in my database?

View Replies !   View Related
Edit MySQL Using PHP
I know that I need to include a textbox and everything, but dont know how. In my database I would like to be able to edit it from my website that has a textbox and a button that allows it to change a field in the database and replace it with the text in the box.

View Replies !   View Related
Trying To Edit A Txt File
Hi I am trying to edit a text file... the format of which is like

#####abc.conf
poll somethin
proto pop3
via 127.9.02.1
user "me@me.com"
pass "dell"
is me.nutcase
preconnect "abc abc abc abc"
##
poll ak #
proto pop3
via 11.11.22.33
user "ak@bk.com"
pass "eatme"
is nutter
fetchall
preconnect "abs -e -f -f /ss/ss/ "
##

The way i am tryin to edit this file is ....

<?php
$file = "/som/thing/abc.conf"
$dele = "poll ak";
$open = fopen($file, "r+w");
$read = fread($open, filesize($file));
$sep1 = explode($dele, $read);
$sep2 = explode('##', $sep1[1]);

$read = str_replace(array($dele, $sep2[0]), array("", "
"), $read);
fseek($open, 0);
fwrite($open, $read);
fclose($open);

The result of what happens is it delete the tag from poll ak till the ##

but also adds some text at file end like ....

Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2Resource id #2Resource id #2Resource id
#2Resource id #2Resource id #2defaults
via 11.11.22.33
user "ak@bk.com"
pass "eatme"
is nutter
fetchall
preconnect "abs -e -f -f /ss/ss/ "

View Replies !   View Related
Edit Profile
I would like the user to edit their own profile. But how can I retrieve the data in the form to perform update, instead of display as the code below? PHP Code:

View Replies !   View Related
Read And Edit Xml With PHP
I'm trying to write some php that will read in some xml and then allow me to modify the tag and write back out to xml.

In the following example, I want to read in 'text_for_paragraph_1',
then allow it to be viewed, edited, and saved back to the xml... I
have absolutely no clue even where to start...

View Replies !   View Related
Php Edit Xml File
I have an xml file that looks roughly like this:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<videos>
<video url="new.flv" desc="Guitar Solo" />
</videos>

what i want to be able to do is add more entries like "<video url="new.flv" desc="Guitar Solo" />". How can I get it to add the entry into the right place, so it doesnt show up after the </videos>?

View Replies !   View Related
Video Edit
It is possible to upload your own video and then mix it the way you want. Is there available a php library for modifying flv videos to mix them and add effects just like in eyespot. I know for flvtool 2 but i am not sure it will do the thing and i couldnt find any documentation for it.

View Replies !   View Related
Allow To Edit Within X Hours
I have data that is inserted into a database, one of the fields is named 'time_stamp' and is a "datetime; 0000-00-00 00:00:00" type.

I was wondering how one could make an if statement that will show code (code is just the editing portion of the page) if the 'time_stamp' is less than the 'time_stamp' + 72 hours. Other wise, don't show the code and inform them that they can no longer edit.

View Replies !   View Related
Edit Regarding Check Box?
I am trying to write a little script that when the user chooses to edit there ad on the site, it will display a list of there images as thumbnails. They then check a box for the images they want to keep. Is this the correct syntax? Code:

View Replies !   View Related
Edit Php To Html
I have a website on a cd and is in php format.How do i change from php to html?Or what program should i use so i can publish the website.

View Replies !   View Related
Dynamically Edit SQL
I would like to have my results of an SQL query populate a tabel, which i have already set up and is functioning well. However now i would like to have another page, where the informatino is editable. What do you guys think the best way to set up a table that a user can edit the information in a SQL database without entering PHPmyAdmin?

View Replies !   View Related
Edit Entries
I have a database which only has 4 fields in it. I want to be able to view all of the rows and then select one of the entries so I can update, correct any typing errors in the row. My database table is called entries and the 4 fields are id, date, title and entry. I only need to display the title and entry fields for each record.

I can then browse through the entries and check if there are any errors in the text, if there is i want to be able to amend he errors and have it in the database correct. point me in the direction of a tutorial which shows how to acheive this or show me some code on how to do it. I know how to connect to a database so its just the edit/amend bits i need to know.

View Replies !   View Related
Edit Source
i want to click a link for and example link edit. then i want it to make me login after i have logged in i want to be able to edit the source of the page that i clicked edit on then upload my edited source code.

View Replies !   View Related
Cant Edit Rows
I exported my database from mysql4 and imported it into mysql5 using phpmyadmin. My php pages worked and displayed all the data ok. However, I can add new rows but if I try to edit a row, the row ends up being empty.

View Replies !   View Related
Trying To Edit Column
I have an ID column at the beginning of my table. I want to edit it so that it's auto_increment and can support numbers up to 5 characters. The code phpMyAdmin tried to execute. SQL query:

ALTER TABLE `books` CHANGE `id` `id` INT( 11 ) NOT NULL DEFAULT &#391;' AUTO_INCREMENT

MySQL said: Documentation
#1067 - Invalid default value for 'id'

So I set the default value to 0 but I again get the same error.

View Replies !   View Related
Edit Code
How do I edit the code at the following URL, so that it contains no functions, displays a code 39 barcode only, with a fixed width and height, displays as jpeg format only, and displays at 100% quality only?

View Replies !   View Related
Edit String
If I have a word that is all capital like: TEXT. Is there a way to convert this to: Text

Basically I'm trying to leave the first letter capitalized and then lower case the rest of the word. Sometimes the string maybe: NEW TEXT. I would then want to convert that to: New Text. Anyway to do this dynamically?

View Replies !   View Related
Edit String Through Php
Is it possible, to have a input box, and the number that you have inputed, would change a certain number in another .php file?

View Replies !   View Related
Edit XML File
I have a FLASH Player that plays MP3 files on a webpage. The MP3 FLASH Player uses an playlist.xml to get it necessary information about name, title and .mp3 file location.
In order to add, remove or edit my playlist, I need to download the playlist.xml file, edit it in a notepad application and than upload it again (together with the .mp3 files of course).

How do I create a PHP script that reads the file and publishes it so that I can edit it or add tracks using for example forms. Anyone who has a great script or know where to get one or perhaps knows a great "walkthrough"?

View Replies !   View Related
Edit Browser
I would use PhpBuilder but I'm new with it, and I would know if there is a browser in the debugger showing the page like on the net.

For example I build a form and I would debug them. I launch it and a window appears with the form like on the net I have put a breakpoint after the submit button, I fill the form and click it and th debugger go to the code and I can see mine variables. Then I click continues and the page reappears like on the net.

View Replies !   View Related
Edit Selection
I have a form that includes a dropdown menu that allows a user to pick and then is sent to mysql db table. I would like to be able to let the user go back and edit the info. I can echo back the choice the user made but how do you let the user choose again from the dropdown menu.

View Replies !   View Related
Edit Entry
I've accomplished half of what I want to do. I have an 'edit' link on blog entries and writing pieces for my upcoming site, and clicking it brings up the piece within a form so I can make changes. Now the only trouble is processing the form and having PHP and MySQL make the changes.

I'm having trouble figuring out exactly how to replace or overwrite an entire string. I came across the Locate command, but I was under the impression it was useful to search for text to replace, not necessarily (or efficient) for replacing an entire string. Also, does the fopen command work with MySQL queries?

View Replies !   View Related
Edit An Array
I have an array that is all the files in a directory.

<?php
$dir = "../images/galleries/";
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
sort($files);
print_r($files);
?>

How would I -Strip off the . and the .. at the begining -Make it so that I can turn each one of them into a different link I used to be great at this stuff, but its been awhile.

View Replies !   View Related
Edit Form
I have a php form that displays information from a database based on a mysql query. Four of the form fields are images that are stored both in the db and in a folder on the host.

What I want to do is to be able to update the images in each of these field, for example, click an update button that allows you to reselect a new image when submitted this would delete the original image and replace with the new. I know how to unlink the file to remove the images but cannot find a way to do what I need.

View Replies !   View Related
Edit Page
ok so I have a resutls page with records displayed from a search. Next to each record is an edit icon. Here is the code:

View Replies !   View Related
Edit News
I personally think it's just my POST data acting up, but I don't know. The news is all held in a text database located at www.purplenum.com/database/news.txt. The Add News page in the Admin CP works perfectly fine, and is password locked with a non-debug password (You'll soon see why I say this). The Edit News page has a debug password of well, password. Here is the source for all of the enter the password, submit it, and you'll see what the problem is.

The above files are all of the source files for the pages, maybe someone can see something wrong with it because I have no clue what is wrong. The reason I have a seperate auth page is because when I used auth on the top of my edit_news_post.php page it ALWAYS returned with an incorrect password. So I think this problem I'm having now is the result of a POST data problem.

View Replies !   View Related
Edit Message
Once my user has logged in I would like a welcome message to be displayed once the Admin has set this up. At the moment if the user logs in and there is no welcome message set by the Admin there is a message displayed "No welcome message set yet".

However I need a button which is only available to Admins to create a message if there isnt one or edit the message if they would like to change something.

I have created the code so that if the user logged in is Admin they will see the option Edit Update (this is just text at the moment, no link) Code:

View Replies !   View Related
Is .txt The Only Way To Edit Files?
When it has extension .php on my computer and I open it it goes to an apache prompt where I cannot type anything else in. When I change it to .txt it allows me to modify the code. Is this the only way I can modify .php coding?

View Replies !   View Related
Edit Record
What is the best way to edit a record in my PHP without passing the $id in the url. I have a multi user database and i dont want one user to be able to change the $id in the url so they can access records that do not belong to them.

View Replies !   View Related
PHP To Edit Files
I'm looking at creating a website that basically saves times and dates and emails specific people (all taken from a mysql database) when times have passed. I suppose something like a birthday reminder site, but not quite. All I'd like to know is: Is this possible and how much of an undertaking is it to get the emails out at specific times, instead of run as a batch at fixed times from a linux cron script.

View Replies !   View Related
Edit Submission
I want to make an edit submission page, so I did the following, for editsub.php: Code:

<?php
if ($_SESSION['username']){

$sql=mysql_query("SELECT * FROM `portal` ORDER BY id DESC LIMIT 0 , 200 ") or die(mysql_error());
while ($row=mysql_fetch_array($sql)){
$i++;
$id=$row['id']; //Id
$title=stripslashes($row['title']); //Title
$author=stripslashes($row['user']); //Username
$small_image=stripslashes($row['small_image']); //Small icon to go with the submission
........

View Replies !   View Related

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