Child pages
  • Chapter 4 - Data retrieval - Retrieving a customer

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Duplicate the file list_the_clientscustomers.php that was created in the previous chapter, rename it to R-CRUD.php, and put it at the root of your Web server.
If you didn't finish the previous chapter, duplicate the file 0-CustomersList.php and rename it R-CRUD.php.

In the XML data that we retrieved, which contains the list of clientscustomers, we will find all the XLinks providing access to customer information.

...

This link retrieves a new XML file, which contains information about the client customer who has ID 1.

In order to manage access to different clientscustomers, we will associate page identifiers with customers via a GET parameter named "id". The link http://example.com/R-CRUD.php?id=1 we will display the file for customer 1.

...

Calling the web service is exactly the same as displaying the list, except that if you need to add the ID element to the table whose value is the id of a clientcustomer.

Currently, we are using the customers or clients resources. If we'd been trying to change the countries resources, this ID would have been a country ID.

...

You now have everything needed to create a script to both list and display information for a particular clientcustomer.

Try creating this R-CRUD.php script. If you encounter any difficulties, follow the example from the 1-Retrieve.php file, which contains the result to which you should get.

...