hi....
in mysql...to substitute your own db name we can used this codes...:
$db=mysql_select_db("dbname",$connection) or die ("couldn't select database.");
what about pg??? and can anyone please explain what is "pg_DBname" for...can i used it to substitute my database in pg....
my codes:
$connection=pg_connect("host=localhost dbname=mq ") or die ("couldn't connect to database.");
$sql="CREATE TABLE $table_name (";
for($i=0;$i < count($field_name);$i++){
$sql.="$field_name[$i]$field_type[$i]";
if($field_lenght[$i]!=""){
$sql.="($field_lenght[$i]),";
}else {
$sql.=",";
}
}
$sql=substr($sql,0,-1);
$sql.=")";
$sql_result=pg_exec($connection,$sql) or die ("couldn't execute query.");
if (!$sql_result){
echo"<p>couldn't create table!";
}else {
echo"<p>$table_name has been created!";
}
?>
- when i change $sql_result=pg_DBname($connection) ......
it shows that the table has been created...but when i checked it in my pgsql... it say that "relation 'dbname' not exist.
p/s: what i'm trying to do is to create a database table ..i'm new in pg and hoping if someone out there can help me soonn......