Fetch All rows of column in a table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bala Kumaran
    New Member
    • Jan 2013
    • 30

    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

    Code:
    <?php
    include_once("com_check_login.php");
    include("test_connect_to_mysql.php");
    $client_idd = $fgmembersite->UserClientID();
    $sqliw = mysql_query("SELECT * FROM domains WHERE client_id LIKE '" . $client_idd . "'");
    $notify_a = mysql_num_rows($sqliw);
    if($notify_a > 0) {
    	while($rowsj = mysql_fetch_array($sqliw)) {
    		$dom_a_ins = $rowsj["domains"];
    } }
    ?>
    <?php echo $dom_a_ins; ?>
    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
    Last edited by Bala Kumaran; Jun 15 '14, 04:20 AM. Reason: Image does not shows there
  • Bala Kumaran
    New Member
    • Jan 2013
    • 30

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

    Code:
    <?php
    include_once("com_check_login.php");
    include("test_connect_to_mysql.php");
    $client_idd = $fgmembersite->UserClientID();
    $domain_list = "";
    $sqliw = mysql_query("SELECT * FROM domains WHERE client_id LIKE '" . $client_idd . "'");
    $notify_a = mysql_num_rows($sqliw);
    if($notify_a > 0) {
        while($rowsj = mysql_fetch_array($sqliw)) {
            $dom_a_ins = $rowsj["domains"];
            $domain_list = $dom_a_ins;
    } } else {
    $domain_list = "No any domains added here";
    }
    ?>
    <?php echo $dom_a_ins; ?>

    Comment

    Working...