Jump to content

NoobLaPHP

Members
  • Posts

    20
  • Joined

  • Last visited

NoobLaPHP's Achievements

Newbie

Newbie (1/5)

0

Reputation

1

Community Answers

  1. I managed to sort it. Not sure if it is correct but it works var interval = setInterval(function() { // ajax call $.get ( "my_ajax.php", function(data) { $("#divA").html(data.A); // put results into their $("#divB").html(data.B); // respective divs }, "json" ) },1000); Cheers for your help.
  2. Nice, this is doing exactly what i need. Now another question i have is, is there a way to get this to refresh using some sort of setInterval?
  3. I am trying to reload multiple divs. for things like mail and notifications on the same page of a website. I want to call all the information from another page but am unsure where to go as i have only just started learning more about ajax. I want to set it to call for the information just using something basic like <span id=notifications></span> To which it will show up the text needed when on the website but i really don't know where else to start. Any help will be greatly appreciated
  4. You sir, are awesome! after a few tweaks, i managed to fix it and get it working as it should. Thank you.
  5. It's sending the id through as 32. 71. 10 Not sure what i've done or haven't done. All i did was fill in the blanks
  6. I don't fully understand ajax, i'm still learning all this. I have done it using php. The value gets the like part and also the id for the post to like so it will be like like:387 if the php reads the like, it then reads the id where it updates the database $replyid = mysql_real_escape_string(addslashes(strip_tags($liked[1]))); mysql_query("UPDATE replies SET likes='...' WHERE id='$replyid'"); etc, any help is good. It helps learn
  7. It requires both items to be filled. If either is empty it shows nothing if($liked[0] == "like"){ if(!$liked[1]){ //Do nothing }else{ //Select from database where id is $liked[1] } }
  8. $liked = explode(":", $_POST[submit]); if($liked[0] == "like"){ //Select from database where id is $liked[1] } <input type="image" src="images/arrowup.gif" name="submit" value="like:<? echo $right->id; ?>"/> Ok, so i have made a forum and i have a like function running on the comments of a post. I needed to find a way when the image was clicked it updated the database. So i experimented and came up with the solution above having it explode the value of the button to read if it was press and get the id. It works perfectly but i just want to be convinced it is safe.
  9. function updateTimers() { //Get the current timestamp now = new Date(); //Iterate through each of the timers for(i=0; i<timers.length; i++) { //Convert end time to timestamp & calc difference endTime = new Date(timers[i].split(' ').join('T')); millisecondsDiff = endTime - now; //Format the diff and display timeDisplay = formatTimeDiff(millisecondsDiff); document.getElementById('timer['+i+']').innerHTML = timeDisplay; } } I'm using the above function to set timers for a page on my website. It should be showing 23 minutes but is showing 83 minutes. This has only come about since the clocks in the UK went forward. Ant help?
  10. Figured it out. I used $where = "where".$select; if($fetch->$where){ mysql_query("UPDATE `table` SET `$where`='input' ");
  11. I have a select option and want to include it in my query. $select = mysql_real_escape_string($_POST[select]); if($fetch->where$select){ So if the select value was at 2 it would read if($fetch->where2){ How would i do it? Would if($fetch->where.$select){ work putting in a . ? also in the mysql mysql_query("UPDATE `table` SET `where$select`='input' ");
  12. I have found this that seems to work well. function domain_exists( $email, $record = 'MX' ) { list( $user, $domain ) = explode( '@', $email ); return checkdnsrr( $domain, $record ); } if(domain_exists('user@davidwalsh.name')) { echo('This MX records exists; I will accept this email as valid.'); } else { echo('No MX record exists; Invalid email.'); } Source: http://davidwalsh.name/php-email-validator
  13. Ok, i am having a load of people register to a subscription service on my website using invalid emails. I would like to add a function in that can read an email. If the source is right it will continue to process the form. If it's not then it shows an error message. Would i use something like an explode function to seperate using the @ in an email and read the end part(live.co.uk) and then have an array set up to see if the end is in the email or what? Examples would be a great help if you have any other ideas. Thanks
  14. I'm completely lost in this. For some reason i keep losing 3 seconds but only in the auto countdown. The timer itself remembers the 15secs yet when it starts counting down it skips to 12
  15. Figured it out. Sorry to seem like such a noob. I added if(minutes < 10) { minutes = '0'+ minutes; } if(seconds < 10) { seconds = '0'+ seconds; }
×
×
  • 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.