Jump to content

RSX_

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

RSX_'s Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Basically, $last = (isset($_GET['last']) && $_GET['last'] != '') ? $_GET['last'] : 0; , after requesting should I unset $last?
  2. I'm currently trying to grab data from my database for my chatbox, which when displayed, displays in an ascending order, when I call it to descend, it shows the messages ONCE in descending order, then just repeats but in random order.. $sql = "SELECT * FROM `message` WHERE `chat_id` = 1 AND `message_id` > $last ORDER BY `message_id` DESC"; Database: message_id | name 1 RSX 2 RSX 3 RSX 4 RSX RSX: 4 RSX: 3 RSX: 2 RSX: 1 RSX: 4 RSX: 3 RSX: 2 RSX: 4 RSX: 3 RSX: 4 It is ordering it correctly, just repeats, I'm using Ajax, could that be the problem, or is it within the PHP code? Edit: I read it wrong, it displays as shown under "output".
  3. I have the ranks in an array, this was before I started the chat, however, thanks to your post, I see I'm looking to grab the user's rank in my main PHP file for the chat, and then calling it from the secondary (with Javascript) file. I may just be clueless as to what I'm doing, hopefully not, but I think I can take it from here, just realized it, I appreciate the help, thank you.
  4. Sorry, feeling a bit tired, which is why I make less sense. echo "var userN2 = '" . echo getRank($user); . "'; \n"; echo "chat_div.innerHTML += userN2;\n"; userN2 is declared, var userN2 = user_node[0].firstChild.nodeValue; I need Javascript to give the PHP variable ($user) a username to get the user's rank, I can give Javascript a variable from PHP, however, when someone types in the chatbox, it would read their user level, therefore making everyone else have the same rank. Still trying to make as much sense as I can, and again, I appreciate the help. var user_node = message_nodes[i].getElementsByTagName("user"); var text_node = message_nodes[i].getElementsByTagName("text"); var time_node = message_nodes[i].getElementsByTagName("time"); var userN2 = user_node[0].firstChild.nodeValue; That's all that's declared in the function, I know I don't have to have userN2 declared, I only declared it, for testing purposes, makes it easier / faster to type.
  5. This has got to be possible, I have a chatbox script, which reads the person's rights by their username, which when displaying the chat username / text, I use javascript, so I need PHP to parse the javascript text, how can I do this? <?php $user = 'user_node[0].firstChild.nodeValue;'; ?> That returns "user_node[0].firstChild.nodeValue;", I can't include <script> in the echo text, due to it's inside of a Javascript function already. I need it to do this: <?php $user = 'user_node[0].firstChild.nodeValue;'; ?> var user = '<?php echo getRank($user); ?>'; aka var user = '<?php echo getRank('Username'); ?>'; I can do the second part, PHP variable to Javascript variable, just not the first part. Any help is appreciated, thanks. Edit: echo "chat_div.innerHTML += userN2;"; returns "Username" $var = "chat_div.innerHTML += userN2;"; echo $var; returns chat_div.innerHTML += userN2; Just to simplify the problem.
×
×
  • 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.