Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

gizmola last won the day on August 18

gizmola had the most liked content!

7 Followers

About gizmola

Contact Methods

  • Website URL
    http://www.gizmola.com/

Profile Information

  • Gender
    Male
  • Location
    Los Angeles, CA USA

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

gizmola's Achievements

Prolific Member

Prolific Member (5/5)

344

Reputation

62

Community Answers

  1. Try catch blocks should only be used for situations where exceptions are expected, and from which you can recover and proceed.
  2. The first thing we need to know is what workstation/operating system you are using. Web Development is non-trivial. People misunderstand this because they see that HTML is easy, and then CSS and a little bit of javascript, and everything works. They get a simple PHP script up, and think "wow this is easy". Then something doesn't work the way they expected, and they can't debug or figure it out, and get completely lost, because they don't have any foundation or fundamental understanding of how the web actually works. We see it here weekly, I would guess. There are many different ways to proceed with development, as well as many different deployment platforms, and architectures that are used. So there's no easy answer on exactly what pre-requisites or plugins might be helpful to you. To add to the Web Development with PHP iceberg (and to 2nd my friends who already have replied): You need to understand a bit of Linux ssh (how to make an ssh key pair) You want to make a github account (free) You want to learn how to configure your github account with your ssh pub key I actually use Vscode for PHP development (whereas many of the experienced devs here use PHPStorm, which is the de facto industry standard IDE for PHP development). Vscode comes with html/javascript/css support built in. It also has some built in support for PHP, but it's not recommended. Instead people install the Intelephense plugin. The important thing is to look at the readme and carefully follow the instructions on disabling the php plugin that comes with Vscode. You can pay a relatively small fee to license Intelephense, and unlock some of it's more advanced features, but I wouldn't rush out to buy the license immediately, although you should keep it in mind. The one benefit of Vscode is the many plugins available, and Python support is easy enough to add.
  3. What is System A? Oracle provides a number of Sample schemas you can use, and are often referenced by people who write about Oracle databases as in the case of the "Mentors" site that was originally based on Tom Kyte's long running "Ask Tom" Q&A series. Oracle Mentors (Ask Tom) site Oracle Sample Schemas
  4. So... why are you using Kali Linux? It's a distro designed for pen testing. Why are you using Xampp? It's an install kit that was built for people trying to put a LAMP stack on windows, where it is (for many reasons) rarely deployed in production. Neither thing makes much sense to me, but if we just skip over those questions, Kali is based on Debian. Debian has apt. You can install the lamp stack directly using apt. "still not working" is not helpful for people. What specifically is not working? Is xdebug available (verify via phpinfo() How are you trying to configure xdebug? Where/how is the [xdebug] section being loaded, and what are the contents of that section? When you install php components from packages, these things tend to be setup for you, and changing configurations is also more sensible. Xampp is almost never used for production, which only complicates things, assuming that you are using Kali as a development workstation, for code you ultimately plan to deploy to a production environment running on linux.
  5. That sounds really bad. 12 Copies of the same script with the same code? No, the way is not to replicate that insanity. Have one copy and require_once() that file everywhere else it is needed.
  6. What you are asking for makes no sense. Guessing what you meant to say, is that the "charges" should be added to the withdrawal amount prior to the balance check, so that withdrawal will not be allowed. This seems like a very simple change to the logic of the withdrawal check. Since you provided no code, there is nothing more that anyone can do for you at this time.
  7. Hi Barry, I think there's a problem with this solution: 2 and 128 are in check with each other.
  8. It's unclear to me how navigation to the spanish/german versions work, but if there are links you can add rel="canonical" to all the links and that should fix things. With that said, this issue is covered in their localization documentation: https://developers.google.com/search/docs/specialty/international/localized-versions If you have a sitemap file, then follow the instructions for adding entries for each language. I'm guessing you don't have a sitemap, so an alternative is to add this type of block to the header of each page. This is very doable for you because you only have 6 pages. (2 pages x 3 languages). This is for example only, copied right out of the google documentation and modified slightly to be closer to what you described, but otherwise what from what I linked for you above: <head> <title>Widgets, Inc</title> <link rel="alternate" hreflang="en" href="https://example.com/index.html" /> <link rel="alternate" hreflang="de" href="https://example.com/de/index.html" /> <link rel="alternate" hreflang="es" href="https://example.com/es/index.html" /> <link rel="alternate" hreflang="x-default" href="https://www.example.com/" /> </head> So keep in mind that something similar to this section would go into the header of all the 3 index.html files. You will have a different section for the 3 tour.html files, that points to your 3 variations. Language Codes come from ISO-639-1. Country Code come from ISO 3166-1 alpha-2 Since it sounds like this might be a country specific business, you might want your hreflang codes to be: en-GB - English - Great Britain de-DE German - Germany es-ES Spanish - Spain
  9. My first experience with OOP was ages ago, but the general idea of what objects are stayed with me, and made Oop much easier for me to understand. Certainly with PHP you are used to working with PHP's complex data structure: the array. I'm guessing you are comfortable with the idea that an array exists in program memory, and the data in the array can be manipulated. When using database api's they typically have methods that return an array with the data from the database query filled in. You are also familiar with functions. You have written functions to do various things, and are familiar with calling functions that take parameters and can return a result. An object is simply a combination of the two: the data structure which includes some combination of data types, and functions you have defined which are typically pre-wired to be able to work with the variables you set up in the class. A class is just the definition of the variables and the functions (typically called methods) that are designed to work with the class variables. A class definition is simply the blueprint for creating an object that has this binding of data and functions. Once you think about it in that way, I think it helps to demystify Oop. An object is just some data + functions (methods). It's a data structure that combines both together. The functions aren't actually copied in every object -- they exist in the code segment of the program/runtime environment, and objects basically just have a table that references the function code, but as an abstraction, you can just think of the object as being a complex variable type with functions bound into it. When dealing with functions, you have to contend with the ways variables can be passed to a function, namely pass by reference vs pass by value. With Objects, they are always passed by reference, so changing an object variable or executing a method that alters object variables will always change the object. Compare this to a function you write, where you pass in an array, change the array inside the function. For example: <?php $a = ['red', 'green']; function addBlue($a) { $a[] = 'blue'; return $a; } $b = addBlue($a); var_dump($b); var_dump($a); You should know that $a is passed by Value here, so when the function completes, the original $a array is unchanged. array(3) { [0]=> string(3) "red" [1]=> string(5) "green" [2]=> string(4) "blue" } array(2) { [0]=> string(3) "red" [1]=> string(5) "green" } In order to actually change the original $a array, you would need to declare that function addBlue's $a parameter is passed by reference: function addBlue(&$a) {...} With objects, you don't need to do this, as all objects are assumed to be passed by reference. I won't complicate this with a discussion of static variable or methods, as they add some wrinkles, but just purely as a user of a database api, this binding of variables/methods into one thing offers a lot of utility, since you don't have to keep track of all the different variables you require or produce. In general, because the objects already contain associated variables, there are less things to keep track of, and the functions designed to work with an object of that class are already a part of it. You aren't constantly having to figure out which function(s) you need to call and passing the variables that have the data you need into them. Your code tends to be simpler, and easier to maintain, even as the complexity of the application increases. Level one of Oop is just getting comfortable using classes and objects that other people provided. You don't need any sophisticated preparation or study of oop design patterns to use all the classes that are baked into libraries and extensions.
  10. You have 2 <head> sections. You can not do that. You can't re-define a new <head> section after you have already defined it.
  11. Good advice from both mac_gyver and Random8. Perhaps you are not clear on this, but once I understand the location of sxdisp.php I can just send data to it directly. As made clear, your password is disclosed in the javascript code. You have essentially no security. If you want something simple and static you can easily implement HTTP "realm" security, which is built into the browser and entails creating a simple password file. Usually people name it .htpasswd You would have the protected scripts in a subdirectory and add a .htaccess file for the directory along with a .htpasswd. There are many different how-to and tutorials on doing this. I just glanced over it, but here is one that covers the basics: https://www.lcn.com/support/articles/how-to-password-protect-a-folder-on-your-website-with-htaccess/
  12. Yes I already answered this. You make a product table. You have a product_type table as a foreign key, that to begin with will have id name 1 Car 2 Truck 3 Package 4 Feature Probably the best way to handle this, based on the information you provided is to create a "product_event_type" table and a "product_event" table. product_event_type ------------------ id event 1 Receive 2 Sell by 3 Return Should be clear this allows you to classify an event for a product. You can of course add other event types to this table if they would be useful. product_event would look like this product_event ------------- id product_id (fk to product) event_type_id (fk to event_type) event_date notes The handling of financials is a non-trivial requirement. It really depends on what you intend to try and do with this data within the system. If I was designing this database, there would be requirement gathering and documentation in some manner, and review of the ERD to make sure the structure would support the requirements. You should see at this point that the "product" table is the hub of the system, so the recording of financial data would probably be in a ledger type table, that relates to product, and to product_event rows.
  13. You have a base table for a product. From there, you have a few different ways of handling categories. Some people want this to be hierarchical, but in general you will have a category or product_type table, that will be a foreign key in the product table. Additionally, people also will have a tag table that has a many to many relationship to product, so that you can apply a variety of tags to describe a product, beyond the single category. However, it sounds like beyond that your question is how to make a package, because a car or a truck or even a bundle of other products or accessories requires some sort of relational solution. These types of structures will sometimes appear in inventory systems as a "bill of materials" feature. So again, return to the original product table. The question to answer is "How can I have products that are comprised of one or more other products, which might be comprised of a set of products"? How I have handled this in the past is to create a "product_relationship" table which has a variety of simple descriptions like "is comprised of", "part of package" etc. For any individual thing that is a feature you want to track, or describe or has an associated price, you will have a product row for that thing. Then you implement a many-to-many relationship between product and itself. You have to understand how you can relationally manifest a many to many relationship between 2 entities. The answer is, you need a table with two keys, both of which relate back to the product table. The product_relationship table will be used to describe how the parent product relates to the child product. product_product ----------------- id (pk) parent_product_id (fk to product) child_product_id (fk to product) So you have a car that is product id 1. You have a package of accessories that might have a name like "sports package" that is product id 2. The individual accessories that are part of the sports package each have a product row (3-6) Product 2 will have these product_product rows: product_product --------------- id: 1, parent_product_id: 2, child_product_id: 3 id: 2, parent_product_id: 2, child_product_id: 4 id: 3, parent_product_id: 2, child_product_id: 5 id: 5, parent_product_id: 2, child_product_id: 6 So now you have the original Car (product id: 1) and the "sports package" (product_id: 2). So you can now have a product which is "Car + Sports package". If this is product id: 3, then you have 2 product_product rows (parent_product_id: 3, child_product_id: 1 and parent_product_id: 3, child_product_id: 2). With this type of structure you can package/combine products with other products or packages of products without limit. I did not illustrate the product_relationship value in the product_product table, but it is very useful for allowing some database driven business rules to be implemented, based on categories, tags, product_type and the product_relationship.
  14. Please use code tags for your code and output. I did some editing of your post to reflect this. Your issue is here: // Iterate over each row in the worksheet in turn for ($row = 1; $row <= $highestRow; $row++) { $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE); print_r($rowData)."<br>"; } You are retrieving one row at a time, into an array variable, you then overwrite on the next iteration of the loop. If you want to make one array with all the rows you have retrieved you would do that like so: // Iterate over each row in the worksheet in turn $rowData = array(); for ($row = 1; $row <= $highestRow; $row++) { $rowData[] = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE); } $rowData will be a multidimensional array, where each element is an array of 2 elements (representing the 2 columns (A & B) in the spreadsheet. Because the first row contains a header, to access the 2nd row You could do something like this: echo "Measure: {$rowData[1][0]} UPS Code: {$rowData[1][1]}"; If you wanted to output all the values: foreach($rowData as $row) { echo "{$row[0]}: {$row[1]} <br>"; } Hopefully, you should now see ways to output the data in whatever markup format you want.
  15. It's all good my friend, we appreciate you being a part of the forum.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.