?????? ? phpMyAdmin (phpMyAdmin - ??? - ??????????? ???????? ?????, ?????????? ?? ????? PHP? ?????????????? ????? ??? - ????????? ??? ????????????? ???? ???? MySQL) (??. ?????????? 5),? ????????? ???????:
gt; CREATE DATABASE products;
gt; CREATE TABLE clients (name VARCHAR (25), email VARCHAR (25), choise VARCHAR (8));
??? ??????? ? MySQL ?? PHP ??????????? ????????? ???????.
int mysql_connect (string hostname, string username, string password);
??????? ?????????? ? MySQL. ?????????: Hostname - ??? ?????, ?? ??????? ????????? ???? ??????. Username - ??? ????????????. Password - ?????? ????????????.
??????? ?????????? ???????? ???? int, ??????? ?????? 0, ???? ?????????? ?????? ???????,? ????? 0? ????????? ??????.
int mysql_select_db (string database_name, int link_identifier);
??????? ???? ?????? ??? ??????. ?????????: Database_name - ??? ???? ??????. link_identifier - ID ??????????, ??????? ???????? ? ??????? mysql_connect. (???????? ??????????????, ???? ?? ?? ???????????, ?? ???? ???????? ID ?? ?????????? ?????? mysql_connect)
??????? ?????????? ???????? true ??? false
int mysql_query (string query, int link_identifier);
??????? ????????? ?????? ? ???? ??????. ?????????: Query - ??????, ?????????? ?????? link_identifier - ??. ?????????? ???????.
??????? ?????????? ID ?????????? ??? 0, ???? ????????? ??????.
int mysql_close (int link_identifier);
??????? ????????? ?????????? ? MySQL.
?????????: _ identifier - ??. ????.
??????? ?????????? ???????? true ??? false
?????? ??? ???? email.php ????? ????? ????. ???:
lt;?
/* ???? ?????? ???????? ?????????? ?? request.html */
/* ?????????? ??? ?????????? ? ????? ?????? */
$ hostname= localhost raquo ;;
$ username= myusername raquo ;;
$ password= mypassword raquo ;;
$ dbName= products raquo ;;
/* ??????? MySQL,? ??????? ???????? ?????? */
$ userstable= clients raquo ;;
/* email ?????????????? */
$ adminaddress= administration@meraquo ;;
/* ??????? ?????????? */_ connect ($ hostname, $ username, $ password) OR DIE ( ?? ???? ??????? ?????????? );
/* ??????? ???? ??????. ???? ?????????? ??????- ??????? ?? */
mysql_select_db ($ dbName) or die (mysql_error ()); lt; CENTER gt; raquo ;; ??????, . $ _ POST [ name ] ;
echo lt; BR gt; lt; BR gt; raquo ;; ??????? ?? ??? ???????. lt; BR gt; lt; BR gt; raquo ;;
echo ??? ?????????? . $ _ POST [ preference ]. laquo ;. ?????????? ? ??? ?? ?????? ??? ?? email: . $ _ POST [ email ];
echo lt;/CENTER gt; raquo ;;
/* ?????????? email-? */
$ subj= ?????? ?? ?????????? raquo ;;
$ text= ????????? . $ _ POST [ name ]." !
??????? ?? ??? ???????!
??? ?????????? . $ _ POST [ preference ].
?? ?? ?????????????? ?????????.
?????????? ? ????????? ?????? ????? ???????? ? ???????? ???? ????? ????????." ;
mail ($ _ POST [ email ], $ subj, $ text);
$ subj= ???????? ?????? ?? ?????????? raquo ;;
$ text=$ _POST [ name ]. ???????????? . $ _ POST [ preference ]. email - ?????: . $ _ POST [ email ];
mail ($ adminaddress, $ subj, $ text);
/* ????????? ?????? ??? ??????? ?????????? ? ??????? ? ??????? */
$ query= INSERT INTO $ userstable VALUES ( $ name , $ email raquo ;, $ preference ) raquo ;;
/* ????????? ??????. ???? ?????????? ??????- ??????? ??. */_ query ($ query) or die (mysql_error ());
echo ?????????? ? ??? ???????? ? ???? ??????. raquo ;;
/* ??????? ?????????? */_ close ();
? gt;
??? ??? ????? ????? ???????? ? ????? ?????? ? PHP. ?????? ????? ?????????? ???????????, ?????????? ? ??????? ...