Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder student's Avatar
    Join Date
    Jan 2007
    Posts
    129
    Thanks
    13
    Thanked 0 Times in 0 Posts

    please help me solve a problem with editing mysql data

    hello,
    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.

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,631
    Thanks
    4
    Thanked 147 Times in 138 Posts
    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.

  • #3
    Regular Coder student's Avatar
    Join Date
    Jan 2007
    Posts
    129
    Thanks
    13
    Thanked 0 Times in 0 Posts
    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.
    or
    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.

  • #4
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    Shouldn't that look like this??

    Code:
    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".

    Code:
    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.
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #5
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,631
    Thanks
    4
    Thanked 147 Times in 138 Posts
    Exactly, thanks for clarifying.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •