Inserting data into mySQL...?
| From: | Oscar J. Ramos | Date: | Wed, 29 Dec 2004 16:59:49 +0000 |
| Subject: | Inserting data into mySQL...? | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-14953@lists.php.net to get a copy of this message | ||
mySQL version 4.1
php 5
OS Windows 2003 server
IIS
Running php as cgi
Php.ini file configurations
Extension_dir = "c:/php/ext/"
Extension=php_mysql.dll
PHP code used.
?>
@ $db = mysql_connect("localhost", "username", "password");
if (!$db)
{
echo "<center>Error: Could not connect to database. Please try
again later.</center>";
exit;
}
$id = '';
$name = 'Oscar J. Ramos';
echo 'Test 1 ' . $name . '<br>';
mysql_select_db("dbtest");
$query = "insert into tbltest values
('".$id."', '".$name."')";
$result = mysql_query($query);
echo $name;
?>
added path c:\php
Oscar J. Ramos
Technology Support Technician
By Design LLC.
(212) 500 - 4466
x4466
ojramos@bydesignllc.com
www.bydesignllc.com