Your SlideShare is downloading. ×
Options Database Storage PHP
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Options Database Storage PHP

1,254
views

Published on

Learn how to store and retrieve miscellaneous data into the database.

Learn how to store and retrieve miscellaneous data into the database.


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,254
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Options
  • 2. OverviewObjectiveLearn how to use the options for storing and retrievingdata.Requirements ProdigyView with an installed and accessibleEstimated Time10 Minutes www.prodigyview.com
  • 3. Follow Along With Code Example1. Download a copy of the example code at www.prodigyview.com/source.2. Install the system in an environment you feel comfortable testing in.3. Proceed to examples/util/Options.php
  • 4. What are options?Options is a type of storage that stores information in thedatabase based upon one or more keys.Options are great for when you want to storemiscellaneous data or data that might not fit into thenormal schema design.Options are tightly integrated to ProdigyView and can beassigned to a user, a specific content, or an application.
  • 5. Adding An OptionAdding an option will create a unique option. Rememberto pass the value you want to store in the option in theoption_value.
  • 6. Setting An Option Setting an option and adding an option are different commands. Adding an option will create a unique option. Setting an option will update or create a value in the database defined by specific parameters.1. Parameters 2. Value 3. Set the option
  • 7. Adding vs Setting Visual The visual below assumes that the parameters passed in each method are the same. Method Called DatabasePVTools::addOption New OptionPVTools::addOption New Option New OptionPVTools::addOption Empty Slot Empty Slot Empty Slot PVTools::setOption Option Placed PVTools::setOption Empty Slot Empty Slot PVTools::setOption Empty Slot
  • 8. Set Option to Update Using the setOption method, we can update an options current value if the other parameters passed are the same. Changing on of the parameters will create a new option.Keep thesameparametersto update Update option_value with new data
  • 9. Iterate and Update If we used the addOption method, there might be instances where we have multiple options with the same parameters. We can retrieve those by iterating through the options. The getOptionList() follows the PV Standard Search Query arguments.1. Get the option list of all the options currently stored 2. Update the option by passing it back through
  • 10. Updating the option Looking closer at the options retrieved from the database on the last slide, the list is an array of arrays. When updating an option, it is important to pass that array back with the changed values in the updateOption method.1. Iteratethrough thearray ofarrays2. Set a newvalue in the fieldin the option 3. Update the option by passed it back through
  • 11. SearchingOne of the things we can do is specify the parameters tosearch for. Using the syntax in a PV Standard SearchQuery, we can narrow the options retrieved. Search only for the option with type as coffee
  • 12. DeletingThe last step is deleting an option. In order to do so, youmust have the option_id and pass it to the methoddeleteOption. Delete the option by it’s id
  • 13. API ReferenceFor a better understanding of the tools and options, visitthe api by clicking on the link below.PVTools More TutorialsFor more tutorials, please visit:http://www.prodigyview.com/tutorials www.prodigyview.com