Jump to content

Pulling invoice information from MySQL?


HostT

Recommended Posts

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 by HostT
Link to comment
Share on other sites

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 :P

 

require("includes/invoicefunctions.php");   

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated