spanish Posted March 9, 2008 Share Posted March 9, 2008 Hello, this forum is great. I ask your help: This is my problem: I have one function in a file named funciones.php function regresaFactura($idfactura){ $strSQL = "Select * from STtblFactura, STtblDetalleFactura where STtblFactura.intIDFactura=STtblDetalleFactura.intFKIDFactura and intIDFactura=$idfactura"; $DatosFactura=mysql_query($strSQL); // si hago un print aqui de $DatosFactura me lo hace return $DatosFactura; // estaba mal escrito, pero esta bien en mi script } If in this file I make a print of $DatosFactura y have the correct result. But if I call this function since another file imprimeFactura.php, like that: include('funciones.php') $vidfactura=$_GET['idfactura']; //This is from one form, and return a value $resultadoFactura=regresaFactura($vidfactura); // Here I have one error if I make a print. what's wrong, please. Quote Link to comment Share on other sites More sharing options...
trq Posted March 9, 2008 Share Posted March 9, 2008 You cannot simply print the result from mysql_query(). What error are you getting exactly? Quote Link to comment Share on other sites More sharing options...
spanish Posted March 9, 2008 Author Share Posted March 9, 2008 Thx for yor answer. The error is this: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Thx. Quote Link to comment Share on other sites More sharing options...
Barand Posted March 9, 2008 Share Posted March 9, 2008 Add some debugging code to the function <?php function regresaFactura($idfactura){ $strSQL = "Select * from STtblFactura, STtblDetalleFactura where STtblFactura.intIDFactura=STtblDetalleFactura.intFKIDFactura and intIDFactura=$idfactura"; $DatosFactura=mysql_query($strSQL); // si hago un print aqui de $DatosFactura me lo hace if (!$DatosFactura) echo mysql_error(), "<pre>$strSQL</pre>"; return $DatosFactura; // estaba mal escrito, pero esta bien en mi script } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.