Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. When using a variable which is an array within a string you should warp them with braces {} Also it is not recommended to place raw $_POST data into a query. You should atleast validate and escape/secure user input before using it within a query.
  2. Is that all the configuration? As it appears there must be more which the following error you posted suggests, unless it is an old error: [sun Feb 17 16:45:30 2008] [alert] [client xxxxxxxxx] W:/www/.htaccess: <Directory not allowed here In which case it should cause a 500 Internal server error rather than a 403 Forbidden error.
  3. You'll have to use javascript for this. Tutorial: http://www.shiningstar.net/articles/articles/javascript/confirmsubmit.asp
  4. What is the script you are trying to run? Make sure you are not using shorthand tags (<? ?> or <?= ?>) for your PHP scripts. If your script is quite large then enable a setting called short_open_tag within the php.ini Your Apache configuration appears to be fine.
  5. Do you have error_reporting set to E_ALL and is display_errors enabled? Also are you using the CodeIgnitor framework?
  6. simpley add $id = $_GET['id']; in between the parenthesis for Lumios code, eg: if (isset($_GET['id'] && is_numeric($_GET['id'])) { $id = $_GET['id']; } else { die('Invalid id'); // display error if id is not numeric; }
  7. Check Apaches error log for why. What configuration is contained within the .htaccess file?
  8. Try adding GROUP BY tbl.lodgename field here to the end of your query, should stop the duplicates.
  9. Try: SELECT ( IFNULL( displayname, CONCAT_WS( ' ', firstname, lastname )) ) AS display_name FROM users Seems to do the trick. Not bad for a quick test and first try.
  10. Just subtract their brith year from the current year, eg: $dob = '28-08-92'; $birthYear = date('Y', strtotime($dob)); $curYear = date("Y"); $age = $curYear - $birthYear; echo 'Your age is: ' . $age . ' years old';
  11. Could you explain what are you wanting to do with the code? Get the persons age?
  12. What you could do is do the following when mysql_connect returns an error @mysql_connect('lcoalhost', 'username', 'passsword') or die('maintenance message here');
  13. You made sure Apache is running before going to http://localhost? What happens if you go to http://localhost instead.
  14. In the following few lines: // initialise errors array // $errors = array(); // check for empty fields use javascript to // if(empty($email) || empty($password)) { $errors = "<br /><div class=\"formerror2\"><img src=\"images/cross.gif\"> <b>You never filled in both login fields.</b></div>"; } You initiate the $error variable as an array. Then a few lines down you are reseting the $error variable as a string which is why you are getting the error message. You should add [] after $error to add the string to an array. So use the following instead: $errors[] = "<br /><div class=\"formerror2\"><img src=\"images/cross.gif\"> <b>You never filled in both login fields.</b></div>";
  15. Thread locked. Do not double post.
  16. In order for strtotime to return a unix timestamp it requires a valid english readable date, eg: 2/16/2008 23:00 not 2 16 2008 11 PM You might want to look into mktime rather than strtotime. Also no need to use date either to convert the value strtotime returns as it already returns a unixtime stamp. Another thing which is not required (and irritates me - no offense) is ending lines with empty strings after/before using a variable (."");
  17. If you are getting strange characters like:  outputted and their not within your PHP code then make sure you are saving your .php files as ANSI encoding and not UTF-8. I have had this issue before awhile back and it was to do with file encoding when saving.
  18. Yes. However you'll have to code the function yourself, there is not a builtin function for this. You'll want to read up on opendir and readdir functions.
  19. The problem is you're using both mysqli_* and mysql_* functions. You cannot use both function types together they are incompatible. You'll have to convert all mysqli_* functions to the old mysql_* functions if you dont want to use mysqli based functions. However mysqli_* functions are compatible with MySQL4.1.3 or above according to php.net. Your mysql queries are most probably the issue and not the code.
  20. This is a known issue. We have recently upgraded the forums and it hasn't been added back yet. However this is not a high priority issue currently due to our forums being hacked recently. I'm assuming your using a form and submitting the data via POST to each page. In which case your can just use a hidden form field to transfer the RecordID from page to page.
  21. Upon opening the attached file It had some strange É type characters in place of where spaces should be. Doing a simple find and replace within my PHP editor to convert these chars to spaces allowed the script to function correctly.
  22. PHP cannot be called based on events happening in the browser. If you want to call a PHP script when someone clicks a button/link and not refresh the page then you'll need to look into AJAX.
  23. A better way would be to set the ServerAlias direcitive to www.subdomain.domain.com within the virtualhost for subdomain.domain.com <VirtualHost *:80> DocumentRoot /path/here/ ServerName subdomain.domain.com ServerAlias www.subdomain.domain.com </VirtualHost>
  24. Change your code to: mysql_query("insert into test values (' ', '$day', '$date', '$location', '$time', '$division', '$team1',' ','$team2,' ','$comments') or die('Query error: ' . mysql_error()); echo 'Success';
  25. Your code will output xxx because you are not saving the changes back to the original string. You seem to be confused with how foreach works. str_replace can take an array of replacement words to be replaced by a single string, Your code can be simplified to just: $words = array("mum","dad","sister","brother"); $string="i got a sister"; echo str_replace($words, 'xxx', $string); // result: i got a xxx
×
×
  • 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.