Firebird and PHP

Greetings I have a question Im working on a little php code.

The main point its to find with a process some articles from a database, it doesnt display any errors, but it doesnt show anything, right now I dont now where my mistake is, this is my code

<?php if ($db = ibase_connect('C:\xampp\htdocs\TestCompucenter\CONSULTAS2017.fdb', 'SYSDBA','masterkey')) { echo 'Si jalo'; $query= "select B.CLAVE_ARTICULO, c.INV_FIN_UNID as existencia, c.NOMBRE_ALMACEN from ARTICULOS a left join CLAVES_ARTICULOS b on b.ARTICULO_ID = a.ARTICULO_ID left join ORSP_IN_AUX_ART(a.ARTICULO_ID,'Almacén general', '01/01/2010', CURRENT_DATE, 'N', 'N') c on c.ARTICULO_ID = a.ARTICULO_ID where b.CLAVE_ARTICULO = 'TN-310M'"; $res=ibase_query($db, $query); if(!$res) {echo 'No se pueden mostrar los datos desde la consulta: $query !!'; exit;}else{ $row=ibase_fetch_object($res);} echo "\n"; echo " \n"; while($row=ibase_fetch_object($res)) { echo " \n"; } echo "
CLAVE ARTICULO EXITENCIA NOMBRE ALMACEN



$row->clave_articulo $row->inv_fin_unid $row->nombre_almacen
\n"; } else { echo 'Error'; } ?>

I know the sql syntax work this is a demo with an ID thats currently in the database, thanks in advanced

Define: it doesnt show anything

Are you getting a completely blank page and if so does the ‘view source’ of the page in your browser show anything or are you getting the table heading row but no data row(s)?

How many rows of data do you expect to be displayed, because your code has an errant fetch statement that’s fetching and discarding the first row from the result set before the loop that’s supposed to be fetching and displaying the data?

I would also check to see you have error reporting turned on by putting the following on top of the page.
[php]<?php
/* Turn on error reporting */
ini_set(‘display_errors’, 1);
ini_set(‘display_startup_errors’, 1);

if (filter_input(INPUT_SERVER, ‘SERVER_NAME’, FILTER_SANITIZE_URL) == “localhost”) {
error_reporting(-1); // -1 = on || 0 = off
} else {
error_reporting(0); // -1 = on || 0 = off (remote/production server should always be off)
}[/php]

to phdr it shows a blank table, and I expect 1 row displayed like this:

later on I will modify the code so the user can input an ID.

thanks in advanced


My reply states what’s wrong with the code that would cause the 1st/single row of data to not be displayed -

this is the view of the output


In this case, I should use fetch_row? because thats the objective, to display a row with the ID.

thanks in advanced.

Sponsor our Newsletter | Privacy Policy | Terms of Service