SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2011
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Entering into MySQL Database with PHP? Or just a simple 'post' form?

    Hi,

    I have designed a login page at our web site which requires a username and password.

    What is the best way for users to add content to a database? May be a simple form using 'post' will be fine? I could design 30 boxes asking for

    - product name
    - product price
    - product code
    - content
    - In stock/Out of Stock
    - etc., etc.

    Essentially I just need to recreate on a web page the "Insert" part of PHPMyAdmin.

    Is there a way that PHP can be used to enter info. into a database from a web page?

    How will my form used for data-entry know to auto-increment the entries?

    Look forward to your comments,
    Matt.

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MatthewBOnline View Post
    Essentially I just need to recreate on a web page the "Insert" part of PHPMyAdmin.

    Is there a way that PHP can be used to enter info. into a database from a web page?
    answered your own question here. What do you think phpMyAdmin is?

    How will my form used for data-entry know to auto-increment the entries?
    Your query should not submit auto_increment fields. auto_increment fields will automatically (hence the 'auto') get filled by mySQL when you do an insert without that field.

  3. #3
    SitePoint Evangelist
    Join Date
    Mar 2011
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok - i understand about the auto-increment.

    Are you suggesting i should only use PHPMyAdmin?

    I do want an online form instead. Can it be done with PHP?

    Matt.

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    My point was that phpMyAdmin IS a PHP web-page... so of course it can be done in php

  5. #5
    SitePoint Evangelist
    Join Date
    Mar 2011
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is the function I should be using to add data using PHP?

    I thought about using a form and the function 'post'. But this is not PHP and I think PHP would be a more sensible method for adding data.

    What is the main function to use to add content to a MySQL table? Then I can read up on it.

    Matt.

  6. #6
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    mysqli_connect
    mysqli_query

    probably a good place to start looking.


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
  •