|
#1
|
|||
|
|||
|
Hi There, i do not want to bug support as its probably my error
I am new to SQL and PHP and have created a database and table and have all that ready but i cannot connect to the database when trying to insert new values from a PHP page The following is the 'latest' example that i used and is currently giving me 500 internal server error' message ------------------------- <html> <head> <title>Untitled Document</title> </head> <body><?php $name=$_POST['name']; $cid=$_POST['cid']; $phone=$_POST['phone']; $contact=$_POST['contact']; $tsales=$_POST['tsales']; $f2f=$_POST['f2f']; $date=$_POST['date']; $dbh=mysql_connect ("localhost", "atrigg_admin", "admin") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("atrigg_LMT"); mysql_query("INSERT INTO `people` VALUES ('$name', '$cid','$phone','$contact','$tsales','$f2f', '$date')"); Print "Your information has been successfully added to the database."; ?> </body> </html> ---------------------------------- Now, is there anything i have wrong in the above, and yes, i have created the user for the database with full privilages, and the table name is people Also.... i tried a slight variation, which is ---------------------------------- <html> <head> <title></title> </head> <body><?php $name=$_POST['name']; $cid=$_POST['cid']; $phone=$_POST['phone']; $contact=$_POST['contact']; $tsales=$_POST['tsales']; $f2f=$_POST['f2f']; $date=$_POST['date']; $dbh=mysql_connect ("localhost", "atrigg_admin", "admin") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("atrigg_LMT"); mysql_query("INSERT INTO `people` VALUES ('$name', '$cid','$phone','$contact','$tsales','$f2f', '$date')"); Print "Your information has been successfully added to the database."; ?></body> </html> _--------------------------------------------- What am i doing wrong, help! |
|
#2
|
|||
|
|||
|
Hmmm, i appear to have solved it, somehow, the second one decided to work now, dunno why.....
I shall do a happy dance now! |
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
|
|
All times are GMT -5. The time now is 11:55 PM.








