By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Fetch All rows of column in a table

P: 30
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.  

Share this Question
Share on Google+
1 Reply


P: 30
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.