![]() This way the user can stay on the add page as long as he wants, if another user wants to also add a record at the same time while 1st user has not finished, he will get the last created number from temporary table + 1. In the before process right after the code that define your number, you need to insert that number into your temporary table ( very easy : $sql = " insert into sometemptable where shippingnumber=".$SESSION_ (execept the 1st line of code in previous post will look into the temporary table instead of real record) ( I enjoy phprunner however I noticed severals time this function is somethimes buggous)Ģ/ if you need severals user to be able to create record at the same time and to generate new numbers for each you need to create a ( at least it's what comes to my mind right away) temporary table : ![]() Well it's quite easy : I dont have such problem because I never have 2 users entering at the same time data.ġ/ enabling table locking in phprunner : record is locked when a user is using it so a another user wont be able to create a record at the same time. Maybe I need two new buttons -> one that says "New Manifest" and one for "Add to Open Manifest". My main problem is that i need some way for the user to say he is finished adding to this manifest number so that the next user doesn't get the last manifest number but a new one for his shipping job. You are correct with your suggestion and I think I have half the problem solved by being able to call the last manifest number used and store that in a session variable. ![]() Hope this will help u to find a solution. so if you need severals fields to have same values as master field just put " $_SESSION " in editor under "default value " for this field.ģ/ Of course now 5.3 has autofill so you can create lookup field and check autofill : it will enter values it has retrieve from another table or same table. $_SESSION=$_SESSION Ģ/ as you can see I put the value in a session variable, so when the add page is loaded I can use them to set the default field value to my new next available number in a read only field so user cant change the number. $sql="select max(substr(numcourrier,9)) as mx from courrier where substr(numcourrier,7,2)=month(now()) order by mx" Retrieve the last number ( here it's an example based on my own field format that are : CR201103001 for today for isntance ) So to create a new number that is based on previous record : I use my own script to create incremential numbers this way I'm free to edit things a lot easier specialy when it comes to edit datas with a thirs party mysql front ( navicat/phpmyadmin). It's just for the sake of mysql internal working. of course I keep an auto incremential id but it's for internal purpose only It's not showned in my project neither. It's my choice to never use the autoincremential field for my own data in mysql because it's a lot of trouble like the one you are experiencing. But from I get you need one auto created number and then severals field that are filled with same previous number. Im not 100% sure I understand your request.
0 Comments
Leave a Reply. |