Jump to content

HarryMW

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

HarryMW's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks!
  2. Hello, In short, i'm generating rows of records, and checkboxes with them that represent either 1 for ticked or 0 for not... The echo tickbox: <?php echo '<input name="abc_'.$row_ab['id'].'" value="1" type="checkbox" id="val" '; if($row_ab['ABC']>=1) echo 'checked="checked"'; echo ' />';?> The top code: <?php foreach ($_POST as $fieldname => $field) { if((substr($fieldname,0,4) == "abc_") == '1'){ $ABC = '1'; } else { $ABC = '0'; } ... if (substr($fieldname,0,4)=="abc_") mysql_query("UPDATE `table` SET `ABC` = '$ABC' WHERE `id`='".substr($fieldname,4)."' AND `ID` = '$ID'"); } ?> Now the problem is, obviously it will always set the value to 1; I dont quite know what to replace the substr with as it will always be bifferent depending on the id of the entry i'm not too sure how I change rectify that, any ideas?
  3. The latter worked for me, thanks a bunch!
  4. Evening! I've been iffing and ahhing over this and well im not too sure, hence the post. // Redirects if there is no session id selected and echos the error on the previous page if(!isset($_GET['get']) || ($_GET['getget'])){ header("Location: #.php?error"); } So it should simply check if get is set if it isnt then see if getget is set? If not redirect and show the error. Now ive tried it and even when get/getget is set it still redirects, probably something silly. Care to share anyone? Harry.
  5. Well I have a history page and basically it loops all of the results etc... then the id of the result is passed through to the next page with: And if I put the echo at the top (which I did in the begining to check) is echo's the id. I'm just stumped.
  6. Why exactly is the _get returning just nothing everytime? $seshid = $_GET['finish']; // Little things in here ... ///Add lesson plan if(isset($_POST['addinc'])){ if(!empty($_POST['inc'])){ $inc = addslashes($_POST['inc']); mysql_query("INSERT INTO `group_sessions_lplan` (`group_sessions_lplan_id`, `group_session_id`, `plan`) VALUES ('', '$seshid', '".strip_tags($inc, "<a><b><strong><u><i><span>")."')"); header("Location: ?id=".$seshid."#I"); exit(); } } Not too sure myself, anyone know how I can get it to show its actual value?
  7. I have tried wrapping the table, query and while loop in a big if statement however that doesn't seem to work.
  8. Hello, I have a simply query that will if a simple two different things: $cssyn = mysql_query("SELECT `12` FROM `12345` WHERE `abc` = '$_SESSION[number]'"); $cssy = mysql_fetch_row($cssyn); if($cssy[0] == "YES") { echo "Yes"; } else { echo "No"; } The YES or NO result is stipulated earlier on so thats not the problem. But basically before I added the if statement simply would have echoed a table with all the rows etc from another query. However I would like to give the user a choice between echoeing the results into one table or a neater two. I have separated the code for the table and the queries into two separate files but say if I use: file_get_contents then it just prints the HTML and doesnt actually populate it will the queried parts. Nor if I use something like include() then it wont echo anything, which it wouldnt unless called so what I am asking is: Is there a way to get EVERYTHING from the file if the answer is YES or the other file if NO.
  9. Done! Thanks.
  10. No news? Just to clarify. A typical database entry would be 1500. (3PM) A typical text field entry would 10 or even 00:10:00 (H:M:S) I would like to plus the text field entry onto the database entry. So it would become 1510. Harry.
  11. Little confuzzled. I have got a bunch of listings that will be printed at the end of the page but I need to subtract a time specified in a textbox (send it to itself) on the page. $row['active'] = (strtotime('$row[etd]') + $rwy1 = $_POST['tmatttextfield']); Well this just converts the time in the database which is always going to be a four character number such as: 1300 for 1PM into a time and adds the textbox value to the time. <td width="50" bgcolor="<?php echo $bc?>"><strong><?php echo date('hi', $row['active']);?></strong></td> That just prints it all out formatting the time to only Hours and Minutes. So just to clarify the user would put in say '10' in the textbox which would constitute 10 minutes. The code above should then define that '10' as 10 minutes. Define the database result, ie. 1500 as 3PM and add the 10 minutes to it so it would become 1510. I have been getting some wierd and wonderful results whilst trying to get it to work. Mainly just 1200 though. Harry.
  12. Well. Alright then. To make it clearer what I would like the code to do end product. It would take the $start + $end values. Minus the start from the end to get a value at which point it would put either Hours or Hour. Not just put the word Hours or Hour. But actually echo the time value of the event duration then add the Hours/Hour on the end. Harry.
  13. Thanks that works just perfectly. How would I then go to subtract the start time from the finish to get the duration and if say it was over an hour echo Hours otherwise Hour? Harry.
  14. Hi... again. I really should donate to here or something, I use it so much and feel so bad. Ah well. All I need to do (in theory) is change something like this 1500 into a time which would obviously be 1PM. Basically I am going to be plotting a beautiful graph with all this but need the axis to begin with. In the case below the time it starts is 1500 and finishes at 2200. // LOOP FROM START TO END $i = $eventecho['etd']; $ii = $eventfecho['eta']; while ($i <= $ii) { if($i == $ii) break; echo $i . "<br>"; $i = $i + 30; } This outputs: 1500 1530 1560 1590 1620 1650 1680 1710 1740 1770 1800 1830 1860 1890 1920 1950 1980 2010 2040 2070 2100 2130 2160 2190 Which is should. But obviously I just want the values: 1500 1530 1600 1630 etc.. ? So how exactly do I get the raw value which would be: "1500" and "2200" to turn magically into a time. Thanks, Harry. (Again, apologies for always posting, but im in the shtook.)
×
×
  • 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.