Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8673829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:33:32+00:00 2026-06-12T19:33:32+00:00

This is a code in PHP which is fetching a record from a database:

  • 0

This is a code in PHP which is fetching a record from a database:

<?php
    include("dbconn.inc");
    $data = mysql_query(
              "SELECT `subtitle`, `mian-title`, `page_num`, `note_path`, `flash_path`
              FROM `main-page`
              WHERE `page_num` =".$r." LIMIT 1";
    echo $data;
    if (mysql_num_rows($data) == 0) {
        echo "No rows found, nothing to print so am exiting";
        exit;
    }
    while ($row = mysql_fetch_assoc($data)) {
        echo $row['page_num'];
    }
    include("close.php");
?>

And this is the HTML:

<form method="post" action="data.php">
    <input name="Button1" type="submit" value="&lt;&lt;" />
    <input name="test" style="width: 31px; height: 23px" type="text" /> // this is a value of page_num in DB.
    <input name="Button2" type="submit" value="&gt;&gt;" >
</form>

I want to add Ajax code to retrieve the record from PHP code, and then change the input values depends on returned data and also want to preventing the page from refreshing!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:33:33+00:00Added an answer on June 12, 2026 at 7:33 pm

    You have to use jQuery to call the function, and push the information into the div, pushing the old information out. (If this is what you mean. Otherwise, you just put it into another div). This would be something like this:

    <script type="text/javascript">
        // jQuery document
    
        $(document).ready(function(){
            function getInfo() {
                $.get('yourfile.php', function(data) {
                    $('#yourdiv').html(data);
                });
    
    </script>
    

    This should do the trick. If it doesn’t, you can always add a $.ajax instead of $.get.

    $("#inputid).click(function(){
        if ('value' == this button){
            $.get('yourcontentsfile.php', function(data){
                $('#contentthatmustchangediv').html(data);
            }
            if('value' == the other one){
                $.get('yourcontentsfile.php', function(data){
                    $('#contentthatmustchangediv').html(data);
                }
            });
    

    I’m not entirely sure this code will work 100%. You might have to change one or two things. But the idea should be right.

    (I’m not sure if you’ve noticed, but you’ve typed “mian-title”. It might be a typo.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code which will include template.php file from inside each of these
This code takes data from a php file which is doing a json_encode, which
In my CMS I've added this code <div><?php include(my_contact_form.php) ?></div> which updates to a
This is my php code which is only fetching the first image out of
hi everyone i am fetching some data from a database using php, encoding it
I have this code which is passed to Paypal checkout: <?php foreach ($paypalBasket as
Possible Duplicate: php loop through associative arrays i have this piece of code which
I want to break my string using javascript which is fetching some data from
I've just inherited this code in PHP which seems to do some kind of
I have a date field in php which is using this code: $date =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.