Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Well, the problem I posted before is fixed and I am able to create and add tables to databases. The problem occurs when I submit a form from an html file and try to insert data:Code: Select all
<?php
$connection = mysql_connection("localhost","root","password");
if ($connection)
{
mysql_select_db("gb_db",$connection);
$query = "INSERT INTO gb_table (NAME,EMAIL,COMMENT)
VALUES('$_POST[user_name]','$_POST[user_email]', '$_POST[user_comment]')";
if (mysql_query($query,$connection))
{
echo "Comment added succesfully";
}
else
{
echo "Error: " + mysql_error();
}
}
else
{
die('Error: ' . mysql_error());
}
mysql_close($connection);
?>Code: Select all
<form action="insert_comment.php" method="post">
Using php5, apache 2.2, and latest version of mysql.
Thanks.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]