in Education by
I am new to PHP as you may be able to tell from the question. What I have is an iOS application that accesses a database via an apache server using a php front end. I have managed to get a user inserted into the database using a POST on a php script called NewUser.php The thing I am struggling with is how to organize the files and whether or not I need multiple php scripts for each query I want to run on the database or I am able to handle each different POST request in the same script? As I said I am new to the concept of PHP. If anyone could point me in the right direction to maybe a tutorial or give me some pointers on here that would be great! Disco JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
yes, you can handle more type of POST requests in one script. For example script name is action.php and inside is code: switch ($_POST['action']) { case 'insert_user': // code for inserting new user break; case 'delete_user': // code for deleteing user break; // and so on ... } and when are you doing POST request you will have to add parameter action which one will indetify the correct action. POST /action.php HTTP/1.1 Some headers action=insert_user&name=John&surname=Doe....

Related questions

0 votes
    How should I handle /_ah/start and /_ah/stop requests? Right now they're just getting 404s. Also, ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    Annotation used for handling GET requests? 1. @PostMapping 2. @GetMapping 3. @PutMapping 4. None of the Above...
asked Jul 8, 2021 in Education by JackTerrance
0 votes
    This is a cURL function that can send or retrieve data. It should work with any PHP app that ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    I need to Separate multiple Array entries with a newline. the names in the aray value. Again I want ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    What I'm trying to do here is use the 2 functions but I don't know how to use both of them ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    What I'm trying to do here is use the 2 functions but I don't know how to use both of them ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    I am a beginner and I just need a bit of help on why I getline is showing an error: this is what I have so far ... payments[MAX_ITEMS]; ifstream iFile; if ( argc != 2 ) { cout...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I am a beginner and I just need a bit of help on why I getline is showing an error: this is what I have so far ... payments[MAX_ITEMS]; ifstream iFile; if ( argc != 2 ) { cout...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    What is the necessity to create a separate file after having an API key? (a) To hold configuration ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 22, 2021 in Education by JackTerrance
0 votes
    Do any C++ GNU standalone classes exist which handle paths cross platform? My applications build on Windows ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    Do any C++ GNU standalone classes exist which handle paths cross platform? My applications build on Windows ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    Do any C++ GNU standalone classes exist which handle paths cross platform? My applications build on Windows ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    What is File Handling in C#.Net?...
asked Apr 1, 2021 in Technology by JackTerrance
0 votes
    ______________ helps you when you organize development projects by allowing to distribute project work for individual ... Requests. A. Transport Request B. Transport Organizer...
asked Feb 20, 2023 in Technology by JackTerrance
...