Jump to content

wilna

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wilna's Achievements

Member

Member (2/5)

0

Reputation

  1. First of all thank you for giving me the code. But unfortunately it's not displaying the clock.
  2. Thank you, I will test now and report back.
  3. Hi, please excuse my lack of knowledge. I've got a JavaScript clock on my page. My problem is when the users refreshes my php page the clock starts from 0 again. I need the clock to remember the value and then just continue from where it was. I've been trying with cookies but gave up. Can someone please help me? I've been trying but I'm clueless. Javascript var pageVisisted = new Date(); setInterval(function() { var timeOnSite = new Date() - pageVisisted; var secondsTotal = timeOnSite / 1000; var hours = Math.floor(secondsTotal / 3600); var minutes = Math.floor(secondsTotal / 60) % 3600; var seconds = Math.floor(secondsTotal) % 60; document.getElementById('counter').innerHTML = hours + ":" + minutes + ":" + seconds; }, 1000); The php page <head> <?php session_start(); ?> <script type="text/javascript" src="counter.js"></script> </head> <body> <?php echo "<span id='counter'></span>"; ?> </body>
  4. I hope I'm in the correct forum this time. I am trying to create a linked table in phpmyadmin to an external file / ms access database? The file will change continuously so it will be to much hassle to import it into phpmyadmin table every time it changes. Is that at all possible?
  5. Sorry, I'm struggling to get the php to work with the javascript.
  6. Hi, I've been pulling out my hair already. Please can someone help me. I' using Joomla and installed JCE Editor & DirectPHP to be able to use PHP & Javascript. I don't know anything about Java. I've created a dropdown form and then an onchange event is called so that if the value in the form is selected it calls the php. This works fine (I got an example form w3schools). The problem is I wanted to change the form to get the values form a table but it doesn't work. Example I used: http://www.w3schools.com/PHP/php_ajax_database.asp The code I changed is just the part about the form: <?php $con = mysql_connect('localhost', 'root', ''); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("metnet", $con); $sql="SELECT * FROM newsletter"; $result = mysql_query($sql); echo "<form method='post'>"; $dropdown = "<select name='users' onchange='showuser(this.value)'>"; while($row = mysql_fetch_assoc($result)) { $dropdown .= "\r\n<option value='{$row['id']}'>{$row['name']}</option>"; } $dropdown .= "\r\n</select>"; echo $dropdown; ?> The result I get in my article: [attachment deleted by admin]
  7. Hi I don't understand what I'm doing wrong, I want to subtract 6 months from my date, but I get 1969/07 as an answer? <?php $date = date('Y/m'); echo $date; echo "<br/>"; $date1 = date ("Y/m", strtotime("-6 month", strtotime($date))); echo $date1; ?>
  8. thanks all I'll try it tonight!
  9. Hi, my query doesn't work, I've got a date field in my MySql table, I want to get results of all employees that was added in a certain period. My query doesn't work but as soon as I type in values in my query instead of variables it works, what am I doing wrong? $date = date('Y/m'); $date1 = strtotime('-6 month'); $date2 = strtotime('-6 month'); echo date('Y', $date1); echo date('m', $date2); $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("dbname", $con); $sql = "SELECT * FROM detail WHERE year(engaged) > '$date1' and month(engaged) > '$date2'"; $result=mysql_query($sql); echo mysql_num_rows($result);
  10. Thank you so very much!
  11. Hi, I'm having trouble with this: $date = date('d/m/y') ; echo $date; echo "<br/>"; $date1 = strtotime('date -1 month'); echo date('Y-m-d', $date1); My result looks like this: Current Date: 19/05/11 Date minus 1 month: 1970-01-01 I want it to look like this: Current Date: 19/05/11 Date minus 1 month: 2011-04-19
  12. Thank you both! The following solved my problem: $myDate = date('d'); $myDate1 = date('m'); ..... $sql = "SELECT * FROM detail WHERE month(dob)='$myDate1'and day(dob)='$myDate'";
  13. Hi, my field is in date format, please see the attached examples. Can you please be so kind and as to explain how my query must look? [attachment deleted by admin]
  14. Hi I have a date of birth field(dob) in my table, eg 16/05/2011 (dd/mm/yyyy). I need to run a query but it must not include the year, how do I do that? $sql = "SELECT * FROM detail WHERE dob='$mydate'"; The dob is in the format dd/mm/yyyy, how do I change my query to just use dd/mm? Thank you
×
×
  • 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.