I have installed following RPMs from RedGat CD.
php-4.0.4pl1-9.i386.rpm
php-mysql-4.0.4pl1-9.i386.rpm
php-imap-4.0.4pl1-9.i386.rpm
php-ldap-4.0.4pl1-9.i386.rpm
apacheconf-0.7-2.i386.rpm
apache-1.3.19-5.i386.rpm
I have installed MySQL before installing above RPMs.
When open the file emp.php containing following code.
<HEAD>
<TITLE>Testing PHP and MySQL data base </TITLE>
</HEAD>
<BODY>
<?
$mysql_db = "vijay";
$mysql_user = "";
$mysql_pass = "";
$mysql_link = mysql_connect(192.168.250.62, $mysql_user, $mysql_pass);
if ($mysql_link == NULL)
{
print("connection failed\n");
}
print($mysql_link);
$sel = mysql_select_db($mysql_db, $mysql_link);
printf (" selected data base %d\n", $sel );
$name = "ajay";
$insert = "INSERT into employee VALUES ($name , '2003-01-01', 1000 )";
$result = mysql_query($insert , $mysql_link);
if ($result != 0)
{
printf("error in query\n");
}
?>
</BODY>
Here database "vijay" is already created and table "employee" is also created.
The script is trying to insert values in existing table.
The browser displays :
Resource id #1 selected data base 0
But when i look into the vijay database, the employee table is not updated.
Please suggest, what will be reason that database is not updated through PHP.