SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Please Help Me!

  1. #1
    Non-Member
    Join Date
    Mar 2005
    Posts
    832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Please Help Me!

    This is my code so far:

    $insert = mysql_query("insert into $table values ('".$_POST['username']."', '','$encrypted_password','','','','','','','', '', '', '', '', '', '".$_POST['city']."', '".$_POST['zip']."')")


    How would i add another field named email?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, first your table has to be setup to have it (which I assume you've done).

    Your query is valid, but you have to insert a value for everything. You could just do something like this:

    INSERT INTO table_name (name, job, description) VALUES ("john doe", "peasant", "white hair, 95 years of age, 8 ft 4 in")
    If you're not part of the solution, you're part of the problem.

    If you're constantly waiting for the weekend,
    you're missing out on 5/7 of your life.

  3. #3
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tidal Wave
    This is my code so far:

    $insert = mysql_query("insert into $table values ('".$_POST['username']."', '','$encrypted_password','','','','','','','', '', '', '', '', '', '".$_POST['city']."', '".$_POST['zip']."')")


    How would i add another field named email?
    IN addition to sleep4ever's advice, you should validate the user input.

  4. #4
    HardCoder md_irfan_amu's Avatar
    Join Date
    May 2005
    Location
    Asia
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You first check your tables fields if there any mismatch .....
    otherwise u can use the syntax
    insert into <table-name>(filedsnames,.,...,.) values('fields values',....);


    perhaps this will help you...
    Irfan
    Find Tutors Easyway to get connect with your tutor in india


Bookmarks

Posting Permissions

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