Jump to content

ypkumar

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Everything posted by ypkumar

  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
  6. thanks guys, found out that unicode/utf-8 character is the culprit.. couldnt reply faster because i wanted to finish this project.
  7. arrrggh i sit here and write a descriptive information about my problem and tried to upload a file, the write up's all gone! grrr...... ill do it the simple way my system: Windows Vista XAMPP Lite 1.7.3 PHP Version 5.3.1 mysqlnd 5.0.5-dev - 081106 - $Revision: 289630 $ mysql/mysqli 5.1.41 my application: PHP MySQL based banking application, where user can register, login, logout, add remove and edit friends accounts, transfer funds, change password, change personal info, get transaction details etc. etc., my problem: i rewrote the application conforming to OOP concepts, and I separated the functions by its behaviour (authenciation, fetching, dbo etc). when i wrote a function for transferring funds from account a to account b, i recieve an error. Fatal error: Call to undefined function mysql_query() in C:\xampplite\htdocs\mybank\classes\func.inc on line 197 - i did not upgrade/update either PHP nor SQL, and yes, SQL is enabled on my system and works fine with other functions (register,change pasword etc.) i wrote for the same appilcation. FOR THOSE WHO WANT TO HAVE A LOOK, i have uploaded the class file here : http://pastebin.com/PGaXgmkC im not sure whats causing the error, when i remove the code to transfer the funds, it works like charm, but at the same time, the code which is removed is not wrong, it works without errors too! can anyone please look into this issue and let me know? im dying to get this one fixed since 2 days!
×
×
  • 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.