|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How I Would Implement Delete.
When I make a script like this, I like to make the delete part different in 2 ways.<br>1 way would be to ask them if they really want to delete the post since people are prone to make mistakes and can't recover a delete post.<br>The second way is to add an additional column to the database called "visible" which is defaulted to "1" with each new post. Instead of deleting a post, the script will just change "visible" to "0" so it won't be visible instead of just deleted right off the system.
|
|
#2
|
|||
|
|||
|
date format
Instead of using a PHP function to format the date, you can do it in the SQL SELECT statement:
SELECT DATE_FORMAT(timestamp, '%m %b %Y') FROM news which would return a date formatted like 19 Mar 2002. For MySQL date format syntax see: http://www.mysql.com/doc/D/a/Date_and_time_functions.html Nice job, Icarus! :) |
|
#3
|
|||
|
|||
|
Re: How I Would Implement Delete.
to implement "delete confirmation"
use javascript "confirm()" inside [a href=] html tag. to activate it when the "delete" link is clicked on. then use "OnClick=()" then inside this use the 'config()' that wasnt a good explination so there is a link http://www.pageresource.com/jscript/jconfirm.htm
__________________
/Rod/ |
|
#4
|
|||
|
|||
|
|
|
#5
|
|||
|
|||
|
Re: date format
The problem is that if you switch to a new DB, you need to update all the SELECT statements. The way it is now, you only need update a single function
__________________
-- Articles, tutorials and more, all at http://www.melonfire.com/community/columns/trog/ |
|
#6
|
|||
|
|||
|
date format correction
the SQL statement should read:
SELECT DATE_FORMAT(timestamp,"%m %b %Y") as somename FROM news ... where "somename" is any name you want to give it whuch would be returned as $row->somename. Also, this: %m %b %Y should be surrounded by quotes in case it doesn't show up. |
|
#7
|
|||
|
|||
|
|
|
#8
|
|||
|
|||
|
|
|
#9
|
|||
|
|||
|
|
|
#10
|
|||
|
|||
|
great!
Thank you, this article helped me much to understand PHP better (eg. how to call the files each other) and also showed a nice, logic way of coding. Similar codes can be used to build up eg. a forum, or a member registration function, which 3 functions together are a must for a webpage nowadays.
|
|
#11
|
|||
|
|||
|
Excellent!
This article opened the world of PHP and MySQL to me. Of all the tutorials I have read this one was the best.
Thanks Icarus! |
|
#12
|
|||
|
|||
|
Publishing HTML with Images
Nice example Icarus !
I'm developing an application almost like this one. But, I would like to let the writers send complete HTML pages, with all that tags, and insert some images to the text. Each writer will have their own site area. They don't know HTML, neither FTP. They just need to format the basic document (like in Word, for example), save it in HTML form, and publicate it. How can I do it simple to them ? Another thing is: readers could write some comments, and befores they could be publicated, an administrator should approve them. As you can see, this application is almost like this own site (devshed.com). If you know any script that do it, please let me know. Thank you. C Ya. [Marcello Capelati] |
|
#13
|
|||
|
|||
|
Thank you
I just wanna thank you for a nice article.
|
|
#14
|
|||
|
|||
|
Re: How I Would Implement Delete.
Good idea!
Here's the code I put it, based on your examples... (in the <HEAD> section....) <SCRIPT language="JavaScript"> <!-- function confirm_delete(idval) { var verify= confirm("Do you really want to delete this?"); if (verify== true) { window.location="delete.php?id=" + idval; } } //--> </SCRIPT> ( and at the delete link......) <a href="javascript://" onclick="confirm_delete(<? echo $row->id; ?>); return false">delete</a> and it works like a charm! Thanks, Eric |
|
#15
|
|||
|
|||
|
Re: How I Would Implement Delete.
Ooops (no HTML is allowed in this forum).
Let me try again, but remove the angle brackets... LB = left bracket and RB = right bracket In the HEAD section LBSCRIPT language="JavaScript"RB LB!-- function confirm_delete(idval) { var verify= confirm("Do you really want to delete this?"); if (verify== true) { window.location="delete.php?id=" + idval; } } //--> LB/SCRIPTRB and at the delete link.... LBa href="javascript://" onclick="confirm_delete(LB? echo $row->id; ?RB); return false"RBdeleteLB/aRB |
![]() |
| Viewing: Dev Shed Forums > Other > Development Articles > Building A Quick-And-Dirty PHP/MySQL Publishing System |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|