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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:21:10+00:00 2026-05-24T08:21:10+00:00

Hey im messing with a search function currently and i want it to display

  • 0

Hey im messing with a search function currently and i want it to display how many affected lines it is on the table and then echo it. but my code is working but its outputing wrong.

EDIT : Now it just displays 0 and search reseult , i wanna make it search for what they want in the table acksearch and then display how many results there was and then output it and display all that matched.

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die("Could not connect: " . mysql_error());
}

mysql_select_db("acksocial");
mysql_query("SELECT * FROM Acksearch WHERE name = name ");
$rc = mysql_affected_rows();
echo "There was  " . $rc .        "    results of your search!";


mysql_close($con);
?>

now it just displays 0 and search reseult , i wanna make it search for what they want in the table acksearch and then display how many results there was and then output it and display all that matched.

  • 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-24T08:21:12+00:00Added an answer on May 24, 2026 at 8:21 am

    First off, Don’t use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi – this article will help you decide which. If you choose PDO, here is a good tutorial.


    Not quite sure from the look of your query… but hope this helps

    <?php
    //Connect
    $con = mysql_connect("localhost","root","") or die(mysql_error());
    mysql_select_db("acksocial");
    //Query all from Acksearch where name matches $_GET['name']
    $result = mysql_query('SELECT * FROM Acksearch 
                            WHERE name="'.mysql_real_escape_string($_GET['name']).'"');
    //Count the rows after result was returned
    $totalResults=mysql_num_rows($result);
    
    echo "There is {$totalResults} results of your search!";
    //If data is found loop it
    if($totalResults>=1){
        while ($row=mysql_fetch_assoc($result)){
            echo $row['name'];
            ...
            ...
            ...
        }
    }
    ?>
    --Or--
    <?php
    $con = mysql_connect("localhost","root","") or die(mysql_error());
    mysql_select_db("acksocial");
    //Count rows in the database then return that value
    $result = mysql_result(mysql_query('SELECT count(1) as totalRows
                                        FROM Acksearch 
                                        WHERE name="'.mysql_real_escape_string($_GET['name']).'"'),0,'totalRows');
    
    echo "There was {$result['totalRows']} results of your search!";
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys, I am really messing up with this. I tried this but it
Hey all, thanks in advance for the help. This is my code: $(document).ready(function ()
Hey so what I want to do is snag the content for the first
Hey, I've been developing an application in the windows console with Java, and want
Hey, in the Programming Pearls book, there is a source code for setting, clearing
Hey, im trying to wirte about 600000 Tokens into my MySQL Database Table. The
Hey guys. I don't know much JS, but I wanted to do some quick
Hey guys, I thought this would be fairly straightforward, but it's not it seems..maybe
Hey all, I've been messing around with this awesome library on my *nix box,
Hey guys, I have a problem with the following table: CREATE TABLE [dbo].[CA]( [Id]

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.