Re: [PHP3] MySQL/PHP script From: Mark Maggelet (maggelet <email protected>)
Date: 04/30/00

***********************************************

On 4/30/00 at 5:17 PM Chris Toth wrote:

>folks,
>
>This little script takes a BUNCH of values from a page full of HTML forms,
>and then submits it to the database. Can anyone see any stupid errors or
>obvious improvments?
>
>
>/*This part inserts the form data into the MySQL database*/
>
>
><?php
>
>/*Connect to DB server, select DB*/
>
>mysql_connect (localhost, username, password);
>
>mysql_select_db (management);
>
>/*This part looks complicated, but it's just a bunch of names and values,
>check for spelling errors! */
>
>mysql_query ("INSERT INTO management(first_name, last_name, title, company,
>address1, address2, city, state, zip, tel1, tel2, email, member_status,
>member_level, payment_form, cc_number, expire_date, sig,
>category,primary_instrument, secondary_instrument, music_style,
>organizations, credits)
> VALUES ('$man_fname', '$man_lname', 'man_title',
>'man_cmyband', 'man_addrone', 'man_addrtwo',
>'man_city','man_state','man_zip','man_tel','man_teltwo','man_email','man_mem
>status','man_memlevel','man_payform','man_ccnum','man_expdate','man_sig','ma
>n_cat','man_priinstr','man_secinstr','man_style','man_org','man_credits') ");
>
>
>/*Thank the user for the submission*/
>
>print ($first_name);
>
>print (" ");
>
>print ($last_name);
>
>print ("<p>");
>
>print ("Thank you for the submission.");

not much of an improvement, but it's easier to go:
echo "$firstname $lastname<p>Thank you for the submission.";

also you can eliminate the field list in the query if you're filling in all fields in the table
in order (usually you are).

- Mark

-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>