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 7841197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:03:01+00:00 2026-06-02T16:03:01+00:00

I have a mysql database containing several items and I want to change top

  • 0

I have a mysql database containing several items and I want to change top property of footer section via jquery depending of number of items in this mysql database.

this is server side part of newsletter.php

<?php
    //allow sessions to be passed so we can see if the user is logged in
    session_start();
    //connect to the database so we can check, edit, or insert data to our users table
    $con = mysql_connect('localhost', 'user', 'pwd') or die(mysql_error());
    $db = mysql_select_db('newsletter', $con) or die(mysql_error());
    $SQL = "SELECT * FROM papers";
    if(array_key_exists('rowcount', $_GET)) {
      $query = mysql_query("select count(*) as total FROM papers");
      $result = mysql_fetch_array($query);
      $json = array('rowCount' => $result); // can add more data here
      return json_encode($json);
    }
?>

this is client side part of newsletter.php

<script>
    $.getJSON('newsletter.php?rowCount', function(data) {
        var jsonData = $.parseJSON(data);
        var ntop = jsonData.rowCount * 250;
        $('#footer').css('top', ntop);
    });
</script>

This is theorical solution but the browser send an error log ‘jsonData is null’

  • 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-02T16:03:02+00:00Added an answer on June 2, 2026 at 4:03 pm

    One way to do this would be to provide an endpoint JQuery can query through a $.post, $.get, $.ajax e.g.

    $.getJSON('ajax.php?rowcount', function(data) {
      var jsonData = $.parseJSON(data);
    
      var ntop = jsonData.rowCount * 250;
      $('#footer').css('top', ntop);
    }
    

    and a php script something like:

    if(array_key_exists('rowcount', $_GET)) {
      $query = mysql_query("select count(*) as total from table_name");
      $result = mysql_fetch_array($query);
      $json = array('rowCount' => $result); // can add more data here
      return json_encode($json);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have mysql database and I want a software which can draw the database
I have a MySQL database behind a firewall which can only be accessed via
I have a MySQL database of keywords that are presently mixed-case. However, I want
I have a MySQL database that I want to archive . What is the
I have a MySQL database with words containing accents in Spanish (áéíóú). I'd like
I have a pre-existing mysql database containing around 50 tables. Rather than hand code
I have two MySQL database tables: one containing a list of championships and another
I have a MySQL database containing a user's country and whether they are an
I have a MySQL database table containing information about places. I'm trying to fetch
I have a mysql database with table 'product' containing columns 'product_id', 'name', 'price' table

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.