View Full Version : please help me solve a problem with editing mysql data

02-05-2007, 03:09 AM
i have a problem and hope the experts here may help.
i have a directory and it provides the titles and descriptions of the sites included in it. all the data is stored in a mysql database and i use php script to work my directory.

i am able to edit the titles and desciptions through phpmyadmin.
and i also want my visitors to be able to edit these titles and descriptions.

but the problem is i want to approve the editing before it actually updates the data in mysql.

when visitors edit the data, i think there are two possibilities
1) modifications should be emailed to me and after i approve them, it should update the mysql database. i know how to send these modifications to my email box. but dont know how to update mysql database from that email box.

2) modifications should be sent to my admin panel where i may approve them. but the problem is, i dont have an admin panel and dont know how to set up an admin panel.

for example this is my table:

$query = "CREATE TABLE sites (
id int(11) NOT NULL auto_increment,
title varchar(70) default NULL,
description text

please inform me how to make this possible.
if this is a big process, please point me some tutorials.
thank you very much for any reply.

02-05-2007, 04:20 AM
add the data to the table as soon as it is submitted. create a column called LIVE or some such. Set it to default at 0. When the rows are entered this value gets automatically set to 0. Until you set it to 1 it doesn't update.

when the form is submitted it will send you an email reminder.

02-05-2007, 04:27 AM
hello guelphdad
thank you very much for your reply.
but i am new to php and mysql and i feel it is difficult to implement your instructions.
please elaborate.
i think it may be easy to implement it once i can look at some example.
can you please give some example or point me to some example?

thank you very much for this help.

02-05-2007, 12:40 PM
Shouldn't that look like this??

CREATE TABLE`sites` (id int(11) NOT NULL auto_increment primary key, title varchar(70) default NULL, description text);

Anyway he's saying add a column named "live".

alter table `directory`.`sites` ,add column `live` boolean DEFAULT '0' NOT NULL after `description`

Have your users enter the data in the database. When they enter their data let the 'live' data take the default value you defined (0). In your PHP code, simply use a conditional statement that decides whether or not to display the updated title title according to the value in your 'live column'. If live is set to 1 show updated text. If its not, then do not. I'm also assuming he was suggesting that when a user submits a form you email yourself a notification.
Then run a update query to set the live column to 1.

02-05-2007, 02:18 PM
Exactly, thanks for clarifying.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum