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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:34:43+00:00 2026-05-20T01:34:43+00:00

Hey guys, I have this piece of jquery code: <script type=text/javascript > $(function() {

  • 0

Hey guys, I have this piece of jquery code:

<script type="text/javascript" >
    $(function() {
        $(".submitButton").click(function() {
            var post = $("#post").val();
            var dataString = 'post='+ post;

            if(post=='')
            {
                $('.error').fadeIn(200).show();
            }
            else
            {
                $.ajax({
                    type: "POST",
                    url: "post.php",
                    data: dataString,
                    success: function(){
                        $('.error').fadeOut(200).hide();
                    }

                 });
            }
            return false;
        });
        $('.error').hide();
    });
</script>

And I want it to post the values without refreshing. I created post.php:

<?php  
    ini_set('display_errors', 'On');
    error_reporting(E_ALL);

    session_start();

    $post=mysql_real_escape_string($_POST['post']);
    $mysql=mysql_connect('localhost','***','***');
    mysql_select_db('jmtdy');
    $result=mysql_query("select * from users where username='".$_SESSION['username']."'") or die(mysql_error());
    $dbarray=mysql_fetch_assoc($result);
    mysql_query("insert into posts (userid, post, username) values ('".$dbarray['id']."','".$post."','".$dbarray['username']."'") or die(mysql_error());   
?>

But the values are still not being added to the database. Do you know what the problem might be?

  • 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-20T01:34:44+00:00Added an answer on May 20, 2026 at 1:34 am

    Have you checked to make sure that the server isn’t throwing an error somewhere? You should check to make sure your PHP script runs correctly by outputting something.

    I would also recommend using Firebug (or Chrome Dev. Tools) to monitor XHR requests and see if there are any issues there.

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

Sidebar

Related Questions

Hey guys I have a weird error I wrote this code against setbubblepopup $(document).ready(function
Hey guys, I have this quick bit of code that I can't figure out
Hey guys, in this piece of code. Is there a way to redirect the
Hey guys, I have this code for an android application, the funny thing is
Hey guys, I have this sign up script and I'm using mysql_real_escape_string .I know
Hey guys, check this out. I have a function that treats for me a
Hey guys I need some help with this: I have two view controllers, let's
Hey guys! I have this little problem: I have one ViewController which adds 2
Hey guys, I have a bit of a weird problem. I have a jquery
Hey guys, I want to make a function loop over all elements that have

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.