473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Fetch All rows of column in a table

Hello friends,
I am developing my own website with php and sql. I've a mistake in my codings when try to fetch all rows of a column in a table, It shows the result of only last row of the particular column

There are my codings

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include_once("com_check_login.php");
  3. include("test_connect_to_mysql.php");
  4. $client_idd = $fgmembersite->UserClientID();
  5. $sqliw = mysql_query("SELECT * FROM domains WHERE client_id LIKE '" . $client_idd . "'");
  6. $notify_a = mysql_num_rows($sqliw);
  7. if($notify_a > 0) {
  8.     while($rowsj = mysql_fetch_array($sqliw)) {
  9.         $dom_a_ins = $rowsj["domains"];
  10. } }
  11. ?>
  12. <?php echo $dom_a_ins; ?>
  13.  
Below image shows table name : 'domains'



I am getting the result of the above coding is:

/* result starts here */

example4.com

/* result end here */

I want to get all the matching result of the id "1000".

Because, Now I've logged with id name 1000.

Please help me
Jun 15 '14 #1

✓ answered by Bala Kumaran

hello friends!
I got the result for my question by changing the script

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include_once("com_check_login.php");
  3. include("test_connect_to_mysql.php");
  4. $client_idd = $fgmembersite->UserClientID();
  5. $domain_list = "";
  6. $sqliw = mysql_query("SELECT * FROM domains WHERE client_id LIKE '" . $client_idd . "'");
  7. $notify_a = mysql_num_rows($sqliw);
  8. if($notify_a > 0) {
  9.     while($rowsj = mysql_fetch_array($sqliw)) {
  10.         $dom_a_ins = $rowsj["domains"];
  11.         $domain_list = $dom_a_ins;
  12. } } else {
  13. $domain_list = "No any domains added here";
  14. }
  15. ?>
  16. <?php echo $dom_a_ins; ?>
  17.  

1 1149
hello friends!
I got the result for my question by changing the script

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include_once("com_check_login.php");
  3. include("test_connect_to_mysql.php");
  4. $client_idd = $fgmembersite->UserClientID();
  5. $domain_list = "";
  6. $sqliw = mysql_query("SELECT * FROM domains WHERE client_id LIKE '" . $client_idd . "'");
  7. $notify_a = mysql_num_rows($sqliw);
  8. if($notify_a > 0) {
  9.     while($rowsj = mysql_fetch_array($sqliw)) {
  10.         $dom_a_ins = $rowsj["domains"];
  11.         $domain_list = $dom_a_ins;
  12. } } else {
  13. $domain_list = "No any domains added here";
  14. }
  15. ?>
  16. <?php echo $dom_a_ins; ?>
  17.  
Jun 15 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Stijn Goris | last post by:
hi all, Is it possible to fetch a column from a queryresult? kind regards Stijn
0
by: Luis Esteban Valencia | last post by:
Hello I wrote a program with code behind in C# to add row into table dynamically and the program worked very well in .Net Framework 1.1. When I run this program in .Net Framework 2.0 beta...
2
by: Hymer | last post by:
Hello, I have a small two-column table with three rows. The first column has a logo and the second column has the name of the organization. The logo's in the first column are too high. That...
5
by: Hymer | last post by:
Hello, I have a small two-column table with three rows. The first column has a logo and the second column has the name of the organization. The logo's in the first column are too high. That...
10
by: ste | last post by:
Hi there, I'm trying to query a MySQL database (containing image data) and to output the results in a HTML table of 3 columns wide (and however many rows it takes) in order to create a basic...
2
by: agphoto | last post by:
when we do mysql_query with while and mysql_num_rows() together then while do no show the first row from table in database.. example : <? $conn = mysql_connect($DBhost,$DBuser,$DBpass) or...
1
by: juancho8529 | last post by:
I ned know how set the number of rows obtained from a interbase 2.0 query, hi have tried with instructions has fetch rows, limit, top... but i didn't have found a correct result, Please if...
1
by: rahullko05 | last post by:
Hi, i am building a small forum site as my final year project & stuck in a very trivial problem. I have a table which are varchar type of data & i am trying to fetch data from table based on...
0
tuxalot
by: tuxalot | last post by:
Hello all, I have a 2 column table that looks like such 1 apple 2 banana 3 orange 4 tomato 5 strawberry
1
by: rajeev patel | last post by:
How to fetch rows into column in gridview with the help of sql server. Id Date Attendance LAB01 2012-06-01 P FBD/SL/01/2012 2012-06-01 A FBD/SL/05/2012 ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.