Page 1 of 1

Failing to us php to insert data to mysql database

Posted: Sat May 18, 2002 7:14 pm
by igbidephilip
Hello
Can someone help me, I'm trying to insert data in a table created but i encounter an error when i try to insert the data via form. Error message:

"Server error!

Error message:
handler "httpd/unix-directory" not found for: C:/mywww/

If you think this is a server error, please contact the webmaster "

This is the php code written for
<html>
<head>
<title>Inserting records into School DB</title>
<body>
<form name="author_admin" method="post" action="<?php echo $PHP_SELF;?>">
<p>Student ID: <input type="number" name="studentId"><br>
<p>First Name: <input type="text" name="firstName"><br>
<p>Last Name: <input type="text" name="lastname"><br>
e-mail: <input type="text" name="email">
<input type="submit" name = "submit" value="Insert"></p>
</form>

<?php

$Dbname="roll";

$dbHost=@mysql_connect("localhost", "", "");
mysql_select_db("$Dbname", $dbHost);

if ((isset($studentId)) AND (isset($firstName)) AND (isset($lastName)) AND (isset($email))) {
$sql="INSERT INTO roll VALUES('','$studentId','$firstName', '$lastName','$email')";
$result=mysql_query($sql,$dbHost);


echo "<h1>Success!</h1><p>";
echo "$firstName $lastName was inserted into the database. Here are the details:<p>";
echo "Name: $firstName $name<br>Student ID $studentId<br>email: $email<p>";
}
mysql_close();
?>
</body>
</html>

and my doc root is mywww.
Help pls cos i'm getting quite frustrated! (

Posted: Sat May 18, 2002 8:00 pm
by jason
Server error!

Error message:
handler "httpd/unix-directory" not found for: C:/mywww/

If you think this is a server error, please contact the webmaster
Well, it looks like a server error to me.

Also, remove the @ in front of the mysql_connect() function.

sql root directory

Posted: Sun May 19, 2002 6:04 am
by Gavski
If you are running mysql from a path other than C:\mysql you have to alter my.ini to reflect this, I see you are using C:\mywww, make sure that mysql knows this. Look in my.ini or on mysqladmin if you have it.

I don't know if this is your problem but it may be worth checking if you haven't already.