---
title: "Show the result from query database php"  
description: "Show the result from query database php"  
author: "Jayden Bell"  
published: 2013-05-15  
updated: 2013-05-15  
canonical: https://www.mindstick.com/forum/889/show-the-result-from-query-database-php  
category: "php"  
tags: ["php"]  
reading_time: 1 minute  

---

# Show the result from query database php

Hi Mindstickians!\
I have a code like this:\
$genre = 'jazz';$what_genre = mysql_real_escape_string($genre);$query = mysql_query("SELECT song.id, song.title, genre.genre FROM song [INNER JOIN](https://www.mindstick.com/forum/33572/sql-inner-join-keyword) genre ON song.id_genre=genre.id_genre WHERE genre.genre = '" .$what_genre. "' ORDER BY id");\
if(mysql_num_rows($query) > 0){ while($[result](https://www.mindstick.com/blog/12011/advantages-of-getting-result-oriented-seo-from-an-agency) = mysql_fetch_array($query)) { echo $result['id']; echo $result['title']; echo $result['genre']; }}I want to show the result, but it failed. The [system](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business) give me an error [report](https://www.mindstick.com/forum/334/crystal-report):\
A PHP Error was encountered\
Severity: [Warning](https://answers.mindstick.com/blog/77/psychological-risks-of-ai-chatbots-what-experts-are-warning-about)\
[Message](https://www.mindstick.com/forum/12802/show-confirmation-message-yes-or-no-in-asp-dot-net): mysql_num_rows() expects [parameter](https://www.mindstick.com/blog/450/parameter-class-in-c-sharp) 1 to be [resource](https://www.mindstick.com/blog/43433/top-best-resources-for-women-about-beauty-and-health), [boolean](https://www.mindstick.com/forum/160332/how-does-the-boolean-function-work) given\
What should I do?Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)! \

## Replies

### Reply by AVADHESH PATEL

Hi Jayden!\
Change your query from id to song.id like this\
"SELECT song.id, song.title, genre.genre FROM song INNER JOIN genre ON song.id_genre=genre.id_genre WHERE genre.genre = '" .$topiknya. "' ORDER BY song.id";\


---

Original Source: https://www.mindstick.com/forum/889/show-the-result-from-query-database-php

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
