Jump to content

dgiberson

Members
  • Posts

    87
  • Joined

  • Last visited

    Never

Everything posted by dgiberson

  1. How I handle timeouts is this... In my activeUsers table I store their ID, IP Address, Last Active (TimeStamp), Expires (TimeStamp). This way I can query the db to prevent multiple instances, it updates the table (last active & expires) when they move around the site. So if they don't explicitly logout and just walk away from their computer when an attempt to login/move around the site using that username occurs, I can check against the user to see if their session has expired and force them to login again.
  2. np, anytime
  3. Robin's code will work, here is an alternative: SELECT * FROM table WHERE < condition statements here> ORDER BY <whatever> LIMIT 1229, 5
  4. to me it appears your while loop is before where you attain the information from the database.
  5. SELECT * FROM table WHERE userid = $userid ORDER BY date_time DESC LIMIT 1
  6. change the line     $_SESSION['login'] == $Username; to     $_SESSION['login'] = $Username;
  7. Just a suggestion, you might want to switch over to POST, although I am not sure at what your goal is for this specific page.
  8. yeah whatever you want the logged in user to see
  9. on whatever page just use: if (isset($_SESSION['login']) {   // displaying information to logged in user } else {   echo "You must be logged in to view this page."; }
  10. 1. The checkboxes will always be returned as an array. How are you handling the best day of the week information in your database? 2. My error on the select box last time. Should be:     <td class="body" align="center"><select name="appt_for"> <option value="myself">Myself</option> <option value="son">My Son</option> <option value="daughter">My Daughter</option> <option value="Other">Other</option> </select></td> $appt_for = $_POST['appt_for];
  11. Are you using the GET/REQUEST or POST method?
  12. could you maybe explain this a bit more? do you mean like? | Col 1  | Col 2  | Col 3 | | $var1 | $var2 | $var3 | or Row 1 | $var 1 Row 2 | $var2 Row 3 | $var3 ?
  13. in the foreach() loop $my_array[$i][0] = $ns_g->year; $my_array[$i][1] = $ns_g->make; etc... $my_array[$i][5] = $ns_g->price; $i++ some people like to use keys for their arrays, personally i don't care....
  14. [code]<tr>     <td class="body" align="left">Best Days For You (select all that apply):</td>     <td class="body" align="center"><input type="checkbox" name="best_days[]" value="best_days">Monday                                     <input type="checkbox" name="best_days[]" value="best_days">Tuesday <br>                                     <input type="checkbox" name="best_days[]" value="best_days">Wednesday                                     <input type="checkbox" name="best_days[]" value="best_days">Thursday <br>                                     <input type="checkbox" name="best_days[]" value="best_days">Friday                                     <input type="checkbox" name="best_days[]" value="best_days">Saturday     </td>   </tr>[/code] Then the drop down selectors, here's the snippet for that: [code]<tr>     <td class="body" align="left">Appointment is for:</td>     <td class="body" align="center"><select name="appt_for"> <option value="appt_for">Myself</option> <option value="appt_for">My Son</option> <option value="appt_for">My Daughter</option> <option value="Other">Other</option> </select></td>   </tr>[/code] Then where ever the form directs to : [code] if (isset($_POST['best_days')) {   $best_days = $_POST['best_days']; // $best_days will now be an array. } else {   //check box has not been selected, do whatever you need to here } $appt_for = $_POST['appt_for']; [/code]
  15. I guess it all depends how far down the line you want to access this information... if it's a one time thing go with an array, otherwise setup a table to store the information.
  16. You also do not require the [] on the appt_for select box, unless you making it into a multiple selection box.
  17. the issue is with the for loop. for ($cnt=1;$cnt<$var;$cnt++){   // echo table rows here }
  18. if (isset($_POST['coef']) {   if ($_POST['coef'] == $coef) {   //do something   } }
  19. if (isset($_POST['coef'])){ echo "variable is set"; }else{ echo "variable is not set"; }
  20. SELECT * FROM table1 WHERE timestamp <= '$user_timestamp' ORDER BY id LIMIT 1,10 // return 1st 10 records SELECT * FROM table1 WHERE timestamp <= '$user_timestamp' ORDER BY id LIMIT 11,10 // return 11-20 SELECT * FROM table1 WHERE timestamp <= '$user_timestamp' ORDER BY id LIMIT 21,10 // return 21-30 etc.... The query returns on this should be extremely fast no matter the table size
  21. $date = query field from database. echo date("%y-%m-%d", $date);
  22. What db are you using? mysql, oracle? Is it setup for table or row locking?
  23. So you're querying for the entire recordset on every pagination then? Why not limit the query to 10 results, specifying which start / end point for the resultset to return? I'm a missing something here, is this what you are already doing?
×
×
  • 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.