just a small query..
.
.
i just want to know how to enter fetched data into an array..!!!

Recommended Answers

All 5 Replies

do this:
1. Fetch the data from data base.
2. Have a loop to fill the data in array.

Post the code what ever you have done so far, for better help.

$checkExists = "select * from 0_ledger";  

$checkExists_result= mysql_query($checkExists)
   OR die('QUERY ERROR:<br />' .$checkExists. '<br />' .mysql_error());
   
$NumberOfResults=mysql_num_rows($checkExists_result);

i have fetch data into an array..!! Thanx

NO ans. uptil now.? :O i dont think it is that dificult..!!

hi sam... here i am fetching the data from the db and assing that data to a string array...
code is ...

protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(@"Data Source=WINKC185045-MAB\SQLEXPRESS;Initial Catalog=Records;Integrated Security=True");
        SqlDataAdapter da = new SqlDataAdapter("select name from data", con);
        DataSet ds = new DataSet();
        da.Fill(ds, "data");

        string[] s;
        s = new string[9];
               

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            s[i] = ds.Tables[0].Rows[i][0].ToString();
            Response.Write(s[i]);
            
        }

              
    }

Hope it helps u.....let me know if u face any difficulties...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.