Adding record to a MYSQL DB using PHP ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James

    Adding record to a MYSQL DB using PHP ?

    What is the best way to add a new record to a MYSQL DB using a FORM and PHP
    ?
    Any examples or URLS ?

    Thanks
  • slapkicksy

    #2
    Re: Adding record to a MYSQL DB using PHP ?


    "Metnetsky" <mimetnet@syr.e du> wrote in message
    news:pan.2003.0 7.08.17.48.01.1 5654@syr.edu...[color=blue]
    > On Tue, 08 Jul 2003 17:49:42 +0100, James wrote:
    >[color=green]
    > > What is the best way to add a new record to a MYSQL DB using a FORM and
    > > PHP ?
    > > Any examples or URLS ?
    > >
    > > Thanks[/color]
    >
    > If you can make use of the PEAR (pear.php.net) library you should give it
    > a shot as it's a great interface to databases. But here's a simple
    > example using pure PHP commands.
    >
    >
    > if (!$myConn = mysql_connect(" localhost")) {
    > exit("Unable to make a connection to the database");
    > }[/color]

    mysql_connect can work just as well with

    $connectionid=m ysql_connect($h ost,$user,$pass ) or die ("Could not connect");

    as the 'or die' statement exits the program after the string is sent to the
    browser..
    just another way of doing things.

    That, and it looks neater. ;)


    Comment

    Working...