Jump to content

CroNiX

Staff Alumni
  • Posts

    1,469
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by CroNiX

  1. Because you're trying to access an array element instead of the object.

     

    foreach($xml->results as $result) //cycle through results object
    {
      //access the properties of this $result object
      echo $result->name;
      echo $result->longitute;
    }
  2. Yes, the OS has control of lastmtime. Whenever something is changed on a filesystem, THAT filesystems OS sets the lastmodtime. So if you upload a file to a server, that servers OS is updating the file on the filesystem so it automatically changes the lastmtime.

     

    Perhaps a better way would be to name your files to contain the date of the sermon, and use that as that won't change when uploading.

     

    2015-04-25-sermon-name.mp4

    2014-08-25-sermon-name.mp4

  3.  POST variables are returned as String afaik, so they needs to be converted into integer for integer comparison

     

    So this should do the job:

      if ((int)$value >= 0.0 && (int)$value <= 10.0) {

    Except you probably don't want to cast floats as integers, or 5.5 will be the same as 5.2 (both would be just 5)

  4. The best way to address the name issue is to deal with it when the file is UPLOADED. Replace spaces with underscores, remove apostrophes, etc. from the uploaded filename. Then you won't have this issue of having to encode/decode, etc.

     

    Personally I'd just use preg_replace and replace anything in the filename that isn't alphanumeric, a period, an underscore or a dash.

  5. 2 UL's in the same div#navbar. First UL appears on left, 2nd UL appears on right. Both ULs have "nav navbar-nav" classes. The one to appear on the right has an additional "navbar-right" class.



    <div id="navbar" class="collapse navbar-collapse">
      <ul class="nav navbar-nav">
        <li class="active"><a href="/">Left Menu</a></li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#">Right Menu</a></li>
      </ul>
    </div><!--/.nav-collapse -->


     

    I think yours shows on next line because your 2nd UL, the one that's supposed to show on the right, is outside of the div#navbar container.

  6. I don't believe you can the way you have it.

     

    You can't use decimal numbers as array keys. If I copy/paste your $kz array and just print_r($kz), you get back whole numbers for the array indices instead of your decimals (24.4 becomes just 24).

     

    If your keys were strings containing a decimal, then it could be workable.

  7. This might work:



    $new_array = array();
    while ($row = mysql_fetch_array($db_result)) {
          //grab the name column from the array
          $name = $row['name_column'];
     
          //unset the name column from the original array
          unset($row['name_column'];
     
          //create a new key using the name column and set the value to the $row
          $new_array[$name] = $row; 
    }
    print_r($new_array);

  8. The problem is when you run the function.

    findNumber($arr);

    Your function returns a value, but you aren't capturing it. You then try to use it here

    if ($found == true) {

    $found does not exist except inside of your function, so anything outside of the function doesn't know anything about it. This is called variable scope and I suggest you read up on it.

     

    To fix it, change

    findNumber($arr);

    to

    $found = findNumber($arr);
  9. To build on what Barand is saying, checkboxes that are not checked do not get sent in a GET/POST request. Only checked checkboxes (and radio selectors). So you need to check to see if it exists in POST/GET, if it does not, set a value like 0 before saving in the database. See Barands link above for an example.

  10. How do you know it was successful? You just return true no matter what.

    The mail function returns a boolean, you should use that.

    mail($to,$email_subject,$email_body,$headers);
    return true;

    One other thing I noticed, is headers need to be separated with \r\n, not just \n.

    $headers = "From: whitegatescattery.com\n";
    $headers .= "Reply-To: email@gmail.com";

    As far as the appending error messages in your second code block, it's probably because you do a var_dump(), which sends that output back to the browser.

×
×
  • 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.