| | |
Validating data in a field to a existing data stored in the database
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: May 2007
Posts: 66
Reputation:
Solved Threads: 0
Hello guys!
I am editing a program regarding billing system done in Php and MySQL and generated using the Code Charge Studio. I have problem in validating a newly entered data. What i want is to check if the billing statement number is existing or not and will not saved after validation. Saving will be done after it has pass all the validation and when save button is click. If it is existing, there will be a message displaying that it will not accept the newly entered data for the fact that it is stored in the database. If the billing statement number is available, it will go next page and later will be saved.
Also please help me on how to erase the data stored in a variable to prevent inserting to database when refresh and Back button is pressed. please help.
Thanks.....
I am editing a program regarding billing system done in Php and MySQL and generated using the Code Charge Studio. I have problem in validating a newly entered data. What i want is to check if the billing statement number is existing or not and will not saved after validation. Saving will be done after it has pass all the validation and when save button is click. If it is existing, there will be a message displaying that it will not accept the newly entered data for the fact that it is stored in the database. If the billing statement number is available, it will go next page and later will be saved.
Also please help me on how to erase the data stored in a variable to prevent inserting to database when refresh and Back button is pressed. please help.
Thanks.....
after pressing submit validate fields i.e.
if ($textboxvalue == "") {
if ($textboxvalue == "") {
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
after pressing submit validate fields i.e.
then perform an sql request (im guessing you using a database)
then check if a result is returned.
if one is then you know you have a result in the database with this number and you can refer the user to whichever page required.
also you will not need to empty any variables as you will always perform this check and if there is a value and they press back it will falg a record is already in the database. Hope this helps
PHP Syntax (Toggle Plain Text)
if ($textboxvalue == "") { // go back and error }
PHP Syntax (Toggle Plain Text)
"SELECT * FROM databasename WHERE statementnumber = " . $statementnumber . ";";
if one is then you know you have a result in the database with this number and you can refer the user to whichever page required.
also you will not need to empty any variables as you will always perform this check and if there is a value and they press back it will falg a record is already in the database. Hope this helps
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
no idea why my first comment is there ?
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
•
•
Join Date: May 2007
Posts: 66
Reputation:
Solved Threads: 0
$fldbsnum = get_param("bsnum");
echo "bsnumber: $fldbsnum";
$queryvalidate = mysql_query("select (bs_number) from billingstatementhistory where bs_number = $fldbsnum");
echo "result: $queryvalidate";
if (mysql_query($queryvalidate) == true) {
echo "The billingstatement exists";
}
else
{
echo"pass";
}
Hello! here is my test code in validating for the existing bsnum. it does not evaluate the first condition even the newly entered bsnum is existing. pls help me........
The output is:
bsnumber: 000001
result: Resource id #13
pass
echo "bsnumber: $fldbsnum";
$queryvalidate = mysql_query("select (bs_number) from billingstatementhistory where bs_number = $fldbsnum");
echo "result: $queryvalidate";
if (mysql_query($queryvalidate) == true) {
echo "The billingstatement exists";
}
else
{
echo"pass";
}
Hello! here is my test code in validating for the existing bsnum. it does not evaluate the first condition even the newly entered bsnum is existing. pls help me........
The output is:
bsnumber: 000001
result: Resource id #13
pass
![]() |
Similar Threads
- VBscript in a Visual Basic Application (Visual Basic 4 / 5 / 6)
- VB - How to open an Excel Doc w/ existing data & add data in specific cells? (VB.NET)
- how to select null values in condition (MySQL)
- Help with Roles Stored in SQL database (ASP.NET)
Other Threads in the PHP Forum
- Previous Thread: exec function on Windows XP
- Next Thread: form handling
| Thread Tools | Search this Thread |
301 access apache api array autocomplete beginner binary broken button cakephp checkbox class cms code compression cron curl data database date display dropdown dropdownlist duplicates dynamic echo email error execution file files folder form forms function functions google href htaccess html htmlspecialchars httppost image include insert integration ip javascript joomla jquery limit link links login mail md5 menu methods mlm multiple mysql oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote script search secure server session sessions sms source space sql subscription syntax system table tutorial update upload url validator variable video virus volume votedown web youtube





