Jump to content

balorok

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by balorok

  1. Hey, thanks for that. My query is sound, and it works. I had an error in my html call to a javascript that would execute the query located in the other php file. get this: <input type ="hidden" name="projects" valueS="<?php echo $array; ?>"> should have been <input type ="hidden" name="projects" value="<?php echo $array; ?>"> without the damned S. I'm sorry for wasting ya'lls time with what turned out to be my muddled, sleep deprived brain missing something simple. I do appreciate your timely responses however, and your code snippet actually helped me identify that the problem was not with my query, but somewhere else, which let me track this down. Once again, many, many thanks.
  2. Actually, that was just a lost in translation typo... must have changed the = to a - while I was copying it. So, that wasn't the error, still won't update my DB correctly. If I remove the last AND condition, it'll work, but it's updating more rows than I'd like it to. I'm worried I don't have the right syntax to traverse my array and use each element in a query.
  3. Okay, So I'm trying to write a query that will update a certain value in my database, but I want it to update only when 3 conditions are met. Basically, I want to update a column of ints in my DB (mysql) from 0 to a 1, if these criteria are met. 0 and 1 are the only values that are valid in this particular column. dbquery("UPDATE times SET approval = '1' WHERE id = '$id' AND time <= '$currentTime' AND project = '$project'"); that is my query. Now, I'm not even sure if THIS part works. It is however, slightly more complicated in that this query is actually embedded in a foreach loop: $result = $_REQUEST["projects"]; $delimiter - ","; $projectArray = explode($delimiter, $result); foreach($projectArray as $project){ dbquery("UPDATE times SET approval = '1' WHERE id = '$id' AND time <= '$currentTime' AND project = '$project'"); } If you can make any sense of that, and if you can point out any glaringly obvious mistakes here, I would appreciate it. If you need any other information let me know. Thank you all for your help.
×
×
  • 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.