Jump to content

david212

Members
  • Posts

    61
  • Joined

  • Last visited

    Never

Everything posted by david212

  1. Hi Tried and the same , printing 3 times and below is the screenshot of my 3 data and if i put the 4th time the payment it will be displayed 4 times. How to avoid it
  2. here you have entire code: <?PHP session_start(); include_once("./includes/config.php"); include_once("./check_session.php"); if($_REQUEST['strAmount']!="") { $strInsert="INSERT INTO `user_detail` ( `user_id` , `amount` , `payment_method:` , `Invoice_number`, `detail_date` ) VALUES ( '".$_SESSION['user_id']."', '".$_REQUEST['strAmount']."', '".$_REQUEST['strPaymentMethod']."', '".$_REQUEST['strInvoiceNumber']."', '".date('Y-m-d')."' )"; mysql_query($strInsert); } if($_SESSION['username']=="administrator") { $where=""; } else { $where="where user_id='".$_SESSION['user_id']."'"; } $strSelectoverDue="select * from user_detail $where "; $objSelectoverDue=mysql_query($strSelectoverDue); while($rsSelectoverDue=mysql_fetch_array($objSelectoverDue)) { $InvoiceDate=$rsSelectoverDue['detail_date']; $InvoiceDate = explode("-",$InvoiceDate); $mdyInvoiceDate=date('m-d-Y',mktime(0, 0, 0,$InvoiceDate[1]+1,$InvoiceDate[2],$InvoiceDate[0])); $mdyInvoiceDate = explode("-",$mdyInvoiceDate); $mdyInvoiceDate=$mdyInvoiceDate[2]."-".$mdyInvoiceDate[0]."-".$mdyInvoiceDate[1]; $date=date("Y-m-d"); if($mdyInvoiceDate<$date) { $strUpdate="update user_detail set overdue=1 where user_detail_id='".$rsSelectoverDue['user_detail_id']."'"; mysql_query($strUpdate); } } include_once("header.php");?> <script type="text/javascript" src="./include/common.js"></script> <div id="content"> <div class="right"> <table border="1" cellpadding="0" align="center" cellspacing="0" width="100%" style="border-collapse: collapse" bordercolor="#E0E0E0" height="380"> <tr valign="top" align="center"> <td> <form name="frmUsers" action="" method="post"> <input type="hidden" name="intMemberId" id="intMemberId" value="" > <input type="hidden" name="action" id="action" value="" > <?php if($_SESSION['username']!="administrator") {?> <table width="98%" border="1" align="center" cellpadding="2" cellspacing="2"> <?PHP if(isset($_REQUEST['strMsg'])){?> <tr> <td colspan="3" align="center" class="arial_black_regular"><span class="arial12_red"><?PHP echo $_REQUEST['strMsg'];?></span></td> </tr> <?PHP } $strSelect="select * from user_master where user_id='".$_SESSION['user_id']."'"; $objSelect=mysql_query($strSelect); $rsSelect=mysql_fetch_array($objSelect); $strDate =$rsSelect['date']; $strDate = explode("-",$strDate); $month_name = date( 'F', mktime(0, 0, 0, $strDate[1]) ); ?> <tr> <td width="33%" align="left" class="arial_black_regular"> <strong>username</strong></td> <td width="33%" align="left" class="arial_black_regular"> <?php echo $_SESSION['username'];?></td> <td width="33%" align="left" class="arial_black_regular"> <B>current month <?php echo $month_name;?></B></td> </tr> <tr> <td width="179" align="left" class="arial_black_regular">payment formა:</td> <td width="200" height="25" align="left" class="arial_black_regular"><input type="text" name="strPaymentMethod" /></td> <td width="200" height="25" align="left" class="arial_black_regular"></td> </tr> <tr> <td width="179" align="left" class="arial_black_regular">amount:</td> <td width="200" height="25" align="left" class="arial_black_regular"><input type="text" name="strAmount" /></td> <td width="200" height="25" align="left" class="arial_black_regular"></td> </tr> <tr> <td width="179" align="left" class="arial_black_regular">transaction code:</td> <td width="200" height="25" align="left" class="arial_black_regular"><input type="text" name="strInvoiceNumber" /></td> <td width="200" height="25" align="left" class="arial_black_regular"><input type="submit" value="შენახვა"/></td> </tr> </table> <?php } ?> <br /> <h3>Payment History</h3><br /> <table width="100%" border="1" align="center" cellpadding="2" cellspacing="2"> <tr> <?php if($_SESSION['username']=="administrator"){?> <td width="20%" align="left" class="arial_black_regular">user</td><?php }?> <td width="20%" align="left" class="arial_black_regular">month</td> <td width="20%" align="left" class="arial_black_regular">date</td> <td width="20%" align="left" class="arial_black_regular">amount</td> <td width="20%" align="left" class="arial_black_regular">transacton code</td> <td width="20%" align="left" class="arial_black_regular">overdue</td> </tr> <?php if($_SESSION['username']!="administrator") { $where="and user_master.user_id='".$_SESSION['user_id']."'"; } else { $where=""; } ?> <?php $strSelectDetail="select * from user_detail,user_master where user_master.user_id=user_detail.user_id $where"; $objSelectDetail=mysql_query($strSelectDetail); while(@$rsSelectDetail=mysql_fetch_array($objSelectDetail)) { $strDate =$rsSelectDetail['detail_date']; $strDate = explode("-",$strDate); $month_name_detail = date( 'F', mktime(0, 0, 0, $strDate[1]) ); if($rsSelectDetail['overdue']==1) $overdue="Yes"; else $overdue="No"; if($_SESSION['username']=="administrator" && $overdue=="Yes") $reminder='<a href="reminder.php?id='.$rsSelectDetail['user_detail_id'].'">Reminder</a>'; else $reminder=""; ?> <?php $query = "SELECT SUM(amount) FROM user_detail"; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "<p align=\"left\">Total ".$row['SUM(amount)']."</p>"; echo "<br />"; } ?> <tr> <?php if($_SESSION['username']=="administrator"){?><td><?php echo $rsSelectDetail['username'];?></td><?php }?> <td><?php echo $month_name_detail;?></td> <td><?php echo $rsSelectDetail['detail_date'];?></td> <td><?php echo $rsSelectDetail['amount'];?></td> <td><?php echo $rsSelectDetail['Invoice_number'];?></td> <td><?php echo $overdue." ".$reminder;?></td> </tr> <?php }?> </table> </form> </td> </tr> </table> </div> <?PHP include_once("left.php")?> <div style="clear: both;"> </div> </div> <?PHP include_once("footer.php")?> </div> </body> </html> I have one submit button for the fields and if user pays more than one time within a month it displays the same time :S
  3. No, i'm including it only one time. Sincerely. I don't know why it is printed more than 2 times. On the october payment I entered payment 3 times and maybe for this reason it is printing in this way, but I would like to print all my payments (even if there are more than 1 within the month) only one time. I have not used debug statment.
  4. Hello. I have here a php code getting information from mysql but when printing the result is duplicated, or more. <?php $query = "SELECT SUM(amount) FROM user_detail"; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "<p align=\"left\">Total ".$row['SUM(amount)']."</p>"; } ?> and then I get result like this: you can see there are 3 result and I need to print only one time. I use for sql connection other file with : include_once("./includes/config.php"); Need help to solve this Thanks in advance
  5. I know but I changed string names It doesn't matter at all. I would like to find an answer for this quiz. Three times I showed him my work and all of them were rejected so that's why I had to post to find a help
  6. Thanks for the reply Justin but me too Im a bit confused. This is a sql syntax i have to solve as a hometask. I submitted solution for php but it was not accepted.
  7. Hello guys, I'm trying to solve my hometask . I tried in many different ways to solve the task related with Advanced SQL Syntax. Please check the pic below: The Quiz is asking for make location appear in all uppercase letters, the character associated with a given ASCII value and the table is people. I tried the last one in this way: SELECT CONCAT(name,'is from',strtoupper(location),' The ASCII character of the number ',number,' is ',ASCII(number)) FROM `people` WHERE 1 but it doesn't work. Can someone help me? Thanks
  8. Hello. I'd like to ask something to experts. I have wordpress blog , for example http://site.com . And in the root directory where my site is located i have other file.php (http://site.com/file.php). So, can i use wordpress header.php and footer.php files in my file.php , the only thing i want to do is that file.php have the same header and footer that wordpress has. Thank you
  9. All the thins i want to do here is: if not cookie = put there download link if cookie = you have already downloaded please try again in 5 days <?php session_start(); ?> <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { if(isset($_POST['user']) && $_POST['user']) { if(isset($_COOKIE[$_POST['user']]) && !empty($_COOKIE[$_POST['user']])) { echo "you have already downloaded please try again in 5 days"; } else { setcookie("email[name]", $_POST['email'], (time()+3600*24)*7); echo "<a href='download.php'>Download Now</a>"; } } } ?> <form name="cfrom" method="post"> <input type="text" name="name" id="name"> <input type="text" name="email" id="email"> <input type="submit" value="submit"> </form> what im doing wrong? Please help!
  10. nice answer but i really need the help!
  11. My hometask says: each user must register own email address to download the file. You must use cookies to detect whether the user has already registered, and to ensure that the user downloads the file only once within 7 days of registering. I have been making a lot of things but i can get it working. Please help! The last code i wrote is this: <?php if (!empty($_POST['delete_cookie'])) { setcookie("sevendays", "", time()-3600); } if(isset($_POST['terms'])AND(isset($_POST['email']))AND(empty($_COOKIE["sevendays"]))){ $email = $_POST['email']; setcookie("sevendays", "email", time()+60*60*24*7); $filepath = $_SERVER['DOCUMENT_ROOT']."/.php_files/acme_brochure.pdf"; if (file_exists($filepath)) { header("Content-Type: application/force-download"); header("Content-Disposition:filename=\"brochure.pdf\""); $fd = fopen($filepath,'rb'); fpassthru($fd); fclose($fd); } } ?> <?php if (isset($_POST['ok'])){ if($_POST['mail']== $_COOKIE['email']){ echo "This email address has already been registered<br>"; }else { echo "<h3>Thank you!</h3>"; } } ?> <?php if (!empty($_COOKIE["sevendays"])) echo "only in 7".$_COOKIE["sevendays"]." days!"; if ($_COOKIE["sevendays"]) { echo $_COOKIE["sevendays"]; ?> <a href="download.php?delete_cookie=1">Not my email: <? echo $_COOKIE["sevendays"]; ?>?</a> <?php }else { ?> <h3>Please register</h3> <form method="POST" action="?"> <table> <tr> <td align="right"> Name: </td> <td align="left"> <? if ($_COOKIE['name']) { echo $_COOKIE['name']; } else { ?> <input type="text" size="25" name="name" value="<? echo $_POST['name']; ?>"> <?php } ?> </td> </tr> <tr> <td align="right"> Email: </td><td align="left"> <? if ($_COOKIE['email']) { echo $_COOKIE['email']; } else { ?> <input type="text" size="25" name="email" value="<? echo $_POST['email']; ?>"> <?php } ?> </td> </tr> <tr> <td colspan="2"> <input type="checkbox" name="terms" checked="checked">I accept terms and conditions.<br/> </td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" name="ok" value="SUBMIT" /> </td></tr> </table> </form> <?php } ?> i can't get it working. Please help!
  12. this is what i do not understand. it is my home task. i had to crate it in assosiative array and my instrucotr told me create it in 2d array and i don't know how to do it . Any suggestion?
  13. here it is what i created: <?php $arr = array("1"=>"Jan", "2"=>"Feb", "3"=>"Mar","4"=>"Apr","5" => "May","6" => "Jun","7" => "Jul","8" => "Aug","9" => "Sept"); echo "<pre>"; foreach($arr as $month=>$item) { echo "$month: $item\n"; } echo "</pre>"; ?> i want to list all months using 2 dimension array Thank you
  14. <? function transl($text) { $onset=implode('|', array('th', 'qu', 'br')); return preg_replace('~('.$onset.'|\w)(\w*)~i', '$2$1ay', $text); } $text = 'here goes text for translate '; echo transl($text); ?> But the problem is that if a word starts with a vowel it is displayed in a different way, i mean only -ay is added, no character rearrangement. How can i solve it. Please help.You can read information here: http://en.wikipedia.org/wiki/Pig_Latin
  15. how to create a 2 dimension array for this: : Jan : Feb : Mar : Apr : May : Jun : Jul : Aug : Sept thank you
  16. I mean, there are some characters characters that should be escaped in PHP. do strings escape this chars in every instance, or just in certain situations
  17. Hello. Im reading things about string. I want to clarify 1 thing, do strings escape in every instance, or just in certain situations?
  18. Thank you very much now i understand better !
  19. i've mentioned that i used print_r($array) an got the 12 but why ? Because the last increment stopped at 11? But i'm asking, if the $xR[8] = "ge, for the "hr" won't be the 9, i mean based on the "8" value incrementing only 8 not 11
  20. Hello there. I have this php array code: <?php $xR = array(3 => "ar", "br", 6 => "cr", "de", 10 => "en", "fr"); $xR[8] = "ge"; $xR[] = "hr"; ?> what would be the key for "br"? I think it's 4. But when i want to know the value for "hr" using print_r($xR); i'm getting 12 for "hr" . If the last $xR[8] = "ge"; the "hr" won't be the 9? :S by assingning the next increment after used number? Please explain, im confused with this one Thank you
  21. Thank you Ken2k7 but i find the solution in this way: function subtotals($price, $tax, $shipping){ $var_total_price += $price; $total_tax += $tax * $price; $var_total_shipping += $shipping * $price; $var_g_total = $var_total_price + $total_tax + $var_total_shipping; $result += $var_g_total; return $result; }
  22. this is my hometask, and right now i don't know how to use arrays . It's just an introduction to functions and i don't know how to store correctly all values to get subtotal for each product
×
×
  • 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.