Jump to content

RealDrift

Members
  • Posts

    158
  • Joined

  • Last visited

    Never

Everything posted by RealDrift

  1. what exactly do i search for? is there a specific name for what i want?
  2. i dnt even know if it works, all i want is a simple refresh method (not html as it is annoying and flickers the images) i am tired of this already,
  3. it echos $y lol means it dsnt work? what are you confused about?
  4. wow seems a bit new to me any tutorials or scripts available?
  5. - i meant that that frame in which the two images are mustn't display the inbox page. but it somehow does. that frame is only for the two images. - you suggest the ajax script doesn't work, then why does it work when i just echo a word etc?
  6. ok the SQL error is gone, the right username is printed. - but firstly is still displays the wrong pic, but shows correct one upon manual refresh. - secondly it randomly displayed my inbox in that frame. also i tried just echoing a word instead of any statement and then i saved the file. my webpage displayed the right word. then i changed the word in the echo statement to something else and saved it. The webpage again showed correct word. i get the feeling the AJAX script does auto refresh. just thought this might help you
  7. Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\game\box.php on line 70
  8. 1) being replaced on sites content, in some places
  9. Hi, i have seen a website use this feature. basically the mouse pointer changes to a different one if the user has a new message in their inbox. Once the message is read the mouse pointer goes back to the original one. i run a website which has a members section in which they can message each other. This feature is kinda good to have. any help appreciated. thanks
  10. Mr_mind i did what you said and got the following results: - i echoed the two things and got: WentWorthYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read='0' AND to='WentWorth'' at line 1 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\game\box.php on line 75 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\game\box.php on line 76 this shows that the $username variable picks up the correct username but i dn't know why the SQL statement is suggested to be incorrect. - the image is shown but the correct image is not displayed, and even when i manually refresh the frame the correct image is not shown so thats the problem now
  11. having probs with this line, gives me an error: $inbox_query = mysql_query("SELECT * FROM inbox WHERE read='0' AND to='" . $inbox_user . "'");
  12. mr mind ur script didnt work. it said that the mysql query was not right, the "to" bit. teng i just added exit(); at the end of php script thats all
  13. its not online, but on my pc btw i think the page is refreshing, but each time it refreshes it just displays a duplicate image below, and more images appear wtf? i added exit(); at the end and no more duplicate images
  14. i want the frame to display one pic if the user has new messages and another different pic if it dsnt. Before i used html to auto refresh page every 10 secs. that was annoying for the user. as the user could notice the refresh and the images used to flicker. i found out that AJAX could perfrom the refresh for me better hence i tried usign that. but the frame dsnt refresh automatically, but it does display correct info when i refresh manually.
  15. the AJAX and php are in the same file. i will post the code below. one frame on my page is the file i will post below: <?php session_start(); include "includes/db_connect.php"; include"includes/functions.php"; logincheck(); $username=$_SESSION['username']; $query=mysql_query("SELECT * FROM users WHERE username='$username'"); $fetch=mysql_fetch_object($query); $inbox_msg=mysql_num_rows(mysql_query("SELECT * FROM `inbox` WHERE `read`='0' AND `to`='$username'")); $check = mysql_query("SELECT `to`,`read` FROM `inbox` WHERE `read`='0' AND `to`='$username'"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <script language="javascript"> function createRequestObject() { var req; if(window.XMLHttpRequest){ // Firefox, Safari, Opera... req = new XMLHttpRequest(); } else if(window.ActiveXObject) { // Internet Explorer 5+ req = new ActiveXObject("Microsoft.XMLHTTP"); } else { // There is an error creating the object, // just as an old browser is being used. alert("Your Browser Does Not Support This Script - Please Upgrade Your Browser ASAP"); } return req; } // Make the XMLHttpRequest object var http = createRequestObject(); function sendRequest(page) { // Open PHP script for requests http.open('get', page); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4 && http.status == 200){ // Text returned FROM the PHP script var response = http.responseText; if(response) { // UPDATE ajaxTest content document.getElementById("msgstatus").innerHTML = response; } } } function repeatloop() { sendRequest('box.php'); // replace "inbox-status.php" with your php page's url setTimeout("repeatloop()", 3000); } window.onload=function() { repeatloop(); } </script> <title>The Legendary Mafia</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { background-image: url(images/banner/gradient.gif); background-repeat: repeat-x; } --> </style></head> <body> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="100%" height="70" background="" scope="col"> <div align="center"><p> <?php $inbox=mysql_num_rows($check); if ($inbox > 0){ echo "<a href=inbox.php target=middle><img border=0 src=images/unread1.gif align=center width=16 height=11></a> "; }else{ echo "<img src=images/read.gif align=center width=16 height=11>"; } ?> <span id="msgstatus"></span></p> </div></td> </tr> </table> </body> </html>
  16. come on there must be a solution?? ???
  17. you know what? i start over again: i want to have an image on my website which changes to another pic when a user gets a new message and change back to the original pic once the user has read the message. how can i refresh the info without page refresh, any unique ways to some how have a live connection with the server or something?
  18. Sorry teng for replying late i had an exam to revise for. now thats over with. I tried your script and the results are as follows: - it echos the new message i recieve - i have to manually refresh the page for the right image to appear and onc ei read the new message i have to refresh the page again and the picture changes to the appropriate one. -only problem is ajax dsnt seem to change the pics. hmm?
  19. the right image showed before i thought of implementing the AJAX script, the automatic refresh at 10 seconds using html worked just fine, but ever since i tried using ajax to refresh i get this problem.
  20. that is in the inbox.php file line: mysql_query("UPDATE `inbox` SET `read`='1' WHERE `to`='$username'"); i know when i veiw inbox unread messages are marked as read, since i can see it all happen via the db
  21. it echoes two images: read.gif and unread1.gif despite there being new messages. If i refresh the page manually the unread1.gif still is there. it doesn't change to read.gif like it should
×
×
  • 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.