Jump to content

coupe-r

Members
  • Posts

    328
  • Joined

  • Last visited

    Never

Everything posted by coupe-r

  1. Thanks, I tried that before and it didn't work. Im guessing this is because i'm loading the entire data.php, which selects the top 4 records at the same time, not just the newest?
  2. After trial and error (and YouTube), I got everything working. However, I need the newest result to fade in and I'm not quiet sure what/where to do this. Basically, the script calls the data.php every 10 seconds and gets the top 4 results. The only thing I need is when there is a new result, have that fade in. Any help is appreciated. index.php <table width="70%" border="0" cellpadding="5" cellspacing="0"> <tr> <td height="20" class="statsHeader">What's going on</td> </tr> </table> <script type="text/javascript"> $(document).ready(function() { $('#actionResults').load('data.php'); setInterval(function() { $('#actionResults').load('data.php'); }, 10000); }); </script> <div id="actionResults"></div> </td> </tr> </table> data.php <?php session_start(); require_once("../connect1.php"); $result = mysqli_query($connect, "SELECT log_id, ip FROM log WHERE client_id = '".$_SESSION['client_id']."' ORDER BY log_id DESC LIMIT 4"); $item = array(); $log_id = array(); while($row = mysqli_fetch_array($result)) { $item[] = $row['ip']; $log_id[] = $row['log_id']; } echo '<table width="70%" border="0" cellpadding="5" cellspacing="0" class="statsBox">'; foreach($item as $value) { echo '<tr>'; echo '<td style="padding-left: 20px;">'.$value.'</td>'; echo '</tr>'; } echo '</table>'; ?>
  3. Thank you for the reply. I've never used either but was told to use JQuery over AJAX, but didn't know why. Sorry for my ignorance. Would you happen to know of a tutorial of what I am trying to do? If not, could you give me some good search terms besides "jquery" I really appreciate your time.
  4. Hi All, I have a table on my main screen that will get the top 4 results in a table. I want this table refreshed every 1 minute or so and update the results. When there is a new result, I was it to appear on top and fade in. Im assuming JQuery here, but can anyone else chime in? Thanks.
  5. Don't store files in your DB!! Instead, store the path to the file on the file root. Makes for a happier DB...
  6. WOW, I thought I had to get the date functions involved. Soo simply and it didn't even cross my mind. Thank you very much
  7. Hi All, I'm trying to get the last updated record while my updated_on column is in DATETIME format (Y-m-d H:i:s). I have: SELECT * FROM properties WHERE updated_on < date(now()) but know this isn't right. Also, if multiple records are updated on the same day, I would like it to look at the times and pick the latest time. Any help would be greatly appreciated. Thank you for reading!!
  8. I have a drop down box with 2 values (Rent and Deduction) If rent is selected, it should show an entire row, but instead, it shows everything in 1 column instead of 2. Please see the screen shot... Rent Month / Year and its 2 drop downs (month and year) should be in separate columns, much like Payment Type and its drop down. Any ideas? Here is the JS code: function showHide(type) { if(type == 'Rent') { document.getElementById('trText').style.display = 'inline'; } else { document.getElementById('trText').style.display = 'none'; } } Here is my HTML of the table: <table width="100%" border="0" align="left" cellpadding="2" cellspacing="0" class="tocBorderPayment"> <tr> <td align="right"><strong>Payment Type:</strong></td> <td> <select name="paytype" class="drop" onchange="showHide(this.value)"> <option value="Select">-- Select --</option> <option value="Rent">Rent</option> <option value="Deduction">Deduction</option> </select> </td> </tr> <tr> <td align="right"><br /></td> <td></td> </tr> <tr id="trText" style="display:none"> <td align="right"><strong>Rent Month / Year:</strong></td> <td> <select name="rent_mon_box" class="drop" id="rent_mon_box"> <option value="01" <?php if(date("m") == '01') {echo 'selected="selected"';} ?>>January</option> <option value="02" <?php if(date("m") == '02') {echo 'selected="selected"';} ?>>February</option> <option value="03" <?php if(date("m") == '03') {echo 'selected="selected"';} ?>>March</option> <option value="04" <?php if(date("m") == '04') {echo 'selected="selected"';} ?>>April</option> <option value="05" <?php if(date("m") == '05') {echo 'selected="selected"';} ?>>May</option> <option value="06" <?php if(date("m") == '06') {echo 'selected="selected"';} ?>>June</option> <option value="07" <?php if(date("m") == '07') {echo 'selected="selected"';} ?>>July</option> <option value="08" <?php if(date("m") == '08') {echo 'selected="selected"';} ?>>August</option> <option value="09" <?php if(date("m") == '09') {echo 'selected="selected"';} ?>>September</option> <option value="10" <?php if(date("m") == '10') {echo 'selected="selected"';} ?>>October</option> <option value="11" <?php if(date("m") == '11') {echo 'selected="selected"';} ?>>November</option> <option value="12" <?php if(date("m") == '12') {echo 'selected="selected"';} ?>>December</option> </select> </td> </tr> </table> [attachment deleted by admin]
  9. I am not new to this. Error reporting is on and there are errors on the page. They all pertain to variables that should be set on successful login, which is what the first part of my PHP code checks for. For simplicity, I just added that small header() code to see if it would kick me out of the current page and it doesn't. There are 0 errors pertaining to the header() code.
  10. I just commented out //require_once("../functions/functions.js"); and it still doesn't work I can also move that header() code right under <?php and it doesn't work, so I dont think its echoing anything.
  11. Here is just the top of my PHP: <?php session_start(); require_once("../../connect.php"); require_once('../../config.php'); require_once("../functions/functions.js"); require_once('../class/mcrypt.class.php5'); date_default_timezone_set('America/New_York'); // VALIDATE LOGIN CREDENTIALS if($_SESSION['time'] < time() - (60*60)) {header('Location:'.SITE_root.'login.php?logout=1');} else{$_SESSION['time'] = time(); mysql_query("UPDATE sessions SET last_updated = '".time()."' WHERE session = '".$_SESSION['session']."'");} $result = mysql_query("SELECT COUNT(*) FROM sessions WHERE session = '".$_SESSION['session']."' AND ip = '".$_SESSION['ip']."' AND user_id = '".$_SESSION['user_id']."' AND client_id = '".$_SESSION['client_id']."'"); $row = mysql_fetch_row($result); if($row['0'] < 1) {header('Location: '.SITE_root.'login.php?logout=1');} if(!isset($_SESSION['firstname']) || $_SESSION['type'] != '1' && $_SESSION['type'] != '2') {header('Location:'.SITE_root.'login.php?logout=1');} if(!isset($_GET['id'])) {header('Location: index.php');} header('Location: login.php?logout=1'); That entire top part is not working, because it should kick them out to the main login page. To debug it, I just added that last header() code to kick them out no matter what, but that isn't even working. But it does work if I try it on another page. I'm clueless here...
  12. This is the only code that should be executing. I can do: echo 'HERE'; Right above or below the header() code and it works fine, but anything with a header() function does not work. I could have that header(); function on the 2nd line and it still doesn't work.
  13. Hi All, I'm trying to debug my first few lines of PHP where I have all my "checks" to make sure someone is logged in. I have this code all by itself and it is still not executing. This is the only page that I'm having trouble with. header('Location: login.php?logout=1');
  14. Well, you can get rid of line 51, that doesn't encapsulate anything. Also, you need more to your code than what you posted. You need a submit button, a form tag and your drop down box. When you press the submit button, your $visitortitle variable will get written and echo what you want. What you have now is just a drop down box that you can choose different options. You have no submission method?
  15. just try this and see what is echoed. NOTE -- You will need a submit button to initiate the action as well as this drop down and button being inside a <FORM> tag. //IN YOUR PHP if(isset($_POST['visitortitle'])) {$visitortitle = $_POST['visitortitle'];} else {$visitortitle = 'Nothing Selected';} echo $visitortitle; // IN YOUR HTML <td align="left"><select name="visitortitle"> <option>Please Select</option> <option value="Mr">Mr</option> <option value="Mrs">Mrs</option> <option value="Miss">Miss</option> <option value="Ms">Ms</option> <option value="Dr">Dr</option> </select> </td>
  16. Add this at the top of your page $visitortitle = $_POST['visitortitle'];
  17. So far it looks OK, but you do not need: elseif ((!(isset('username'))) && (!(isset('password')))) just use: elseif (!isset('username') && !isset('password')) For your password SHA1, you may want to look a recent post in this forum to SALT your password.
  18. Can you create a new field in the "users" table that holds the salt? That way, your salt can be different for each user?
  19. Im not really sure what you are trying to do but? $newdate = $row['sold_date3'].'-'.$row['sold_date2'].'-'.$row['sold_date1']; year-mon-day Am I close to what you want?
  20. Works Perfect, thank you very much.
  21. Hi everyone, In the DB, I store dates as date("Y-m-d H:i:s") so it reads "2010-10-25 23:16:06" In a SQL query, I want to query all 2010 dates. I tried, WHERE date_created = '".date("Y")."', but no luck. What goes where date("Y") is? Thanks
  22. This works echo date('Y-m-d', strtotime('+23 day'));
  23. take out if (!$con) {die('Could not connect: ' . mysql_error());}
  24. Hey guys, What I'm trying to do is set 2 dates. Today's date and then a date 14 days from now. However, I want it to increase the month if by adding 14 days will bring me to the next month, same with the year. I have this, but it doesn't increment the month or year. $week = mktime(11, 59, 59, date("m"), date("d")+14, date("y")); $date = date("Y-m-d H:i:s", $week);
×
×
  • 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.