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. Link to comment https://forums.phpfreaks.com/topic/95252-i-ask-your-help/ 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? Link to comment https://forums.phpfreaks.com/topic/95252-i-ask-your-help/#findComment-487894 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. Link to comment https://forums.phpfreaks.com/topic/95252-i-ask-your-help/#findComment-487912 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 } Link to comment https://forums.phpfreaks.com/topic/95252-i-ask-your-help/#findComment-487931 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.