Jump to content

XistenceNL

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

XistenceNL's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. http://www.phpfreaks.com/forums/php-coding-help/php-refresh-322187/?all Look at the last reply with attachment. That's the way to go for you my friend. I use that for a internet chatapp. You can use it for like the scoreboard or something
  2. did it work
  3. Thanks Mikosiko for the help, It's true, I made the fault in my query I didn't had to use the dots @ $id in the query: Here's the correct query: $query1 = "SELECT datum FROM planning WHERE id = '$id' AND YEAR(datum) = '$huidig_jaar' AND MONTH(datum) = '01' ORDER BY id ASC"; Works perfect now. Topci can be noted as solved!
  4. I have removed extract out of my code, but it doesn't make a difference $query = "SELECT id, bedrijfsnaam, bezoeken FROM clients WHERE actief = 'ja' AND bezoeken > 0 ORDER BY id ASC"; $result = mysql_query($query)or die ("Query kon niet worden uitgevoerd"); echo '<table style="border-collapse:collapse;">'; while($row = mysql_fetch_assoc($result)){ $id = $row['id']; $bedrijfsnaam = $row['bedrijfsnaam']; $bezoeken = $row['bezoeken']; $bedrijfsnaam = ucfirst($bedrijfsnaam); $bedrijfsnaam = htmlentities($bedrijfsnaam);
  5. Let's say we have an index.php and a data.php. In data.php you'll retreive all the data. In index.php put the code in the header along with the javascripts. make in the index.php a div ajax, define the size as you see fit, then the javascripts will keep that div updated with the interval time you specify.
  6. Thanks, I'll fix it and see if it solved the problem and saves my day
  7. 1) Upload both .js form the attachment to you're server 2) Ad these lines in you're header <script src="jquery.js"></script> <script src="updatediv.js"></script> Add this to the header: <script> $(document).ready(function() { $("#example ajax").load("file witch you want to reload without revisiting.php"); var refreshId = setInterval(function() { $("#example ajax").load("file witch you want to reload without revisiting.php?randval=\'+ Math.random()); }, 1000); }); </script> That should do the trick, the page get the data without reloading the page. [attachment deleted by admin]
  8. Ajax may be the way to go? I've got a nice script lying around in here Let me know if intrested. It's a lot of code, in basic you update the div with the time you'll give it. I use it all the time @ work with our own message system
  9. Remember Javascript is not bulletproof :-\ If somebody disables javascript you're still in trouble.
  10. Hi @ all, I'm building a simpel agenda function for my boss Now I've ran in some basic query problems. First the code: <? include_once('../../config/config.php'); $query = "SELECT id, bedrijfsnaam, bezoeken FROM clients WHERE actief = 'ja' AND bezoeken > 0 ORDER BY id ASC"; $result = mysql_query($query)or die ("Query kon niet worden uitgevoerd"); echo '<table style="border-collapse:collapse;">'; while($row = mysql_fetch_assoc($result)){ extract($row); $bedrijfsnaam = ucfirst($bedrijfsnaam); $bedrijfsnaam = htmlentities($bedrijfsnaam); if($rowcount % 2 == 0) { echo '<tr onMouseover="this.style.backgroundColor=\'#649fbe\'"; onMouseout="this.style.backgroundColor=\'#fff\';" style="background-color:#fff; border-bottom: 1px solid black;">'; } else { echo '<tr onMouseover="this.style.backgroundColor=\'#649fbe\'"; onMouseout="this.style.backgroundColor=\'#f2f2f1\';" style="background-color: #f2f2f1; border-bottom: 1px solid black;">'; } $rowcount ++; // huidige jaar ophalen $huidig_jaar = date("Y"); echo' <td style="width: 313px; font-family: verdana; font-size: 10px; font-weight: bold; min-height: 20px;">'.$bedrijfsnaam.'</td> <td style="width: 8px; font-family: verdana; font-size: 10px; font-weight: bold;">'.$bezoeken.'</td> <td style="width: 100px; text-align: center; border-left: 1px solid black;">'; //januari ophalen $query1 = "SELECT datum FROM planning WHERE id = '.$id.' AND YEAR(datum) = '$huidig_jaar' AND MONTH(datum) = '01' ORDER BY id ASC"; $result1 = mysql_query($query1)or die ("Query 1 kon niet worden uitgevoerd"); $num1 = mysql_num_rows($result1); echo $num1; echo' </td> <td style="width: 100px; text-align: center; border-left: 1px solid black;">'; //februari ophalen $query2 = "SELECT datum FROM planning WHERE id = '.$id.' AND YEAR(datum) = '$huidig_jaar' AND MONTH(datum) = '02' ORDER BY id ASC"; $result2 = mysql_query($query2)or die ("Query 1 kon niet worden uitgevoerd"); $num2 = mysql_num_rows($result2); echo $num2; echo' </td> <td style="width: 100px; text-align: center; border-left: 1px solid black;">'; //februari ophalen $query3 = "SELECT datum FROM planning WHERE id = '.$id.' AND YEAR(datum) = '$huidig_jaar' AND MONTH(datum) = '03' ORDER BY id ASC"; $result3 = mysql_query($query3)or die ("Query 1 kon niet worden uitgevoerd"); $num3 = mysql_num_rows($result3); echo $num3; echo' </td> <td style="width: 100px; text-align: center; border-left: 1px solid black;"></td> <td style="width: 100px; text-align: center; border-left: 1px solid black;"></td> <td style="width: 100px; text-align: center; border-left: 1px solid black;"></td> <td style="width: 100px; text-align: center; border-left: 1px solid black;"></td> <td style="width: 100px; text-align: center; border-left: 1px solid black;"></td> <td style="width: 100px; text-align: center; border-left: 1px solid black;"></td> <td style="width: 100px; text-align: center; border-left: 1px solid black;"></td> <td style="width: 100px; text-align: center; border-left: 1px solid black;"></td> <td style="width: 100px; text-align: center; border-left: 1px solid black;"></td> </tr> '; } echo '</table>'; ?> In the first query I'll get the id from all the clients in the database, now I want to use that id's in the upcoming query's (WHERE id = '.$id.'), but it allways uses the first id and not all the id's. $num always has the same result. Can anyone put me in the right direction? Thank you Sorry for my bad English, I'm dutch, can't help it I blame my parents... I hope it's enought information.... Greetings XistenceNL
×
×
  • 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.