Jump to content

cyberRobot

Moderators
  • Posts

    3,054
  • Joined

  • Last visited

  • Days Won

    27

cyberRobot last won the day on October 22 2020

cyberRobot had the most liked content!

1 Follower

About cyberRobot

Contact Methods

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

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

87,451 profile views

cyberRobot's Achievements

Prolific Member

Prolific Member (5/5)

127

Reputation

25

Community Answers

  1. For future reference, if you're not interested in switching editors, you could also run your HTML code through W3C's Markup Validation form here: https://validator.w3.org/ Also note that you may want to review the documentation for the <label> tag. You'll either want to have the <label> tag surround both the label and the input field. If it's not around both, you'll need to use the "for" attribute to connect the <label> tag to the corresponding input's "id" attribute. More information can be found here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label There's an easy way to test most <label> tags to make sure they're working. If you have a label and a text input, for example, clicking the label will put the text prompt (aka flashing cursor) in the corresponding input field.
  2. So...where are you stuck? Do you have a process for converting the XML data into something that PHP can loop through? If not, you may want to try PHP's SimpleXML extension. More information can be found here: https://www.php.net/manual/en/book.simplexml.php As for the human-readable headings, you could try looping through the "Entity" elements, looking for the one where the "id" is equal to "1". Then go on to process and output the remaining "Entity" elements. If you have control over the XML code, it might be better to modify things so the headers are stored using unique tags. That way you can just grab them without needing to loop through all the "Entity" elements.
  3. If I'm reading everything correct, the "create" script is under todolist_demo > public_html > todo. The "create" script isn't able to find your db.php because the following line only goes up one level. include('../db.php'); Basically, you're telling "create" that db.php is in your public_html folder. You either need to use "../../db.php". Or I would actually recommend switching that line so it starts at the document root. I'm guessing "public_html" is your root folder. If that's the case, you could try the following: include $_SERVER['DOCUMENT_ROOT'] . '/../db.php';
  4. Good luck and welcome!
  5. In case you have control over how $matches is formatted, you could make this easier on yourself by changing the array to something like this: Array ( [0] => Array ( [sku] => 234567 [price] => $33.00 ) [1] => Array ( [sku] => 999888 [price] => $82.44 ) )
  6. You'll want to switch to PDO or MySQLi for working with the database. The mysql_ functions were removed from PHP in version 7.0. More information can be found in the warning box in the PHP manual here: https://www.php.net/manual/en/function.mysql-connect.php
  7. You could use a loop. For example, $mcptitles = array("Volvo", "BMW", "Toyota"); foreach($mcptitles as $mcptitle) { //your existing code here... } Note that I changed the name of variable that holds the array. That way it should hopefully work with your existing code. Also note that I didn't review your code since it sounds like it's working.
  8. I'm not sure why the first URL isn't working. I built a quick test script and that address worked fine for me. I even tried adding the call real_escape_string(), which I thought might be modifying the URL, but everything worked fine. The second "www.google.com" address didn't work for me. However, it worked fine once I added the protocol: https://www.google.com Side note: real_escape_string() is only designed to escape input for use in database queries. If you're looking to escape text for outputting to the screen, you'll want to look into htmlspecialchars() and htmlentities().
  9. When clicking one of the links, does the URL show the correct ID? If so, then the provided code is working fine. As Barand mentioned, we would need to see the code that processes the clicked ID to display the page. Hiding the ID from the URL will prevent people from doing things like bookmarking (or linking) to the pages being generated by the script. So I wouldn't recommend going this route.
  10. Either way works. Once the exit language construct executes, the script stops. It won't do anything with that next if construct when the "user" SESSION variable isn't set. So using else, in this case, is unnecessary. More information about how exit works can be found here: https://www.php.net/manual/en/function.exit.php With that said, if using "else" makes more sense to you...you might consider "elseif" if(!isset($_SESSION['user'])) { exit; } elseif($_SESSION['user'] !== 'SiteOwner') { exit; } And when you get to the stage of blocking multiple user types, you could potentially do something like this: if(!isset($_SESSION['user'])) { exit; } elseif(in_array($_SESSION['user'], array('SiteOwner', 'SiteAdmin'))) { exit; } Note that the above code is untested.
  11. Have you reviewed the information provided by Facebook here: https://developers.facebook.com/docs/sharing/webmasters/ Note that it looks like they have a debugging tool that you can use, under the Testing Your Markup section.
  12. It depends. What are you looking to accomplish? Do you have any experience with HTML? What method of learning works best for you? There are many books that might help, if you're just getting starting. Or I'm sure there are a number of in-depth tutorials online, if you learn better that way. For what it's worth, I regularly use the HTML help docs found on the following Mozilla website: https://developer.mozilla.org/en-US/docs/Web/HTML They do have a few different guides that could get you started here: https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML
  13. Based on the code provided, $user is only being set if the SESSION variable for "username" is set. If you haven't already, I would check to see what that SESSION variable contains when you're getting the error. It's difficult to tell how you should proceed with the information provided. In the end, you'll likely need to test whether $user is set before trying to use it. How you do that depends on the purpose of the page and how your script is set up.
  14. Those are just sample category names. Yours should be +----+--------------+-----------------+ | id | topic_title | topic_parent_id | +----+--------------+-----------------+ | 1 | Authors | 0 | | 2 | General | 0 | | 3 | People | 0 | | 4 | Celebrities | 3 | | 5 | Historical | 3 | +----+--------------+-----------------+ ...etc.
  15. All you should need is the id, topic_title, and topic_parent_id. Where Barand uses "service", you would use "topic_title". Where Barand uses "parent", you would use "topic_parent_id".
×
×
  • 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.