Jump to content

AbraCadaver

Staff Alumni
  • Posts

    1,893
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by AbraCadaver

  1. I'm not sure how you're looping through these, but the math is simple (I'm just making up variables names): $hours = ( strtottime($out_date . ' ' . $out_time) - strtottime($in_date . ' ' . $in_time) ) / 3600 // seconds in an hour
  2. <select name="my_select[]" multiple="multiple"> Then you have an array of: $_POST['my_select']
  3. $_POST['image_upload_box'] ? You probably want: $_FILES['image_upload_box']['name']
  4. $table = trim($table); if ($table == 'pigs' || $table == 'sheep' || $table == 'goats' || $table == 'cows' || $table == 'flamingoes') { echo "blah blah blah"; } else { echo "bleep bleep bleep"; } Or you can do something like: $animals = array('pigs', 'sheep', 'goats', 'cows', 'flamingoes'); if(in_array(trim($table), $animals)) { echo "blah blah blah"; } else { echo "bleep bleep bleep"; }
  5. You need to identify the row by a unique field, normally an id. So in the form set a hidden input to the value of the id, like: $id = $r['id']; echo '<input type="hidden" name="id" value="' . $id . '">'; Then get the id from $_POST and use it in the query: $id = (int)$_POST['id']; mysql_query("UPDATE table SET col8='Y' WHERE id='$id'");
  6. MySQL always returns strings, so cast the value to an int when you use it.
×
×
  • 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.