LearnGreekToday
10-11-2006, 12:32 PM
I have a simple database setup.. I also have a form for adding data to my database but am unable to get the form/script to works here is the processing script:
<?
$DBhost = "localhost";
$DBuser = "user";
$DBpass = "password";
$DBName = "dbname";
$table = "tname";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$sqlquery = "INSERT INTO $table VALUES('custname','custacct','prim_tect','prim_t_phone',
'prim_t_cell','prim_t_local','back_tech','back_t_phone','back_t_cell','back_t_local','rtr_inet','rtr _id',
'cir_id','cir_local','ext_by','details')";
$results = mysql_query($sqlquery);
mysql_close();
print "<html><body><center>";
print "<p>You have just entered customer information in the database<p>";
?>
After I submit the info, I do see my print statement but their isn't any new information in the database. Does anyone have any ideas on this?
My next question is how do you write the script to get the info from the database using a search form. I have tried this to but was not able to get this working either.
<?
$DBhost = "localhost";
$DBuser = "user";
$DBpass = "password";
$DBName = "dbname";
$table = "tname";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$sqlquery = "INSERT INTO $table VALUES('custname','custacct','prim_tect','prim_t_phone',
'prim_t_cell','prim_t_local','back_tech','back_t_phone','back_t_cell','back_t_local','rtr_inet','rtr _id',
'cir_id','cir_local','ext_by','details')";
$results = mysql_query($sqlquery);
mysql_close();
print "<html><body><center>";
print "<p>You have just entered customer information in the database<p>";
?>
After I submit the info, I do see my print statement but their isn't any new information in the database. Does anyone have any ideas on this?
My next question is how do you write the script to get the info from the database using a search form. I have tried this to but was not able to get this working either.