468,512 Members | 1,449 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

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 992
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

Post your reply

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

Similar topics

3 posts views Thread by Stijn Goris | last post: by
reply views Thread by Luis Esteban Valencia | last post: by
2 posts views Thread by Hymer | last post: by
1 post views Thread by juancho8529 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.