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

Attachments chat.png 200.2 KB

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);

Edited 2 Years Ago by Fenrir()

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

Edited 2 Years Ago by Amanpreet_1

Attachments chatn.png 166.27 KB

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 ..
Attachments parametr.png 276.82 KB

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

Edited 2 Years Ago by Amanpreet_1

Attachments prob.png 202.75 KB prob1.png 196.36 KB
This question has already been answered. Start a new discussion instead.