Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Add AJAX to my PHP MySQL page?

    I was wondering how to make my PHP MySQL page queries refresh when they change without the page refreshing! I think that AJAX is the only way i could do that so could someone could me do it because i don't know any AJAX and i don't want to try and learn another language!

    Here's the script
    PHP Code:
    <html>
    <head>
    <title>Site</title>
    </head>
    <body>
    <?php
    session_start
    ();
    include(
    "functions.php"); 
    connect();
    sessioncheck();
    $username=$_SESSION['username'];

    $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
    $info=mysql_fetch_object(mysql_query("SELECT * FROM user_info WHERE username='$username'"));

    $carselected=$info->carselected;
    $carname=mysql_query("SELECT * FROM cars WHERE id='$carselected' AND username='$username' LIMIT 1");
    $cars=mysql_fetch_object($carname);

    ?>
    <div align="center">
    <table width="295" height="93" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td align="right" width="72"><strong>Username :</strong></td>
    <td align="left" width="223"><?php echo "$fetch->username"?></td>
    </tr>
    <tr>
    <td align="right"><strong>Rank :</strong></td>
    <td align="left"><?php echo "$fetch->rank"?></td>
    </tr>
    <tr>
    <td align="right"><strong>Cash :</strong></td>
    <td align="left"><?php echo "$".makecomma($fetch->cash).""?></td>
    </tr>
    <tr>
    <td align="right"><strong>Vehicle :</strong></td>
    <td align="left">  <?php if($carselected == 0){ echo "None"; } else { if($carselected != 0){ echo $cars->name; }}?></td>
    </tr>
    <tr>
    <td align="right"><strong>Location :</strong></td>
    <td align="left"><?php echo "$fetch->location" ?></td>
    </tr>
    <tr>
    <td align="right"><strong>Reputation :</strong></td>
    <td align="left"><?php echo "".makecomma($fetch->reputation).""?></td>
    </tr>
    <tr>
    <td align="right"><strong>Level :</strong></td>
    <td align="left"><?php echo "$fetch->location" ?></td>
    </tr>
    </table>
    </div>
    </body>
    </html>
    So i hope someone can help me!
    Thanks in Advance!

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by birdbrain24 View Post
    I was wondering how to make my PHP MySQL page queries refresh when they change without the page refreshing! I think that AJAX is the only way i could do that so could someone could me do it because i don't know any AJAX and i don't want to try and learn another language!

    So i hope someone can help me!
    Thanks in Advance!
    ajax is not a language, is a combination of methods, look to this tutorial:

    http://www.xul.fr/

    I don't understand the part with "I don't want to try and learn", in this profesion you must try and learn all the time.

    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •