hello guys,
I'm stuck here:
I have a table called customer_messages which has a entryid, custid, fromname, message, flag
i have written a script to enter data into this. and another script to count the number of entries in the table.
now i want to display entries in the table on to a script what i did was this:
flag is by default '0' which mean unread.
insertion code:
insert into customer_messages (customer_id,customer_fname,customer_message,flag) values('21','mike','hello!','0')
fetching number of unread messages
select count(*) from customer_messages where flag = '0'
$q = "select count(*) from customer_messages where flag = '0'";
$w = mysql_query($q);
$r = mysql_fetch_array($w);
$t = $r[0];
$t now gives me total number of unread messages in the db.
now, I want to display these messages on to a page in the following format:
-----------------------------------------------------------------------------------------------
| sender | message | mark as read |
-----------------------------------------------------------------------------------------------
| name_from_db | message_from_db | check box |
-----------------------------------------------------------------------------------------------
| name_from_db | message_from_db | check box |
-----------------------------------------------------------------------------------------------
how do I do this?
I'm assuming that I have to use a loop here, I put the code in a while loop, but that didnt work out for me.
can I use a for loop here? if yes how do i use it?
my brain's froze now so, i cant think atm, can someone help me out please?
=================================================================================
in short i need the data from database to be listed as listbox control in asp.. is it possible?