Jump to content

php.ajax.coder

Members
  • Posts

    78
  • Joined

  • Last visited

    Never

Posts posted by php.ajax.coder

  1. Try this Script

     

    <?PHP
    $chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N",
                   "O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b",
                   "c","d","e","f","g","h","i","j","k","l","m","n","o","p",
                   "q","r","s","t","u","v","w","x","y","z",
                   "1","2","3","4","5","6","7","8","9","0");
    
    //Lenght of String
    $string_length = 6;
    
    //Result String
    $result = "";
    //Array Length
    $count = count($strs) - 1;
    
    for ($i = 0; $i <= $string_length; $i++){
    	$rand = rand(0, $count);
    	$result = $result . $strs[$rand];
    }
    
    echo $result;
    
    ?>

  2. Try Something like this

     

    <?php
    $con = mysql_connect("localhost","peter","abc123");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
    mysql_select_db("my_db", $con);
    
    $result = mysql_query("SELECT * FROM person");
    
    while($row = mysql_fetch_array($result))
      {
      echo $row['FirstName'] . " " . $row['LastName'];
      echo "<br />";
      }
    
    mysql_close($con);
    ?>
    

  3. Try this script

     

    <script type="text/Javascript">
      var xmlHttp;
        try{	
          // Firefox, Opera 8.0+, Safari
          xmlHttp=new XMLHttpRequest();
        }catch (e){
          // Internet Explorer
          try{
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
          }catch (e){
             try{
       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
     }catch (e){
    	window.location="noajax.html";
    	return false;
    }
       }
    }
    
    function pageRequest(page){
        xmlhttp.open('GET', page);
        xmlHttp.onreadystatechange=function(){	
        if(xmlHttp.readyState==4){
            document.getElementById('content').innerHTML=xmlHttp.responseText;
        }else{
    document.getElementById('content').innerHTML='<center><img src="images/loading.gif" alt="Loading" style="border:0px;"/><br />Loading, Please Wait...</center>';
        }
      }
      xmlhttp.send(null);
    }
    </script>
    

     

    Just use the GET method by adding the value to the page name

     

    EXAMPLE

     

    news.php?value=4

    <a href='javascript:pageRequest("news.php?value=4")'>

     

    From the file use

     

    <?Php

      echo $_GET['value'];

    ?>

     

    to get the value

     

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