Jump to content

ypkumar

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ypkumar's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. right, I found a solution by myself again PHP - easier than making a tea! LOL
  2. Hi! I don't have any problems with fetching the array, I am having problems in presenting the data fetched. I have solved the problem myself i've used this mysql_fetch_assoc() instead of mysql_fetch_array() ----- now the problem lies in within the next leg of the page. <table> <tr> <td> sender </td> <td> message </td> <td> mark as read </td> </tr> <?php $q = "select customer_fname, customer_message from customer_messages where flag = '0'"; $w = mysql_query($q); while($r = mysql_fetch_assoc($w)) {?> <tr> <td> <?php echo $r['customer_fname'];?> </td> <td> <?php echo $f['customer_message'];?> </td> <td> <input type="checkbox" name="markasread" value="$f['entryid'];" /> </td> </tr> } thats show.php and that gives me, a list of messages from different users. ================================================================ now i need to select the checkbox and click a button to approve them. in the next page 'mesenger.php' i need to fetch the id's of members whose checkbox i have clicked on previous page. i can use $_POST['markasread']; but i need to find out which checkboxes i have checked and which i havent checked. . how do i check that? amny help would be greatly appreciated
  3. hi pikachu () as i mentioned earlier "$t now gives me total number of unread messages in the db." ofcourse it doesnt list all the elements, this is what i thought i must do <table> <tr> <td> sender </td> <td> message </td> <td> mark as read </td> </tr> <?php $q = "select customer_fname, customer_message from customer_messages where flag = '0'"; $w = mysql_query($q); while($r = mysql_fetch_array($w)) {?> <tr> <td> <?php echo $r['customer_fname'];?> </td> <td> <?php echo $f['customer_message'];?> </td> <td> <input type="checkbox" name="read" value="1" /> </td> </tr> } this code retrieves the first entry from the 'db' which has flag set to '0'. now I need to fetch all the entries . what do i do? i'm thinking of a for loop, but still cant get my head around on how to put it here.
  4. 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?
  5. Hello guys, I am a beginner in PHP, so please be gentle. I am building this website for a friend of mine. This website is made up by HTML/CSS. i.e., I have a page made with HTML & CSS. there are a few menus on the page. say Home, About Us, Contact Us, etc., Now I want to separate the page elements (like header/footer) from the page so as its easy to work on. the source is something like this <HTML> <HEAD> <TITLE> My Page </TITLE> <LINK REL="STYLESHEET" HREF="./mystyle.css" TYPE="text/css" /> </HEAD> <BODY> <DIV ID="wrapper"> <DIV ID="header"> <DIV ID="logo"> <UL ID="menu"> <LI> <A HREF="./index.php"><SPAN>Home</SPAN></A> </LI> <LI> <A HREF="./login.php"><SPAN>Login</SPAN></A> </LI> <LI> <A HREF="./contactus.php"><SPAN>Contact Us</SPAN></A> </LI> </UL> <DIV ID="date"> <?php echo Date("d M Y");?> </DIV> </DIV> </DIV> <DIV ID="bodywrapper"> <DIV ID="main"> <DIV ID="content"> THIS IS A TEST! </DIV> </DIV> </DIV> <DIV ID ="clearfooter"></DIV> </DIV> <DIV ID="footer"> © <?php echo date("Y");?> </DIV> </BODY> </HTML> now I will have my content in the DIV called 'content'. now I have separated this one page into three different pages. like this: header.php <HTML> <HEAD> <TITLE> My Page </TITLE> <LINK REL="STYLESHEET" HREF="./mystyle.css" TYPE="text/css" /> </HEAD> <BODY> <DIV ID="wrapper"> <DIV ID="header"> <DIV ID="logo"> <UL ID="menu"> <LI> <A HREF="./index.php"><SPAN>Home</SPAN></A> </LI> <LI> <A HREF="./login.php"><SPAN>Login</SPAN></A> </LI> <LI> <A HREF="./contactus.php"><SPAN>Contact Us</SPAN></A> </LI> </UL> <DIV ID="date"> <?php echo Date("d M Y");?> </DIV> </DIV> </DIV> footer.php <DIV ID ="clearfooter"></DIV> </DIV> <DIV ID="footer"> © <?php echo date("Y");?> </DIV> </BODY> </HTML> and index.php <?php include_once('header.php');?> <DIV ID="bodywrapper"> <DIV ID="main"> <DIV ID="content"> THIS IS A TEST </DIV> </DIV> </DIV> <?php include_once('footer.php');?> Is this the right way to code? I am worried because I have to keep in mind the safety of the website as I have to include a basic login module to this. is there any other style to write this? please do let me know.. thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.