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

  • SEARCH
  • Home
  • 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 6012991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:29:01+00:00 2026-05-23T02:29:01+00:00

I have something like this: <input id=num type=text> // var num = $(#num).val(); <

  • 0

I have something like this:

<input id="num" type="text">

// var num = $("#num").val();
< ?php
$sql=mysql_query("SELECT * FROM news WHERE 
id= num //???
"); 

while($row=mysql_fetch_array($sql))
{
?>

< div id="main">
< ?php echo $row['title']; ?>
< ?php echo $row['body']; ?>
< /div>
< ?php
}

how do I write in input id num and view new news without refreshing the page? I know that I have to use jquery and ajax. i can do it in only jquery, but i cant combine this with PHP.

thanks!

  • 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-05-23T02:29:02+00:00Added an answer on May 23, 2026 at 2:29 am

    have you considered using Json , Jquery , PHP together ? Call a page at some interval using jquery.This might give some pointers .

    DisplayNews.php

     <input id="num"><input type="submit" onclick="loadNews()"/>
      <div id='content'></div>
    <script>
         function loadNews(){
             $.getJSON("http://www.YourSite.com/GetNews.php?id=" + $("#num").val(), 
                  function(data) {
                      $('#content').html('Latest News: ' + data.news + '<br/><br/>');
                  }); 
             //setTimeout(loadNews(),5000); use this if you want to refresh ever 10seconds
          }
    </script>
    

    GetNews.php

    < ?php
    $sql=mysql_query("SELECT * FROM news WHERE id= num)
    Execute query....
    echo '{news:' . result . '}';
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have done something like this: <form action=validate.php method=get> Id :<input type=text name=pID/><br/><br/> Name
Lets say I have something like this: <tr> <td><input type=text /></td> <td>Somevalue</td> <td><intput type=text
I have written something like this in PHP <script type=text/javascript src=jquery.js></script></script> <script type=text/javascript> function
I have something like this in my AJAX application: <html> <head> <script type=text/javascript> var
I have something like this HTML structure : <form name=myvalue id=hello> <input type=text name=name
I'd like to be able to have something like this: <form> <input type=date name=params.date/>
In my HTML I have something like this <input type=button value=Delete onclick=delete(this);/> and in
I have something like this on my view: <input type=checkbox value=1 name=services-for /> <input
I have a <form> that looks like this: <form> <input type=text name=name id=name /><span
I have a model that is something like this: class Input(models.Model): details = models.CharField(max_length=1000)

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.