i'll be gratified if anyone can help me thru this .....

my problm if that i have to retrieve data from my sql database ... bt itz stored thr from an app created in php .. so stored using preg_match function in php ....&nbsp;hlo<div><br></div> this is format i have it in my database but i need only the text part .... plzzz guide me as m nt knwn to php that much .... regards

Is it always going to be in this &nbsp;hlo<div><br></div> Format? and only the hlo part changes? if that's the case there are numerous methods you can use just off the top of my head something like this

string test = "&nbsp;hlo<div><br></div>";
test = test.Substring(test.IndexOf(";")+1, test.IndexOf("<") - test.IndexOf(";")-1);

thanxzz fenrir it was fun learning from yu ..... m done with dis but getting an issue in dispalying thr corresponging id'z aside

i mean i m able to retrieve both of them .. user_name and corresponding message ... but i need to retrieve them in reverse order .... //
i mean i m getting it as sandeep .,,,. rahuldeep

bt i need the result in richtextbox as rahuldeep .,,,. sandeep

So you're getting Message - > Username? Sorry i don't quite understand your question. Please post the code aswell

Inline Code Example Here void chatting()
{
string myconnection = "connection string ";
MySqlConnection myConn = new MySqlConnection(myconnection);
MySqlCommand SelectCommand = new MySqlCommand(" select * from livestream.users INNER JOIN livestream.chat INNER JOIN livestream.video ON users.user_id = chat.user_id and chat.channel_id=video.video_id where chat.channel_id ='" + videoid + "' and isACTIVE=1 order by chatID ASC ", myConn);

          MySqlDataReader myReader;


          try
          {
              myConn.Open();
              myReader = SelectCommand.ExecuteReader();
              List<string> list = new List<string>();

              while (myReader.Read())
              {
                  string test1 = myReader.GetString("user_name");
                  string test = myReader.GetString("message");
                  test = test.Substring(test.IndexOf(";") + 1, test.IndexOf("<") - test.IndexOf(";") - 1);
                  list.Add(test1 + "  " + test);

              }

              chattingbox.Lines = list.ToArray();

          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message);
          }
          myConn.Close();

    }    ....... i have sent u the snapshot of what error m i getting .. please tel where m i making mistake ..

myConn.Open(); add a breakpoint here and step your code and see on exactly what line it throws an exception

no where fenrir .. itz not giving me any error except where i added brkpoint .... look i am gettng that parameter length as an error , i don't know y ? ,, any help will be appreciated

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.