#1
  1. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    I am looking for a good in-depth tutorial on something which I seem to not be grasping... or maybe I'm over 'grasping'...

    I've read quite a few docs, books and tutorials on PHP and MySQL. I think I have the basic stuff down, but one thing still
    escapes me.

    After all the talk of normalization, and breaking databases into multiple tables to simply updates, I find myself with questions.

    What I am looking for is something which covers storing data from a web form, into a
    database which has multiple tables, preferably a tutorial on using PHP and MySQL.

    I found one not too long ago, but the thing was on Access and ASP. And didn't really seem to have much to offer.

    In my mind I can see how it would work with something a persons "state" whereby the table for state could be completely defined... therefore inserting the "id" for the state in the primary table would be of no consequence.

    But where I am getting all sorts of dorked is on those tables which would have to populated
    from the given form..

    Let's say for argument sake, "cities" or "zip/ccodes"

    So.. anyway, a tutorial on this would be quite helpful, I'm sure that once I figure that part out, I'll be flying right forward.

    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    4
    Rep Power
    0
    The first book on PHP that I bought was PHP Essentials and the next book was the newriders MySQL book, and just last week I bought the Professional PHP Programming book.

    The PHP Essentials by Julie Meloni has a lot of examples and tutorials on using web based forms to populate tables in databases.

    It walks you through using web forms to create tables in your DB, through using web forms to add, modify, or even delete info from your tables that are already there.

    I am a total moron, never did much except install CGI scripts on my server, yet I have been able to use that book along with the MySQL book to create a pretty intricate web based database control using forms.

    I think they have some tutorials on their website at www.thickbook.com.
  4. #3
  5. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    Thanks, I will check into this.

    I only wish that Web Monkey would have had
    a little more in-depth Tutorial on this subject, instead theirs used ASP and Access.




    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    4
    Rep Power
    0
    Basically,

    The key is just populating your forms with variables that will be passed into your database through the {INSERT INTO} statement

    i.e.
    (form method="POST" action="variables.php3")
    (input type="text" name="variable1" size=20)
    (input type="text" name="variable2" size=20)
    (input type="submit" value="Submit Form")
    (/form)

    Then just pass variable1 and variable2 into an INSERT INTO statement by using the variables.php3 script. (the script that you call with the action statement in your form.)

    //variables.php3 script

    (?
    $sql = insert into table_name (field_1, field2) VALUES ($variable1, $variable2)

    //use your connection info here or call it from an include

    $connection = mysql_connect("host_name", "username", "password")

    $db = mysql_select_db("db_name", $connection)

    //then execute your query

    $sql_result = mysql_query($sql, $connection)

    ?)

    You can then use different versions of the same program to query the database and make modifications or deletions in your tables. You just call on those same variables and resubmit them in forms that use different MySQL statements. (i.e. instead of INSERT INTO, you would use DELETE to delete rows from your table or UPDATE to modify rows or fields in your table.

    [This message has been edited by murdy (edited June 11, 2000).]
  8. #5
  9. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    Murdy,

    Let me see if I understand this right.

    We say the variable1 goes into a table called
    variable1, and variable2 is to be inserted into a table named variable2.

    In order to get them there, and "link" them with an id, (as used for association in Normalization).

    We run two separate insert statements, then we querry and update the data in table (variable1) with the appropriate ID for the item in table (variable2)?

    I guess what I'm getting at is I am inserting
    into a normalized database, which has multiple tables, a primary table and then other tables.

    We naturally have to have an ID for each row of each table, the main table will contain an id used in the joining of the data for later
    review or whatever purpose.

    Now, as I look at your example, it looks like all the other standard "one table" insert methods.

    I guess what I really don't understand is why we can list elements in a joined fashion, but are unable to insert/delete/update data in a similar fashion..

    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    SLC, UT, USA
    Posts
    47
    Rep Power
    16
    This might be a little late but Webmonkey does have a tutorial. Check it out here: http://hotwired.lycos.com/webmonkey/...l?tw=frontdoor

    I used this extensively when I first started using PHP and MySQL. Definitely helped me get off the ground.

    Robman
  12. #7
  13. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Robman:
    This might be a little late but Webmonkey does have a tutorial. Check it out here: http://hotwired.lycos.com/webmonkey/...l?tw=frontdoor

    I used this extensively when I first started using PHP and MySQL. Definitely helped me get off the ground.

    Robman
    [/quote]

    Robman,

    Thanks for the input, however I have solved the problem I was having, just making this a bit more difficult than they were.
    I agree with you on WebMonkey's tutorials, they have all been very good, and I have read them, as well as have a printed copy of them.
    I was a bit surprised by their ommission of using a database for encryption, in their encryption tutorial, of course I solved that one on my own..

    Anyway, thanks for the input, I appreciate all the help that everyone has had to offer.

    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.

Similar Threads

  1. tutorial for vb.net
    By dsridhar10 in forum .Net Development
    Replies: 2
    Last Post: February 3rd, 2004, 07:43 PM
  2. div scroll tutorial
    By ximensions in forum HTML Programming
    Replies: 3
    Last Post: January 22nd, 2004, 12:52 AM
  3. Animated tutorial....
    By mmoxley in forum Apache Development
    Replies: 2
    Last Post: January 16th, 2004, 10:03 PM
  4. good Java tutorial?
    By easy in forum Beginner Programming
    Replies: 0
    Last Post: November 18th, 2003, 04:50 PM
  5. PHP tutorial - Not helping too much
    By metro in forum PHP Development
    Replies: 1
    Last Post: August 19th, 2002, 04:49 PM

IMN logo majestic logo threadwatch logo seochat tools logo