Jump to content

PHP Monkeh

Members
  • Posts

    409
  • Joined

  • Last visited

    Never

Everything posted by PHP Monkeh

  1. I'm surprised why you came to a PHP forum, rather than the WordPress site http://codex.wordpress.org/ has all the answers. If you're "in the loop" I think the code is the_ID() to get the post/page ID
  2. Well we'd need to see the code for your function to correct it, but I'd guess that it doesn't return any values. Example: <?php function the_ID() { return 2; } $id = the_ID(); echo $id; // 2 is echo'd ?>
  3. PHP has a configuration setting for the maximum upload file size - way below 100MB by default (usually hovering around 16MB or so I think). You can no doubt ask for this to be increased, but I'd be impressed if your host upped it to 100MB, never mind 300MB. And as you've already noted the page would need to be open for the entire duration of the upload, you could probably find a script out there which will generate a dynamic progress bar or something similar. I'd suggest setting up an FTP account for these users, and just restricting them to one directory - there's nothing particularly risky about this method, especially if you move it outside of the www root so that it can't be accessed and run from the web.
  4. Remove those brackets when you assign variables: $subject = ("recommendation from: ".$name); Should be: $subject = "recommendation from: " . $name; Also note that you can include strings within " ", so you could just do: $subject = "recommendation from $name"; Try this with your $message, but if you wanted to end quotes and begin again you would need to do this: $message = "Hi,</br></br> " . $name . "wanted to share our website, http://www.example.com with you. We hope you find it interesting!.</br></br>Kind Regards</br>Example.com";
  5. It's happening in Firefox as well hedgehog. I'm guessing you're running html_entities() or something on the values pulled from twitter? As the browser is outputting this as the URL: <a href="http://twitpic.com/xor4p">http://twitpic.com/xor4p</a> When obviously that should be: <a href="http://twitpic.com/xor4p">http://twitpic.com/xor4p</a>
  6. @OP: is this just in a general array or is this going to be part of a MySQL query?
  7. The first error referrs to these two lines: $file_t = $location . "functions/tld.txt"; $tlds = file($file_t); Have you deleted the file 'tld.txt' recently or moved it?
  8. You need to do that with JavaScript, as it is client-side rather than server-side. Look in to JavaScript's onChange / onSelect events.
  9. The @ symbol will supresses errors generated by that particular expression. I must admit I only ever see it in function calls rather than like the example you provided.
  10. Make sure it's: $reff = $_GET['reff']; Where 'reff' is the name of the variable in the URL (if the link you posted is the case it will be 'ref' rather than 'reff').
  11. Your second form doesn't contain anything to pass the necessary ID along. You've got 2 options: Either append the necessary variable to the end of the form action like so: <form action="alterNews.php?NewsId=<?php echo $_POST['News']; ?> OR Have a hidden field in your second form containing the news ID like so: <input type="hidden" name="NewsId" value="<?php echo $_POST['News']; ?>" /> You'd need to use $_GET to grab the first method's variable, and $_POST for the second method - the choice is yours
  12. I'm sorry but I can't help. I think what you're missing is a bit of organisation, that file is a mess - sorry but there's no other word for it. It's no doubt a bit late to go back and re-think the structuring of the page but sometimes it's needed. If you've added the necessary get variables to the form action and it isn't working, then I think that's as far as I can help you anyway. It would take too long for me to understand how your code flows, only you know that. The only thing I can suggest is this: add the necessary ?id & page= etc to the form action, load the page (but don't submit). Check the source code (right-click view source) and see whether the form action has the correct values in it.
  13. I bring you: the mail function
  14. Is the problem that the script doesn't execute, or that you just want to be able to launch it with a network drive location?
  15. If it's purely for checking then your function should return either true or false. if($row[$columnName]== $id) { return true; } else { return false; } You can then call that function as part of an if() statement, like so: if($user->checkIdExist("Name","SELECT Name From Users WHERE Name='jose'")) { // Returned true } else { // Returned false }
  16. Although looking up mysql_real_escape_string() is a good start, it's not the solution here. Just wrap single quotes around your strings: $query= "select * from person where emp_id='" . $_POST['user'] . "' and description='" . $_POST['user1'] . "'";
  17. Have you tried echo-ing $_SERVER['DOCUMENT_ROOT'] to see what it produces? You may not be getting the expected result.
  18. It would make that option in the drop-down menu selected by default. Though it's actually wrong as it should be selected="selected" for valid mark-up.
  19. Is it possible for you to post the entire page's code? It's hard to see where errors occur when just getting segments as they might not be where the issue is. If you don't want to post it you can always PM it to me.
  20. There's no difference except the fact one is in capitals and the other isn't. They're exactly the same file types and extensions. You could even have no extension but it still be a jpg image - don't get too attached to them
  21. Which CMS is it that you're using? It may be that you can't embed PHP in to the pages due to the restriction of the CMS.
  22. Yup that's exactly what that part of the code is doing + is used for addition, whereas . is used for concatenation.
  23. I take it $_GET['change'] does actually equal 'Garage_Type' so that form is actually called? Load the page then check the source code, scroll down to where this form is and make sure that it has ?page=ID in the action.
  24. Providing you haven't output anything to the browser, just edit your function to redirect after the statements you want have been executed, like so: <?php function myFunction() { echo 'some statements'; header("Location: newLocation.php"); echo "these won't be shown as you have been re-directed at the line above"; } ?> As for return, you only use that if you want the function to return a value to a variable. Example: <?php function updateName($name) { return $name . " rocks"; } $myName = "PHP Monkeh"; $newName = updateName($myName); echo $newName; // echo 'PHP Monkeh rocks' ?>
×
×
  • 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.