Reputation: 799
I have two schemas, one called public and another called SIEM. I want to print a table from the SIEM schema, but it is not printing anything. How can I select the schema I want to print a table from?
$query = "SELECT * from Maquina222";
$result = pg_query($conn,$query);
$i = 0;
echo '<html><body><table><tr>';
while ($i < pg_num_fields($result))
{
$fieldName = pg_field_name($result, $i);
echo '<td>' . $fieldName . '</td>';
$i = $i + 1;
}
echo '</tr>';
$i = 0;
while ($row = pg_fetch_row($result))
{
echo '<tr>';
$count = count($row);
$y = 0;
while ($y < $count)
{
$c_row = current($row);
echo '<td>' . $c_row . '</td>';
next($row);
$y = $y + 1;
}
echo '</tr>';
$i = $i + 1;
}
pg_free_result($result);
echo '</table></body></html>';
Upvotes: 0
Views: 150
Reputation: 19247
you can either qualify the name of your table (SIEM.Maquina222
) or add the schema to your path (SET search_path = public,SIEM
).
edit:
see esp. 5.7.3. The Schema Search Path. you may want to use ALTER TABLE or ALTER ROLE.
Upvotes: 1