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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:43:39+00:00 2026-06-18T18:43:39+00:00

How can I retrieve and display data from mysql database using php PDO ?

  • 0

How can I retrieve and display data from mysql database using php PDO ?
Here is my code. I know how to do it using mysql_ function .
This is what I tried but it displays nothing so far .

 #query to display the users 
$select_all=("select * from tish_user
inner join tish_clientinfor on  tish_user.user_id = tish_clientinfor.user_id
inner join tish_images on  tish_user.user_id = tish_images.user_id
inner join tish_security on  tish_user.user_id = tish_security.user_id");
$result = $con->query($select_all);
#if the statement is success full
if($result !== false ){
$cols = $result->columnCount();
#echo number of rows 
echo 'num rows'.$cols.'</br>';
#pass the result set 
foreach($result as $row){
echo  $row['username'].'</br>';
}
}
?>
  • 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-18T18:43:41+00:00Added an answer on June 18, 2026 at 6:43 pm

    After the prepare, you need to execute.

    Like this:

    $all->execute();
    

    After that, loop through results:

    while( $row = $all->fetch() )
        print_r( $row );
    

    You can additionally give PDO::FETCH_ASSOC to the fetch statement for the associative results.

    while( $row = $all->fetch(PDO::FETCH_ASSOC) )
        print_r( $row );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using AJAX to retrieve data from MYSQL database through PHP. However, if there
Using success: function(data) in the jquery code, when I retrieve the data from PHP,
How can I retrieve data from a SQL Server using LINQ and display each
I've written some simple php code designed to retrieve data from a database based
Hii, I want to retrieve data from sql database and display dynamically in div
I am using code igniter(PHP) n MYSQL .I am extracting huge amount of data
I can display my data in my textbox, dropdownlist after retrieve data from sql
I am using display view that uses app.js file.In this I retrieve data from
I am trying to retrieve data from MySQL for a flash application via PHP,
I am using httprequest to retrieve data from webservice, i know using tomcat we

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.