Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8277601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:43:54+00:00 2026-06-08T08:43:54+00:00

<?php mysql_connect(your.hostaddress.com, username, password) or die(mysql_error()); mysql_select_db(Database_Name) or die(mysql_error()); $result = mysql_query(SELECT <column name>

  • 0
<?php
mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error());
mysql_select_db("Database_Name") or die(mysql_error()); 
$result = mysql_query("SELECT <column name> FROM <table name>"); 
$data=array();  // to create an array to store result
while ( $row= mysql_fetch_array( $result ))
   {
    $data = $row;
   }

?> 

This query returns multiple lines of result like:

abc
def
ghk
...
...
...
...
...

My question is how can I change the looping structure so that each row from output value is feed to the parser one by one.

Using the code snippet above, only one is feed to the parser. But I want each row to be feed to parser one by one.

I found the solution. It works.

<?php 
 mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()); 
 mysql_select_db("Database_Name") or die(mysql_error());  
$result = mysql_query("SELECT <column name> FROM <table name>");  
while ( $row= mysql_fetch_array( $result ))  
{  
echo $row['column name']; // to check does it works fine. 
// pass the variable " $row['column name'] " as paramter to parser function it works.  
//I have tried it. 
}  

?>  

I was using wrong way to input in a array. The best way is to pass directly variable inside the loop to parser function. Then we wouldn’t need any external array to store the results.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:43:56+00:00Added an answer on June 8, 2026 at 8:43 am

    My take at your question. Its kinda difficult to understand what you are asking.

    how can I change the looping structure so that each row from output
    value is feed to the parser one by one.

    Where is the parser?

    <?php
    mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error());
    mysql_select_db("Database_Name") or die(mysql_error()); 
    $result = mysql_query("SELECT <column name> FROM <table name>"); 
    $data=array();  // to create an array to store result
    while ( $row= mysql_fetch_array( $result ))
    {
        //here you did the mistake if you wanted to store it in a array (like you indicated in the above comment)
        $data[] = $row;
    
    
        // Pass anything to the parser here
    }
    
    // Or here you can pass it to the parser
    // parser($data);
    
    ?>
    

    Only one is feed to the parser. BUt I want each row to be feed to
    parser one by one.

    Ok, this one I assume says this:

    Only a single row is fed to the parser (due to the error I showed you above). You want to process all the rows

    Here is the solution:

    <?php
    mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error());
    mysql_select_db("Database_Name") or die(mysql_error()); 
    $result = mysql_query("SELECT <column name> FROM <table name>"); 
    
    $answer = array();  // to create an array to store result
    
    while ( $row= mysql_fetch_array( $result ))
       {
    
        $answer[] = parser($row);
       }
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code: <?php $conn = mysql_connect('localhost', 'username', 'password'); mysql_select_db('database', $conn); ?> This
<?php ini_set('display_errors', 0); $search = $_GET ['search']; mysql_connect(localhost, root, gokul); mysql_select_db(search123); $query = mysql_query(SELECT
<?php //connect to your database ** EDIT REQUIRED HERE ** mysql_connect(localhost,root,root); //(host, username, password)
Here is my complete code.... Connect.php $connect = @mysql_connect ($host, $username, $password, $db_name) or
This is my php script for fetching data from a db. <?php mysql_connect(host,user,pass); mysql_select_db(db);
Here is my code- <?php $con = mysql_connect('db', 'table', 'p/w'); if (!$con) { die('Could
Consider the following code <?php $username = root; $password = ; $host = localhost;
For example, testing the code: <HTML> <BODY> <?php $connect = mysql_connect(localhost, root, password) or
I have the code below: <html><body> <?php $con = mysql_connect(localhost,will,blahblah); if (!$con) { die('Could
<?php include(../package/mysql-connect.php); //connect- succeeds //cleanin' data $username = trim(mysql_real_escape_string($_POST['username'])); $password = hash('sha512', $passround); $fname

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.