Jump to content

Order number variable


Recommended Posts

if it existed, I think logically it would be $ordernum - but I don't think the order number is passed to the invoice as a variable... therefore, you will have to query the database to obtain the value yourself...

 

# Obtain Order Number from database
$query = mysql_query("SELECT ordernum FROM tblorders WHERE invoiceid = $invoicenum");
$result = mysql_fetch_array($query);
$ordernum = $result["ordernum"];    

then you just use $ordernum in your output wherever you want to show the order number.

Link to comment
Share on other sites

Hi

Thanks

I got it working like this:

 

$query = mysql_query("SELECT ordernum FROM tblorders WHERE userid = $userid");

$result1 = mysql_fetch_array($query);

$ordernum1 = $result1["ordernum"];

 

In your example I just got blank string not sure why

Link to comment
Share on other sites

In your example I just got blank string not sure why

i'm not sure your code will work if you use it with a client that has more than one order - it might just take the first order number it comes across for that client and might not be the correct order number for that invoice... my code will use the correct value if it exists.

 

I tested my code before posting and it worked - but remember that not all invoices will have an order number associated with them - e.g, I don't think any renewal invoices would have an order number...

Edited by brian!
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