Norbert
|
| Posted: 01/09/2005, 4:22 PM |
|

I thought PostgreSQL is great choice for me.
I am at the 75% of my quite complex project implentation and reached that:
Warning: pg_errormessage(): 22 is not a valid PostgreSQL link resource in d:\appserv\www\projekty\iswp\db_pgsql.php on line 113.
The error appears when I call $db->next_record();
I want to do the following:
I have a grid on the page. I would like to put the table in one column of that grid. That table would be filled with some data taken from database.
I cannot do it in a simple way as cannot put grid into another grid in CCS, that's way I am calling my procedure in before_row event.
The error occures when persistent connection is set to NO.
It disappears when I switch the persistent connection to YES, but still next_record method does not return true although the same query against database returns rows 
Here is the code:
//orders_details_BeforeShowRow @267-A65F4F7E
function orders_details_BeforeShowRow()
{
$orders_details_BeforeShowRow = true;
//End orders_details_BeforeShowRow
//Custom Code @319-8739AB25
// -------------------------
global $orders_details;
//$db = new clsDBADZ();
$i_det = intval($orders_details->id_order_detail->GetValue());
$i_records_count = 0;
$db = new clsDBADZ();
$SQL = "SELECT i_id FROM orders_details_technology WHERE i_orders_details_id= . $i_det";
$db->query($SQL);
$a= $db->next_record();
echo "next record: $a";
//not important during tests
/*
$tabelka = "<TABLE>";
while($db->next_record()){
$i_records_count++;
$tabelka .= "\n\n<TR>\n<TD>" . $db->f("s_program_no") . " </TD>\n<TD>" . $db->f("d_na_kiedy") . " </TD>\n<TD>" . $db->f("s_opis") . " </TD></TR>";
}
$tabelka .= "</TABLE>";
if($i_records_count == 0){
$tabelka = " ";
}
$orders_details->technologia->SetValue($tabelka);*/
$db->close();
//$orders_details->technologia
// -------------------------
//End Custom Code
//Close orders_details_BeforeShowRow @267-55C3A166
return $orders_details_BeforeShowRow;
}
//End Close orders_details_BeforeShowRow
and here is html I use to call teh above:
<!-- BEGIN Grid orders_details -->
<table class="BlueNoteFormTABLE" cellpadding="4">
<tr>
<td class="BlueNoteColumnTD" nowrap align="center" colspan="5">Wyrób</td>
<td class="BlueNoteColumnTD" nowrap align="center">Technologia</td>
</tr>
<tr>
<td class="BlueNoteColumnTD" nowrap>Nazwa</td>
<td class="BlueNoteColumnTD" nowrap>Ilość</td>
<td class="BlueNoteColumnTD" nowrap>Cena </td>
<td class="BlueNoteColumnTD" nowrap>Termin wyk.</td>
<td class="BlueNoteColumnTD" nowrap>Wykonano</td>
<td class="BlueNoteColumnTD" nowrap>Nr progr. | Termin Wyk. | Opis</td>
</tr>
<!-- BEGIN Row -->
<tr>
<td class="BlueNoteDataTD">{s_nazwa} </td>
<td class="BlueNoteDataTD">{f_ilosc} </td>
<td class="BlueNoteDataTD" align="right">{f_cena} </td>
<td class="BlueNoteDataTD">{d_wyk_wyrobu_na_kiedy} </td>
<td class="BlueNoteDataTD">{d_wyk_wyrobu} </td>
<td class="BlueNoteDataTD">
<!-- my trick - two labels, one not displayed but still can read values from it
-->
<!--{id_order_detail}-->
{technologia} <!-- html label I put my sub-table data code into -->
</td>
</tr>
<!-- END Row -->
<!-- BEGIN NoRecords -->
<tr>
<td class="BlueNoteAltDataTD" colspan="6">Brak danych </td>
</tr>
<!-- END NoRecords -->
</table>
<!-- END Grid orders_details -->
Hope anyone can help me with that error message
Warning: pg_errormessage(): 22 is not a valid PostgreSQL
or tell me how to show on one grid "sub-queried" data.
Best regards
Norbert
|