I have a code which works fine with php and mysql. My client has changed the requirement of the db to psql. I have the table created in pgsql. How do I need to modify my code to submit the records for psql DB.
The code for header.inc
<?php
$conn = pg_pconnect("dbname=consult host=my.domain.com port=5432 user=consult") or die("Could not connect!");
?php>
The error I get is:
Parse error: parse error in /usr/local/tomcat/webapps/ussa/header.inc on line 3
The sme header.inc in my sql is
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("cfm2php",$db);
?>
The submit page code part is:
MysqlDB (this works)
$SQL = "SELECT * FROM msu9900";
$result = mysql_query($SQL,$db);
$SQL1 = "insert into msu9900";
$SQL1 = $SQL1 . " (FirstName, LastName, Street, City, State, Zip, HomePhone, EMail, WorkPhone, Languages, ServYrs, Country, AArea, Occupation, Employer) ";
$SQL1 = $SQL1 . " values ('$fldfirst_name','$fldlast_name','$fldstreet','$fldcity','$fldstate','$fldzip','$fldhphone','$fldemail','$fldwphone','$fldlang','$fldsyrs','$fldcountry','$fldarea','$fldoccupation','$fldemp') ";
$result1 = mysql_query($SQL1,$db);
For psql (This does not work)
$SQL = "SELECT * FROM msu9900";
//$result = mysql_query($SQL,$db);
$result = pg_exec( $conn, $SQL );
$SQL1 = "insert into msu9900";
$SQL1 = $SQL1 . " (FirstName, LastName, Street, City, State, Zip, HomePhone, EMail, WorkPhone, Languages, ServYrs, Country, AArea, Occupation, Employer) ";
$SQL1 = $SQL1 . " values ('$fldfirst_name','$fldlast_name','$fldstreet','$fldcity','$fldstate','$fldzip','$fldhphone','$fldemail','$fldwphone','$fldlang','$fldsyrs','$fldcountry','$fldarea','$fldoccupation','$fldemp') ";
// $result1 = mysql_query($SQL1,$db);
$result1=pg_exec($conn,$SQL);
Any thoughts/ideas?
Tahnks
Sri