Jump to content

ldb358

Members
  • Posts

    199
  • Joined

  • Last visited

    Never

Posts posted by ldb358

  1. i thnk this shoud work:

    var time = document.getElementById("yourElement");
    time.innerHtml = 30;
    //then later
    time.innerHtml = seconds+"."+milisec 
    

     

    you can use this is a variety of elements linke div, span, ect.

    just put the elements id where it says yourElement

  2. what i would like to to do is be able to(for the people with javascript off) have the link link to an alternative page, right now the page has a drop down box with form in it heres what i have:

     

    <a href='index.php?action=comment&id=$id' id='$i' onclick='grow($i,".$photo['id'].")'>rate and comment</a>
    

    the problum is it goes directly to the link instead of running the javascript

     

    thanks in advance

  3. $qscores = mysql_query("SELECT * FROM tblname");
    $i=0;
    while($previousscore = mysql_fetch_array($qscores)){
         $random = "";//set random score
         $final = $previousscore['score'] + $random;
         mysql_query("INSERT INTO tblname (score) VALUE($final)");
    }
    //retrive results 
    $q = mysql_query("SELECT * FROM tblname ORDER BY score");
    //change score to match the colum the scores in
    $i = 0;
    //only if storeing in a array
    while($results = mysql_fetch_array($q)){
        //code to out output the scores
        echo $results['score'];
        //or store into an array
        $array[$i] = $results['score'];
        $i++;
    }

  4. if i understand what you are trying to do your already inserting your values in to the table so this should work:

     

    $q = mysql_query("SELECT * FROM tblname ORDER BY score");
    //change score to match the colum the scores in
    $i = 0;
    //only if storeing in a array
    while($results = mysql_fetch_array($q)){
        //code to out output the scores
        echo $results['score'];
        //or store into an array
        $array[$i] = $results['score'];
        $i++;
    }

  5. okay the site has been moved again to http://lbflash.com Ive been try to getting the security updated I'm writing an email verification, but i didn't quite get how to use URL encode or more where to use it. also about the logout button being there i tried to write a function to change it in between logging in and logging out but i ran into the problem, my function that loads the header is called separately and before the rest of the page that means that on the first page loaded after logging in or out it would be backwards which i think would be more confusing for the user any way if anyone finds and security risks let me know and if some one code tell me where to use the encode/decode that would be nice too

  6. i dont have flash installed eather but i was still able to get around and based on the link i knew it was a porfolio site, personally i felt that there was to much color on the site.

     

    also very nice 3d modeling  :D

  7. what i need to do is delete a single entry from a table but i need to get the exact message that need to be deleted to do this i want to delete the row with the subject, sender and reciver( its a automated friend request always the same) heres what i have come up with:

    mysql_query("DELETE * FROM messages WHERE sendto='$username2' AND WHERE sentfrom='$username' AND WHERE subject='$subject'") or die(mysql_error());
    

    this generates this error:

     

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM messages WHERE sendto='lane3' AND WHERE sentfrom='lane' AND WHERE subject' at line 1

     

  8. hi i am working on a very basic ajax script but for some reason its not working the script is simply put check if a username is a available so that the user doesn't have to submit the whole form to know is the username is available

     

    heres the html script:

    <html>
    <head>
    <link href='smartform.css' type='text/css' rel='stylesheet'/>
    <script src='smartform.js' type='text/javascript'></script>
    </head>
    <body>
    <form>
    username:<input type='text' id='username' onchange='checkUsername()'/><div id="cUsername"></div><br/>
    password:<input type='text' id='password'/><br/>
    confirm password:<input type='text' id='vPassword'/><br/>
    first name:<input type='text' id='fName'/><br/>
    last name:<input type='text' id='lName'/><br/>
    email:<input type='text' id='email'/><br/>
    <input type='submit' value='register' />
    </form>
    </body>
    </html>
    

     

    now the javascript file:

     

    var xmlhttp = newHttpObject();
    function checkUsername(){
    var username = document.getElementById("username").value;
    var div1 = document.getElementById("cUsername");
    sendUsername(username);
    if(xmlhttp == null){
    div1.innerHTML = "";
    }
    
    }
    function sendUsername(username){
    	var url = "http://lbflash.summerhost.info/smartform.php?username=" + username;
    	var type = "GET";
    	xmlhttp.open(type,url,true);
    	xmlhttp.onreadystatechange = response;
    	xmlhttp.send(null);
    
    }
    function response(){
    
    	if(xmlhttp.readyState == 4){
    if(xmlhttp.responseText > "0"){
    	div1.innerHTML = "<img src='x.png' 			style='margin-left:5px;margin-right:5px;'/>taken";
    	}else if(xmlhttp.responseText == "0"){
    	div1.innerHTML = "<img src='checkmark.png' 	style='margin-left:5px;margin-right:5px;'/>not taken";
    	}
    }
    }
    function newHttpObject(){
    	if (window.XMLHttpRequest){
      		return new XMLHttpRequest();
      		}	
    	if (window.ActiveXObject){
    		return new ActiveXObject("Microsoft.XMLHTTP");
    	}else{
    	return null;
    	}
    }
    

     

    now the php file:

     

    <?php
    include('db.php');
    $username = $_REQUEST['username'];
    $check = mysql_query("SELECT * FROM users WHERE username='$username'");
    $results = mysql_num_rows($check);
    echo $results;
    ?> 
    

     

    whats wrong?

        Thanks in advanced

×
×
  • 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.