HostT Posted July 4, 2011 Share Posted July 4, 2011 (edited) So i would like to create a separate section to show "Open" and "Closed" invoices, and in order to do that i need to pull information from MySQL and use the WHMCS custom page. Got everything working but it looks like the MySQL code i have does not work. Does anybody know what is wrong in this code? $result = mysql_query('SELECT * FROM tblinvoices WHERE userid=\'' . $_SESSION['uid'] . '\' AND status=\'Unpaid\' ORDER BY id DESC'); $i = 0; while ($data = mysql_fetch_array($result)) { $id = $data['id']; $invoicenum = $data['invoicenum']; $date = $data['date']; $duedate = $data['duedate']; $total = $data['total']; $status = $data['status']; $date = frommysqldate ($date); $duedate = frommysqldate ($duedate); if (!$invoicenum) { $invoicenum = $id; } $invoices[$i]['id'] = $id; $invoices[$i]['invoicenum'] = $invoicenum; $invoices[$i]['datecreated'] = $date; $invoices[$i]['datedue'] = $duedate; $invoices[$i]['total'] = $total; $invoices[$i]['status'] = getinvoicestatuscolour ($status); ++$i; } $smartyvalues["invoices"] = $invoices; It won't even load the custom page with the above code. I changed around the MySQL query and got it to load but it wouldn't give me anything in the invoices array. Edited July 4, 2011 by HostT 0 Quote Link to comment Share on other sites More sharing options...
HostT Posted July 4, 2011 Author Share Posted July 4, 2011 I was going to remove this post but ill give you the solution since it was something very simple...just in case someone else runs into this issue. And the simple solution was..... i forgot to include the invoicefunctions.php file require("includes/invoicefunctions.php"); 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted July 7, 2011 Share Posted July 7, 2011 Or you could just add a toggle on the existing view invoices tpl and an if in the display loop 0 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.