Dear Readers,
I'm 16 years old and I'm trying to learn PHP & SQL besides my school (because they don't offer this..)! And I wan't to know how to do this!
In the first place I got this code from a Tutorial.
<?php
$db = pg_connect("dbname=friends user=htdocs");
$query = "SELECT * FROM friends";
$result = pg_exec($db, $query);
if (!$result) {printf ("ERROR"); exit;}
$numrows = pg_numrows($result);
$row=0;
printf ("<table border=1>\n");
printf ("<tr><td>ID</td></td></tr>\n");
do
{
$myrow = pg_fetch_row ($result,$row);
printf ("<tr><td>%s</td></tr>\n", $myrow[0]);
$row++;
}
while ($row < $numrows);
printf ("</table>\n");
pg_close($db);
?>
I would like to put the result in a string! not on the screen in a table.. anybody a suggestion?
Kasper Schoonman (16yr)
AppleMuseum.com