Re: problem insert data into mysql
| From: | zeus | Date: | Sat, 16 Nov 2002 18:49:48 +0000 |
| Subject: | Re: problem insert data into mysql | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16985@lists.php.net to get a copy of this message | ||
I make register golbals on, but it doesn't solve the problems. The wird thing is, i am using php nuke in my localhost, it can enter datas into MySQL, the form and the script it's not diffrent than mine right (phpnuke more complex). The form it self don't have any errors?? and how about the PHP script?? is there any error?
I need explanation in english please..please.. because i am still new in php.
Dash McElroy wrote:
Oh - you might want to check your register_globals item in php.ini and set it to on (look at www.php.net/register_globals) or use $_GET['varname'] for GET, $_POST['varname'] for POST, or $_REQUEST['varname'] for Get/Post/Cookie (works for any of those). -Dash -----Original Message----- From: zeus [mailto:zeus_dreamer@myrealbox.com] Sent: Saturday, November 16, 2002 8:49 AM To: phpwin Subject: [PHP-WIN] problem insert data into mysql I make this script. I have a problem, the data entered in the form wont insert into MYSQL, the database added new row but with blank database. Is there something wrong with the script? because i install phpnuke and i can added new data into mysql. Thanks, i need solve this problem A.S.A.P, with your kind help o PHP-er.... Thanks.. using PHP 4.2 Apache 1.3 ========================code=================== <form action="insert.php" method="post"> First Name: <input type="text" name="first"><br> Last Name: <input type="text" name="last"><br> Phone: <input type="text" name="phone"><br> Mobile: <input type="text" name="mobile"><br> Fax: <input type="text" name="fax"><br> E-mail: <input type="text" name="email"><br> Web: <input type="text" name="web"><br> <input type="Submit"> </form> <?PHP $username="root"; $password=""; $database="belajarPHP"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "INSERT INTO contacts VALUES ('','$first','$last','$phone','$mobile','$fax','$email','$web')"; mysql_query($query); mysql_close(); ?>