mehnihma Posted May 2, 2014 Share Posted May 2, 2014 Hi Can you maybe tell me how to put order number in pdf? I have tried many variables and did not get how to get order number php variable? Thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 2, 2014 Share Posted May 2, 2014 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. 0 Quote Link to comment Share on other sites More sharing options...
mehnihma Posted May 2, 2014 Author Share Posted May 2, 2014 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 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 2, 2014 Share Posted May 2, 2014 (edited) 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 May 2, 2014 by brian! 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.