Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. They're the wrong way round.
  2. $getuserq is declared.. where?
  3. If you're able to access the file system and change permissions, you could chown the directories to the Apache PHP user. That may give you the required write permissions you need.
  4. Assuming `username` is varchar data type (i.e. string not numeric), you'd need quotes around the value: In future I'd just post the relevant code, you'll get probably get more help and a faster response.
  5. $dynVari = '1'; while ($itemArray = mysql_fetch_array($itemRun)) { ${"a{$dynVari}"} = $itemArray[0]; $dynVari++; }; $checkedArray = array($a1,$a2,$a3,$a4); Yeah this is the long way of doing it. You're also limited to a set number of results in the $checkedArray. Much simpler method: $checkedArray = array(); while ($itemArray = mysql_fetch_array($itemRun)) { $checkedArray[] = $itemArray[0]; }
  6. I see. Where did it come from then..? If it's some form of plug-in (as by default I don't believe there's anyway to modify the nav menus?), perhaps you could just enter the entity instead?
  7. The whole idea isn't the same. A method IS a function within a class or object, just like a property is a variable within a class or object. They have different names to disassociate them from one another. I don't get what you mean when you say "look at it at the functions point of view"? Sorry but your last comment is completely meaningless.
  8. Yeah generally you'd use an array to return multiple values, but you could also pass back an object with properties set. A rather more precise answer in general terms. In PHP, functions inside a class is still called function but are somewhat different with the one declared outside so calling the functions inside a class as methods would make things easier to understand. So.. 'the whole idea' isn't the same then, is it?
  9. Yeah, pretty easily. Pass the ID through the URL as you suggested, then retrieve it with $_GET['id']. You could use that within your query, e.g: $sql = 'SELECT * FROM products WHERE id=' . $_GET['id']; However this leaves you open to SQL injections; you need to filter or validate the input. There's many way, and being as it's numeric perhaps the simplest method would be to use intval. For example: $sql = 'SELECT * FROM products WHERE id=' . intval($_GET['id']); This will convert the input to an integer (so you won't get a syntax error for not using quotes around the value if a string is passed) and prevent them from entering any SQL injection.
  10. As the file is included it will be parsed like any other PHP file. If there's static HTML in there that will output like any other static HTML. If include fails it will only raise a warning; require a fatal error. So if you *require* the file be included (and stop execution if it isn't), then you'd use require. Generally I always use require over include. include_once / require_once are the same, except they will include the file only once (as the name implies). If you're including a file full of functions for example, and there's a chance it may get included again (and produce re-declaration errors), you'd want to use include/require_once. include/require_once are slightly more resource heavy though as they have to check if the file has been previously included. If you plan out your application / code properly, you should mostly be able to escape using it. Funnily enough the manual explains all of this.. http://php.net/manual/en/function.include.php
  11. Didn't you add in the link yourselves?
  12. ... and what is wrong with August exactly?
  13. http://validator.w3.org/check?uri=http%3A%2F%2Fwww.phpfreaks.com%2Fforums%2F
  14. You'll need to either preserve the state of the button within a variable, or run a condition on the current background image to determine the new state.
  15. I'm not sure we're thinking the same here..? You only need to echo the img tag like you would any other HTML. You don't need to actually use PHP though, you could just: header("refresh:5;url=http://127.0.0.1/home/ThankYou.php"); ?> Please wait. Your order is processing<br /> <img src="path/to/image.gif" alt="" /> <?php // re-open it if there's more php
  16. I didn't say remove the unlink function, I meant close the IF block after the unlunk function: if (file_exists("uploads/avatar/" . $id.".png")) { //if used ids.png file already exist then delete it first $path_to_profile_imgs="/public_html/pakmoneymatrix.com/new/uploads/avatar/"; $profile_pic_name = $id.".png"; unlink($path_to_profile_imgs.$profile_pic_name); } //Now Upload file move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/avatar/" . $id .".png"); The notice you're seeing isn't strictly an error, it's just telling you that you're trying to use $_POST["file"] without first ensuring it exists. empty implicitly performs an isset check and does exactly what you need: if (!empty($_POST["file"])) {
  17. Well yeah. You just need to display an image.. ajaxload.info is good.
  18. Actually I can't really see anything that would cause problems between any versions 4+. Looking at your logic though, it seems unless the image exists already you don't 'move uploaded file'. I think you should close that IF after the unlink...
  19. The problem with addresses is the format can vary too much, and they're not that different to any other text.
  20. What version of PHP is on your local and remote host?
  21. From the looks of things you're using mysql_fetch_array wrong. With each call it only returns 1 row at a time, you need to loop through it to check every row. I'm guessing it's just a coincidence that since the call is already within a loop, it works up until 3. If you print_r $itemArray within each iteration of the while loop it'll probably make more sense..
  22. A define AKA a "constant", has a constant value; once defined it cannot be changed. Variables are also only available within the same scope, constants are global.
  23. Which menu are we looking at? The pink one's on the left appear to work in IE7.
  24. What's that? You need to use the facebook API!! You need to actually read how to use it!! file_get_contents() will not work!! You need to do something for yourself!!
×
×
  • 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.