Development Articles
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherDevelopment Articles

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 15th, 2002, 03:16 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.

Reply With Quote
  #2  
Old March 19th, 2002, 11:59 AM
php_guy php_guy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 2 php_guy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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! :)

Reply With Quote
  #3  
Old March 19th, 2002, 04:08 PM
eduany eduany is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Location: Boston, MA
Posts: 54 eduany User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Send a message via AIM to eduany
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/

Reply With Quote
  #4  
Old March 20th, 2002, 03:14 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:

Reply With Quote
  #5  
Old March 21st, 2002, 01:10 AM
melonfire melonfire is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 45 melonfire User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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/

Reply With Quote
  #6  
Old March 21st, 2002, 10:33 AM
php_guy php_guy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 2 php_guy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #7  
Old March 30th, 2002, 04:07 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:

Reply With Quote
  #8  
Old March 30th, 2002, 04:08 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:

Reply With Quote
  #9  
Old April 3rd, 2002, 05:36 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:

Reply With Quote
  #10  
Old April 7th, 2002, 06:11 PM
Hardzsi Hardzsi is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Budapest, Hungary
Posts: 1 Hardzsi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #11  
Old April 13th, 2002, 11:44 AM
Jamil Jamil is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 1 Jamil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!

Reply With Quote
  #12  
Old April 13th, 2002, 01:50 PM
mcapela mcapela is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Sao Paulo - Brazil
Posts: 3 mcapela User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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]

Reply With Quote
  #13  
Old May 11th, 2002, 06:24 PM
mac2 mac2 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Iceland
Posts: 13 mac2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you

I just wanna thank you for a nice article.

Reply With Quote
  #14  
Old May 30th, 2002, 04:38 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #15  
Old May 30th, 2002, 04:42 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherDevelopment Articles > Building A Quick-And-Dirty PHP/MySQL Publishing System


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |