| | |
How would I write this asp code to work in PHP
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2006
Posts: 1
Reputation:
Solved Threads: 0
I'm new to PHP so be gentle
I have this asp code that is working....how would I write this in php if I use the same db tables and fields.
The "class_amount" field will hold the total amount of students allowed, in this case 16.
When a new record is added using a "look up dropdown box", it subtracts 1 off the total until 16 records have been added, once this reaches zero you could have it that the class name vanishes from the "drop down list" so its not available for selection
Add Page CODE
Function BeforeAdd(dict)
strSQLInsert ="UPDATE class_names SET class_amount=(class_amount-1) WHERE class_name ='"&dict("course1")&"'"
dbConnection.Execute strSQLInsert
BeforeAdd = True
End Function
List Page CODE
Function BeforeDelete(where)
strSQLInsert ="UPDATE class_names SET class_amount=(class_amount+1) WHERE class_name ='"&rsTemp("course1")&"'"
dbConnection.Execute strSQLInsert
BeforeDelete = True
End Function
The dropdown box has the following where statement:
"class_amount>=1"

I have this asp code that is working....how would I write this in php if I use the same db tables and fields.
The "class_amount" field will hold the total amount of students allowed, in this case 16.
When a new record is added using a "look up dropdown box", it subtracts 1 off the total until 16 records have been added, once this reaches zero you could have it that the class name vanishes from the "drop down list" so its not available for selection
Add Page CODE
Function BeforeAdd(dict)
strSQLInsert ="UPDATE class_names SET class_amount=(class_amount-1) WHERE class_name ='"&dict("course1")&"'"
dbConnection.Execute strSQLInsert
BeforeAdd = True
End Function
List Page CODE
Function BeforeDelete(where)
strSQLInsert ="UPDATE class_names SET class_amount=(class_amount+1) WHERE class_name ='"&rsTemp("course1")&"'"
dbConnection.Execute strSQLInsert
BeforeDelete = True
End Function
The dropdown box has the following where statement:
"class_amount>=1"
![]() |
Similar Threads
- Exprot to Excel in ASP.NET using C# (C#)
- How to write the new line existing pdf file using php (PHP)
- asp code generated as text, needed to be seen as asp code again. databses backup (ASP)
- Null Pointer? will this code work (C)
- Need help with existing code (PHP)
- I am trying to get this code to work. Please help. (C++)
- need help on I/O in AsP(ASAP PLEASE) (ASP)
- Layout in CSS (HTML and CSS)
Other Threads in the PHP Forum
- Previous Thread: html checkboxes...
- Next Thread: retrieving a particular value with a sql query
| Thread Tools | Search this Thread |
advanced apache api array basics beginner binary broken cakephp check checkbox class cms code codingproblem combobox cookies cron curl database date datepart display dynamic echo email error file files folder form forms function functions google head href htaccess html image include includingmysecondfileinthechain insert ip javascript job joomla js limit link login mail menu mlm mobile multiple mysql nodes oop outofmemmory paging parse password paypal pdf php problem procedure query radio random recursion remote script search server sessions smarty sms source space sql stored syntax system table traffic tutorial unicode up-to-date update upload url validation validator variable video web webapplications youtube





