Jump to content

Zane

Administrators
  • Posts

    4,185
  • Joined

  • Last visited

  • Days Won

    10

Zane last won the day on October 24 2019

Zane had the most liked content!

About Zane

  • Birthday 08/05/1986

Recent Profile Visitors

21,877 profile views

Zane's Achievements

Advanced Member

Advanced Member (4/5)

64

Reputation

2

Community Answers

  1. another status

  2. new status

    1. Zane

      Zane

      repllyaind

  3. I just realized how old this thread is.
  4. I would use the "if not" part twice \(([^\(]*\brequired\b[^\)]*)\) The \b boundaries aren't exactly necessary, but I consider good practice in case your word appears inside another word.
  5. Why do you have a period in front of $root? Besides, that, this should work (without the period)
  6. Zane

    Greetings

    Welcome aboard, yavko!
  7. We're excited to announce that we have a Discord server now. We've been trying to come up with a supplemental way for users to interact, connect, learn and teach through chat. The IRC server hasn't exactly been very dependable, and we've agreed this is the next best thing. Click the link below to join us! https://discord.gg/7Svm6kJB4d
  8. What exactly is your desired output? You provided what $final_array looks like, but you didn't clarify if that's what you're expecting. Are you simply asking for a better strategy?
  9. In the tryguess.php file, encase the code into a function. On your trynumber.php script, include the tryguess.php script Put the HTML in this trynumber.php script change the form to POST to itself run the function, included by tryguess.php, within the HTML to output the string you want.
  10. Can you emphasize a bit more about your number system? As far as keeping the number, you would need to keep those in another table that has a status column called, say, "available". The value would be 0 or 1. Then, you can do a query to get or set the availability of the number. Give said table a "member" id column and you can link the two the tables (members table and the numbers) It may help if you described more what this "number" is that must be recyclable. Lastly, the rule of thumb for a normalized database is to always have a primary key that is just integer auto-incremented, nothing more. If you want to do further indexing, then add a unique index column for foreign keys to your "number" table.
  11. You provided a screenshot of your desired format: a button next to a button. However, you say that it kills the page. Do you have a way of showing us that? Even if I use Developer Tools to add a button with copy/paste, it doesn't break the page and there is a button next to a button with no issue. What part of the page is killed?
  12. https://www.php.net/manual/en/function.simplexml-load-file.php So using the syntax $path->name will not work and will throw such an error $simplexml_load_file returns one SimpleXMLElement But why even use xpath()? You could just do this. <?php $string = <<<XML <?xml version='1.0'?> <GoogleCodeBase> <result> <geometry> <location> <lat>LATITUDE</lat> <lng>LONGITUDE</lng> </location> </geometry> </result> <result> <geometry> <location> <lat>2nd LATITUDE</lat> <lng>2nd LONGITUDE</lng> </location> </geometry> </result> </GoogleCodeBase> XML; $xml = simplexml_load_string($string); $o = $xml->result->geometry->location->lat; echo $o; /* If you wanted the second result instead, you'd treat it like an array */ $xml = simplexml_load_string($string); $o = $xml->result[1]->geometry->location->lat; echo $o; ?>
  13. I completely agree with Barand. There is definitely a more efficient way of doing this, but it is your choice to keep doing it this way. You could at least set up a sandbox/staging version of your site and practice with different approaches, but that's just me saying things. In any case, we need more information: What does your table schema look like? What kind of output are your receiving? What do the arrays look like once you've looped through everything? Why aren't you just exploding on the comma? Step by step, what is going on here. Echo it all out and show it to us. We only have a snippet of your code and very vague output. I completely understand the concept of the format Google Product Feeds is looking for. You want the id of the product to be the ID in the database concatenated with a "-" and the size number. You also want to maintain that id before concatenating and use it for your item_group_id. Rather than just slapping a snippet of code on here, please walk us through the whole process. Without any substance, there isn't really a question, is there? GIGO is what they call it. Your answers will only ever be as good as the question you start with. Here's a snippet of code I like to use for debugging, which would definitely help you out in improving your question. echo "<pre>", print_r($data, false), "</pre>"; $data can be anything, a string, an array, an object, a boolean, it doesn't matter. print_r's first argument is expected to be mixed.
  14. I would make students[modules] an array of module objects instead of an associative array with numbers in quotes. var data = { "students": [ { "name": "Eric Smith", "modules": [ { "id": "COMP40003", "name": "Software Development", "result": 80 }, { "id": "COMP40001", "name": "Digital technologies", "result": 71 }, { "id": "COMP40004", "name": "Web Development", "result": 47 }, { "id": "COMP40002", "name": "Networking Concepts and Cyber Security", "result": 0 } ] }, { "name": "Student Two", "modules": [ { "name": "Module 1", "result": 44 }, { "name": "Module 2", "result": 5 }, { "name": "Module 3", "result": 34 } ] } ] }; And then loop through it using the native array function forEach() data.students.forEach(function(i){ console.log(i.name); console.log("======================"); i.modules.forEach(function(j){ console.log(j.name + " " + j.result); }); console.log("======================"); });
×
×
  • 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.