Page 1 of 1

display one row of data

Posted: Mon Apr 21, 2008 1:25 am
by php_postgresql
I'm going to display the data of a specified company....
all the data needed are in my database..... i dont know how to


<html>
<?php
$db = pg_connect("dbname=dbsupplier");
$result = pg_exec($db,"SELECT * FROM companyform WHERE company='%$company'%);
$row=0;
$tel=pg_result($result,$row,"tel");
echo "$tel";
?>
</html>


I'm really lost.... I just want to output the contents of the row in a profile look.................... :(

Re: display one row of data

Posted: Mon Apr 21, 2008 1:58 am
by Christopher

Code: Select all

<html>
<?php
$db = pg_connect("dbname=dbsupplier");
$result = pg_exec($db,"SELECT * FROM companyform WHERE company='%$company'%);
$row=0;
$tel=pg_result($result,$row,"tel");
foreach ($tel as $key => $value) {
   echo "$key=$value<br/>";
}
?>
</html>