I could be wrong about this since I'm new to this myself, but I think you may be putting in the wrong parameter for you database server. Check with your system administrator to see if the first argument of the mysql_connect() function is correct. Usually the database server is different from the web server. You might also try using the default value of "localhost". This frequently works, although not on all systems.
Also, you might try using the SQL keyword NULL for the auto-increment column. To the best of my knowledge NULL != 0 but rather represents no value. 0 typically represents 0, which is a value. You may simply be writing the data over the same row again and again.
As for your second question, such an arrangement is probably less secure than the original. PHP code is never sent to the end user and therefore remains relatively private, although your password still could be seen by someone with access to your directory on your server. However, any file who's extention does not rout it through the reprocessor will automatically be seen to the user as is, so if a hacker somehow gets a listing of the directory those files reside in, they only have to download it to view its contents.
Good luck.
adam friedman wrote:
I'm trying to have people fill out a form and have the responses sent to a mysql database but I can't get it to work and don't know if my coding is wrong or the database is screwed up. The database name is observingyourmind_com and the table name is signatures. T1 through T7 are the variables that represent peoples responses. The zero at the end just fills up a space for the last field which has an autoincrement feature. Is this code correct?
<?php
$db=mysql_connect ("http://www.observingyourmind.com","username","password");
mysql_select_db("observingyourmind_com",$db);
mysql_query("INSERT INTO signatures VALUES ('$T1','$T2','$T3','$T4','$T5','$T6','$T7','$T8',0)",$db);
mysql_close ($db);
echo "Thanks for your help";
?>
Also, if I want to use an include to hide my username and password, could I just have the first two lines of code be
$user=include(file1.inc);
$password=include(file2.inc);
and put $user where username was and $password where password was and have not....