DarkPrince2005 Posted July 25, 2011 Share Posted July 25, 2011 Can anyone tell me why this is just echoing empty lines? When I do it in mysql it works. <?php $conn=odbc_connect('helpdesk','',''); $sql="SELECT * FROM invoices"; $rs=odbc_exec($conn,$sql); while(odbc_fetch_row($rs)){ mysql_connect("localhost","root",""); mysql_select_db("db"); $len = strlen(odbc_result($rs,"Invoice_ID")); //echo $len; if($len == "12"){ $new = str_replace("ITEC_Inv-00","ITECnerv_Inv-0000",odbc_result($rs,"Invoice_ID")); } else { if($len == "13"){ $new = str_replace("ITEC_Inv-00","ITECnerv_Inv-000",odbc_result($rs,"Invoice_ID")); } else { if($len == "14"){ $new = str_replace("ITEC_Inv-00","ITECnerv_Inv-00",odbc_result($rs,"Invoice_ID")); } else { $new = odbc_result($rs,"Invoice_ID"); } } } echo $new."<br />"; } Link to comment https://forums.phpfreaks.com/topic/242716-odbc-echo-problem/ Share on other sites More sharing options...
trq Posted July 25, 2011 Share Posted July 25, 2011 Integers are not quoted in php (or any other languages I know of). As for your issue, what debugging have you done? You haven't checked your query has succeeded or returns any results.Have you tried simply echoing the results within all the string replacing? Also, opening a mysql connection like that within a loop is never going to be a wise idea. Link to comment https://forums.phpfreaks.com/topic/242716-odbc-echo-problem/#findComment-1246662 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.