{"id":18762650,"url":"https://github.com/redsign77/myclasses","last_synced_at":"2025-12-05T10:30:27.715Z","repository":{"id":24934704,"uuid":"28352006","full_name":"RedSign77/MyClasses","owner":"RedSign77","description":"create repo","archived":false,"fork":false,"pushed_at":"2015-03-12T20:12:32.000Z","size":244,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T05:12:07.490Z","etag":null,"topics":["classes","myclasses","php","sql-query"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RedSign77.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-22T18:15:09.000Z","updated_at":"2017-10-12T16:08:34.000Z","dependencies_parsed_at":"2022-08-23T08:50:53.472Z","dependency_job_id":null,"html_url":"https://github.com/RedSign77/MyClasses","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedSign77%2FMyClasses","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedSign77%2FMyClasses/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedSign77%2FMyClasses/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedSign77%2FMyClasses/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RedSign77","download_url":"https://codeload.github.com/RedSign77/MyClasses/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239661243,"owners_count":19676404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classes","myclasses","php","sql-query"],"created_at":"2024-11-07T18:22:36.409Z","updated_at":"2025-12-05T10:30:22.415Z","avatar_url":"https://github.com/RedSign77.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"#MyClasses is a package folder with my usable or developed classes.\n\n###Please use carefull!\n\n##IDatabase\n\nThis class is a MySQL Database access wrapper using MySQLi.\n\nIt can:\n- Connect to a MySQL server\n- Get MySQL server statistics\n- Execute a SELECT SQL query and return all the results into an array\n- Execute SQL INSERT, UPDATE and DELETE queries given the SQL query\n- Execute SQL INSERT or UPDATE queries given the table name, the list of field names and values\n- Get the number of records in a table that match a given condition\n- Get a single field or a single row of a table that matches a condition\n\n####Sample uses:\n\nInclude the neccessary classes:\n```php\ninclude_once 'classes/IDatabase.class.php';\ninclude_once 'classes/EException.class.php';\n```\n\n...or use autoload.\n\nCreate a connection and run a basic query:\n```php\n$connection = IDatabase::getSingleton();\n$sample = $connection-\u003eselect(\"SELECT * FROM sampletable\");\n```\n\n##Wunderground API\n\n```php\ninclude_once 'classes/EException.class.php';\ninclude_once 'classes/IDatabase.class.php';\ninclude_once 'classes/Wunderground.class.php';\ndefine(\"SERVICE_KEY\", \"\"); // Add service key here! \ndefine(\"SERVICE_URL\", \"http://api.wunderground.com/api/!key/!action/lang:!lang/q/\");\n$wunderground = new WunderGroundAPI(SERVICE_KEY, SERVICE_URL);\n\n// Check class data \nprint $wunderground;\n\n// Set city and country \n$wunderground-\u003esetCity('Sydney','AU'); \n\n// Get data, if enable caching then from the cache \n// Actions: forecast, alerts, almanac, astronomy, conditions, currenthurricane, forecast10day, geolookup, hourly, hourly10day, rawtide, satellite, tide, webcams, yesterday\n$ret = $wunderground-\u003egetData('forecast'); \n```\n\n\n##FormDataValidator\n\n```php\nrequire_once 'classes/FormDataValidator.class.php';\n \n$accepted = array('name', 'nick', 'email', 'message'); \n$required = array('name', 'nick', 'message'); \n\n$validator = new FormDataValidator($_POST, $accepted, $required); \n$resp = $validator-\u003evalidate(); \n\nvar_export($resp); \n```\n\n##Basket\n\nInclude main class\n```php\ninclude_once 'Basket.class.php';\n ```\n\nSample summary function for testing:\n```php \n  function summarylist() { \n    $items = Basket::getItemList(); \n    var_export($items); \n    print \"\u003cbr\u003eFull price: \" . Basket::getFullPrice(); \n    print \"\u003cbr\u003eItem quantity: \" . Basket::getItemCount(); \n    print \"\u003cbr\u003eItem types: \" . Basket::getItemtypeCount(); \n    print \"\u003cbr\u003eLast modify: \" . Basket::getLastModify(false). \" (\".Basket::getLastModify().\")\"; \n  } \n```\n\nEmpty basket:\n```php\n  Basket::emptyBasket(); \n  print \"Simple Static Basket with session storage\u003cbr\u003e\"; \n  print \"\u003cbr\u003eBasket (empty) [emptyBasket, getItemList]\u003cbr\u003e\"; \n  summarylist(); \n```\n\nAdd simple or multiple items:\n```php  \n  print \"\u003cbr\u003e\u003cbr\u003eAdd a simple item [changeItem]\u003cbr\u003e\"; \n  Basket::changeItem('sugar_01', 12.25, 'Sugar, 1kg', 0.75); \n  summarylist();\n   \n  print \"\u003cbr\u003e\u003cbr\u003eAdd multiple items [addItemFromArray]\u003cbr\u003e\"; \n  $add_items = array( \n    array('id' =\u003e 'salt_01', 'quantity' =\u003e 4.57, 'name' =\u003e 'Salt, 1kg', 'price' =\u003e 0.65), \n    array('id' =\u003e 'salt_02', 'quantity' =\u003e 3.10, 'name' =\u003e 'Salt, 2kg', 'price' =\u003e 1.15), \n    array('id' =\u003e 'salt_03', 'quantity' =\u003e 2.90, 'name' =\u003e 'Salt, 5kg', 'price' =\u003e 2.55), \n    array('id' =\u003e 'sugar_02', 'quantity' =\u003e 1.34, 'name' =\u003e 'Sugar, 2kg', 'price' =\u003e 1.40), \n    array('id' =\u003e 'sugar_03', 'quantity' =\u003e 13.45, 'name' =\u003e 'Sugar, 5kg', 'price' =\u003e 3.59), \n  ); \n  Basket::addItemFromArray($add_items); \n  summarylist(); \n```\n\nRemove a single item:\n```php\n  print \"\u003cbr\u003e\u003cbr\u003eRemove salt_03 [removeItem]\u003cbr\u003e\"; \n  Basket::removeItem('salt_03'); \n  summarylist(); \n```\n\nChange item quantity, price or name:\n```php\n  print \"\u003cbr\u003e\u003cbr\u003eChange the quantity of salt_02 to 3.45 [changeItem]\u003cbr\u003e\"; \n  Basket::changeItem('salt_02', 3.45, null, 0); \n  summarylist(); \n```\n\n```php\n  print \"\u003cbr\u003e\u003cbr\u003eChange the price of salt_02 to 1.23 [changeItem]\u003cbr\u003e\"; \n  Basket::changeItem('salt_02', 0, null, 1.23); \n  summarylist(); \n```\n\n```php\n  print \"\u003cbr\u003e\u003cbr\u003eChange the name of salt_02 to Sugar, 1.5kg [changeItem]\u003cbr\u003e\"; \n  Basket::changeItem('salt_02', 0, 'Sugar, 1.5kg', 0); \n  summarylist(); \n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredsign77%2Fmyclasses","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredsign77%2Fmyclasses","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredsign77%2Fmyclasses/lists"}