Jump to content

max_w1

Members
  • Posts

    122
  • Joined

  • Last visited

Everything posted by max_w1

  1. hi, i am new to mobile development, would be glad if anyone can suggest me a framework which best supports mobile development. i will be having a web version of my application as well.
  2. Hi, i have to generate an invoice from my database. every thing works well. i have read posts here about using buffer and i am till now sucessfully able to generate the invoice. The Problem come when i try to use headers and footers in the page. i get an error in the pdf file "damaged or corrupted". here is my code. <?php include('config.php'); session_start(); $invoice = $_SESSION['lid']; include("/mpdf/mpdf.php"); $mpdf=new mPDF('en-x','A4','','',32,25,47,47,10,10); $header = ' <table width="100%" style="border-bottom: 1px solid #000000; vertical-align: bottom; font-family: serif; font-size: 9pt; color: #000088;"><tr> <td width="19%"><img src="logo.jpg" width="126px" /></td> <td width="68%" align="center"><p align="center" style="font-size:14px; color:#000000;"><strong>Sapience Business Events Private Limited </strong></p> <p align="center" style="font-size:12px; color:#000000;"><strong>Invoice</strong></p></td> <td width="13%" style="text-align: right;"> </td> </tr></table> '; $footer = '<table width="100%" style="border-bottom: 1px solid #000000; vertical-align: bottom; font-family: serif; font-size: 9pt; color: #000088;"><tr> <td><div align="" style="float:left; padding:0,20,30,10"> <div align="center"></div> </div> <div align="center"> <div align="center"> <p allign="center"><span style="font-size:12px; color:#000000;">#92/3-3, The Pearl, Mosque Road, Frazer Town, Bangalore - 560 005, India</span> </p> <p allign="center"><span style="font-size:12px; color:#000000;">E-mail: trainings@sapienceevents.com</span></p> <p allign="center"><span style="font-size:12px; color:#000000;">Tel: +91 80 41241378 Fax: +91 80 41263672</span></p> </div> </div> </td> </tr></table>'; $mpdf->SetHTMLHeader($header); //$mpdf->SetHTMLHeader($headerE,'E'); $mpdf->SetHTMLFooter($footer); //$mpdf->SetHTMLFooter($footerE,'E'); ob_start(); ?> <head> <style> table.sample { border-width: 1px; border-spacing: 0px; border-style: solid; border-color: #000000; border-collapse: collapse; background-color: #ffffff; } table.sample th { border-width: 1px; border-style: solid; border-color: #000000; background-color: #ffffff; } table.sample td { border-width: 1px; border-style: solid; border-color: #000000; background-color: #ffffff; } </style> </head> <body><table width="629"> <tr> <td width="768"><table width="577"> <tr> <td width="177">Invoice Number:</td> <td width="325"><?php echo $_SESSION["invoice_number"]; ?></td> <td width="59"> </td> </tr> <tr> <td>Invoice Date:</td> <td><?php echo $_SESSION["invoice_date"]; ?></td> <td> </td> </tr> <tr> <td>Training Code:</td> <td><?php echo $_SESSION["training_code"]; ?></td> <td> </td> </tr> <tr> <td>Reference Date:</td> <td><?php echo $_SESSION["reference_date"]; ?></td> <td> </td> </tr> <tr> <td>Due Date for payment:</td> <td><?php echo $_SESSION["due_date"]; ?></td> <td> </td> </tr> <tr> <td>Invoice Currency:</td> <td>USD</td> <td> </td> </tr> <tr> <td>Event Details:</td> <td><p><?php echo $_SESSION["ed_training_name"]; ?></p> <p><?php echo $_SESSION["ed_training_date"]; ?> <?php echo $_SESSION["ed_training_place"]; ?></p></td> <td> </td> </tr> </table></td> </tr> <tr> <td> </td> </tr> <tr> <td><table width="434"> <tr> <td width="35">To:</td> <td width="226"><?php echo $_SESSION["iaddr"]; ?></td> <td width="157"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>Attn:</td> <td><?php echo $_SESSION["officials_name"]; ?></td> <td> </td> </tr> </table> <table width="772" border="0" bordercolor="#000000" class="sample" style="border-collapse: collapse"> <tr> <td width="64" bgcolor="#CCCCCC" style="border-collapse: collapse"><div align="center">Sl. No.</div></td> <td width="101" bgcolor="#CCCCCC" style="border-collapse: collapse"><div align="center">Particulars</div></td> <td width="155" bgcolor="#CCCCCC" style="border-collapse: collapse"><div align="center">Price per Participant</div></td> <td width="173" bgcolor="#CCCCCC" style="border-collapse: collapse"><div align="center">No. of Participants</div></td> <td width="255" bgcolor="#CCCCCC" style="border-collapse: collapse"><div align="center">Amount</div></td> </tr> <tr> <td><div align="center"></div></td> <td><div align="center"></div></td> <td><div align="center"></div></td> <td><div align="center"></div></td> <td><div align="center"></div></td> </tr> <tr> <td style="border-collapse: collapse"><div align="center">1</div></td> <td style="border-collapse: collapse"><div align="center"><?php echo $_SESSION["tn"]; ?></div></td> <td style="border-collapse: collapse"><div align="center"><?php echo $_SESSION["ppc"]; ?></div></td> <td style="border-collapse: collapse"><div align="center"><?php echo $_SESSION["noc"]; ?></div></td> <td style="border-collapse: collapse"><div align="center"> <?php $amount = $_SESSION["ppc"] * $_SESSION["noc"]; echo $amount; $tamount = $_SESSION["ppc"] * $_SESSION["noc"]; ?> </div></td> </tr> <?php $pert_query = mysql_query ("SELECT * FROM `perticulars` WHERE `invoice` =$invoice") or die(mysql_error()); $i = 2; $total = 0; while($perticulars = mysql_fetch_array($pert_query, MYSQL_ASSOC)) { ?> <tr> <td style="border-collapse: collapse"><div align="center"><?php echo $i; $i++; ?></div></td> <td style="border-collapse: collapse"><div align="center"><?php echo $perticulars["perticulars"]; ?></div></td> <td style="border-collapse: collapse"><div align="center"><?php echo $perticulars["ppc"]; ?></div></td> <td style="border-collapse: collapse"><div align="center"><?php echo $perticulars["nop"]; ?></div></td> <td style="border-collapse: collapse"><div align="center"> <?php $amount = $perticulars["ppc"] * $perticulars["nop"]; echo $amount;?> </div></td> </tr><?php $total = $total + $amount; } ?> <tr> <td colspan="4" style="border-collapse: collapse"><div align="center">Total</div></td> <td style="border-collapse: collapse"><div align="center"><?php $sum = $total + $tamount; echo $sum; ?></div></td> </tr> </table> <p> </p> <table width="260" border="0"> <tr> <td width="161">Invoice Amount</td> <td width="22"> </td> <td width="63">3015</td> </tr> <tr> <td>Amount paid</td> <td> </td> <td>0</td> </tr> <tr> <td>Balance amount to be paid</td> <td> </td> <td>3015</td> </tr> </table> <p>Our Bank Reference:</p> <table width="402" border="0" bordercolor="#000000" class="sample"> <tr> <td style="border-collapse: collapse">Bank Name:</td> <td width="215" style="border-collapse: collapse">HDFC BANK LTD</td> </tr> <tr> <td style="border-collapse: collapse">Bank Address:</td> <td style="border-collapse: collapse">CMH Road, Indira Nagar Bangalore - 560038</td> </tr> <tr> <td style="border-collapse: collapse">Beneficiary:</td> <td style="border-collapse: collapse">Sapience Business Events Private limited</td> </tr> <tr> <td style="border-collapse: collapse">Account Number:</td> <td style="border-collapse: collapse">0184-256000-4182</td> </tr> <tr> <td style="border-collapse: collapse">Swift Code:</td> <td style="border-collapse: collapse">HDFCINBB</td> </tr> <tr> <td style="border-collapse: collapse">ABA Number:</td> <td style="border-collapse: collapse">021-000-021</td> </tr> </table> <p style="font-size:14px; color:#000000;">International delegates please note, when paying by bank transfer the <strong>bank charges should be added to the total amount due.</strong> Payment is required within the due date from the date of booking. When making payment please quote the invoice/order number. Send your remittance advice/transaction slip to the email address suman.s@sapienceevents.com or fax to +91 80 41263672</p> </td> </tr> </table> </body>'; <?php $html = ob_get_contents(); ob_end_clean(); $mpdf->WriteHTML($html); $mpdf->Output(); exit; ?>
  3. hello, i have created a table that desplays perticulars, price per person and number of people. the fees is then calculated by multiplying price per person with number of people. till now everything is good. but the problem is when i try to calculate the total fees. here is an example to explain you better: PerticularsPrice Per PersonNumber of peopleAmount something101001000 something else201002000 Total 3000 $pert_query = mysql_query ("SELECT * FROM `perticulars` WHERE `invoice` =$invoice") or die(mysql_error()); $i = 1; $sum = 0 + $_SESSION['sum']; while($perticulars = mysql_fetch_array($pert_query, MYSQL_ASSOC)) { ?> <tr> <td style="border-collapse: collapse"><div align="center"><?php echo $i; $i++; ?></div></td> <td style="border-collapse: collapse"><div align="center"><?php echo $perticulars['perticulars']; ?></div></td> <td style="border-collapse: collapse"><div align="center"><?php echo $perticulars['ppc']; ?></div></td> <td style="border-collapse: collapse"><div align="center"><?php echo $perticulars['nop']; ?></div></td> <td style="border-collapse: collapse"><div align="center"> <?php $amount = $perticulars['ppc'] * $perticulars['nop']; echo $amount; $_SESSION['sum'] = $sum+$amount;?> </div></td> </tr><?php } ?> <tr> <td colspan="4" style="border-collapse: collapse"><div align="center">Total</div></td> <td style="border-collapse: collapse"><div align="center"><?php echo $sum; ?></div></td> </tr> </table> From the above code you can see that i am getting the amount form $amount = $perticulars['ppc'] * $perticulars['nop']; by this each row has its own amount which i got by multiplying the data from mysql. the problem is how do i find out the Total. i know i am suppose to add up $amount but how? i even tired using sessions to store the amount and add the new amount to get total but the problem in using sessions is it messes up my next page, no using session is a very bad idea.
  4. yea, it was the unnecessary line that was causing problem. thanks
  5. hi i want to know how to not skip the first mysql row by using while loop here is my code <?php $mid = $_SESSION['loggedin']; //echo $mid; $datacat = mysql_query ("SELECT * FROM `leads` WHERE `id` =1") or die(mysql_error()); $mydatacat = mysql_fetch_assoc($datacat); //loop start while($row = mysql_fetch_array($datacat, MYSQL_ASSOC)) { ?> <li class="contact clearfix"> <div class="avatar"><img src="./images/user_32.png" /></div> <a class="more" href="./lead_details.php?uid=<?php echo $row['uid'];?>">»</a> <span class="timestamp"><?php echo $row['country'];?></span> <a href="#" class="name"><?php echo $row['company_name'];?></a> <div class="entry-meta"> <?php echo $row['officials_name']."(".$row['job_title'].")"; ?> </div> </li> <?php // loop end } ?> example: the mysql table looks like this id uid row 01 1 first row 02 1 second row 03 2 third row but by using the while loop i can not see the first row.
  6. hello, I was wondering if it is possible to get all the data sent by a html form via post/get method and use it somehow. it is difficult to explain what i mean, i don't mean to say how to get data normally i.e.. by using variables for example $data = $_POST['data']; that can only get only one field that is "data". The reason i am looking for this is because i have many forms that will have to use the mail() function, the problem is creating variables for each from then use the mail() function to send it will be time consuming. and the fields are different in different forms. I have noticed the similar technology used by mailmyform . com, they capture the data in any html form posted to their php page and mail it to the given email.
  7. Hi guru, thank so much for the help, i have sorted the problem out i donno how but i somehow did lol here is the code which worked session_start(); class person { private $id; private $name; public function __construct() { $this->id = $_SESSION['loggedin']; $employe_name = mysql_query("SELECT name FROM `users` WHERE `id` = '$this->id'"); $name = mysql_fetch_assoc($employe_name); $emp_name = $name['name']; $this->name = $emp_name; } function getName() { return $this->name; } } however i am now trying to learn more about encapsulation. i tried tweaking and playing with the script you suggested me but i am not able to understand some part of it not able to find out where and how to use this. i tired to echo it and also tried to put this in a separate class. but i always get a string error or a blank page. perhaps i need to understand this more. Can u please suggest me some tutorials where i can learn about encapsulation, or could suggest me some scripts similar to this, i learn fast by reverse engineering. Thanks in advance
  8. yea, but i wonder if i can access remote mysql using it. I've heard that procedural programming is possible in python but still i don't how if it can access remote mysql.
  9. Thanks for the reply kingphillip. I have Completed the application using Appcelerator's Titanium. But still unhappy with what i did cos it is very unprofessional to use PHP for desktop programming. trying to learn python to redo the project again... btw it would still be helpful if someone suggests me an easy procedural way of desktop programming.
  10. Thanks for the reply, I tried doing that but it is of no use, and i also figured out i am not able to use sessions inside classes at all. i tried to modify the script to show simple session, here it is: session_start(); class person { private $id; public function __construct() { $this->id = $_SESSION['id']; } function get_name() { return $this->id; } } but i am not able to see anything on the page. where as the same script works without session. i am also able to echo the same session without using OOP method.
  11. Hello everyone, I have recently learned programming using OOP, i have done all those "hello world" applications and now have tried to use OOP in the real time programming. In a simple script which gets Username from the database using the employee id. i am not able to use the mysql_fetch_assoc function. here is my code <?php require ("config.php"); session_start(); class person { private $name; private $id; public function __construct() { $sqname = mysql_query("SELECT name FROM `users` WHERE `id` = '$id'"); $assoc = mysql_fetch_assoc($sqname); $fname = $assoc['name']; $this->id = $_SESSION['loggedin']; $this->name = $fname; } function get_name() { return $this->name; } } ?> and in the view file: <?php include("classes/name.php"); $masood = new person; echo $masood->get_name(); ?> and also let me know if i am doing something worng.
  12. Hi guys, I have been programming in php since 4years, but now i have got a project where i have to developed a desktop application which will be updating the MySql Database which is stored online. Since this is not a very big or complicated project i will be better to use the Procedural method of programming, cos it would take me long time to learn and develope the application. I would like to know if there is a procedural programming language that can devolope the application. And The important this is it should be able to contact with the MySql database located online. I have heard that Agena is good option when it comes to Procedural programming in Windows but i don't know if it can interact with the online MySql. I would be glad if someone helps me out with this confusion. Thanks In Advance
  13. hi guys, thank you for trying to help me. i have found a solution for this problem. $ftime = time() - $time_stored_in_database; if ($ftime > 60) { $mtime = $ftime/60; echo $mtime." minutes ago"; } else { echo $ftime. "seconds ago"; } this works great. But this is returning very long values like 74.1333333333. does any one here know how to make this short?
  14. I tried using that method but it is showing me only seconds. like 60seconds ago 85 seconds ago... 400 seconds ago. how do i make it show both in seconds and minutes?
  15. hi, i am working on a new project where i have to make two pages, the first one(add.php) adds the products to the database and the next one(products.php) displays it, the problem is i don't want to display the time when the product was added, i want something like this "This product was added **seconds ago". can someone help me. Thanks in advance.
  16. can anyone tell me where i can find free webhosting with php mail() support?
  17. hi, can any one tell me where i can find free web hosting with php mail() support. thanks in advance
  18. hi, i have mail server, and i have also set headers have a look at this code: <?php $Name = "Da Duder"; //senders name $email = "masoodw1@gmail.com"; //senders e-mail adress $recipient = "websoft_w1@yahoo.com"; //recipient $mail_body = "The text for the mail..."; //mail body $subject = "Subject for reviever"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields ini_set('websoft_w1@yahoo.com', 'masoodw1@gmail.com'); mail($recipient, $subject, $mail_body, $header); //mail command ?> it is still not working.. please help me. pleeeeeeeeese.
  19. hi i want to my feed back form to send all information to be sent on my mail. but it is not working. i tried using many scripts but no use, i have a simple script for testing but that is not working too. could someone plz tell me how to do it. the script which i used for testing is: <?php $to = "masood_w1@yahoo.co.in"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } ?>
  20. thanks a lot. people who find it not working are most welcomed to comment.
  21. Mr.AndyB i dont want to fix any bugs right now. i'll be very greatful to you if you just tell me weather you are able to view the website or not. [YES?] or [NO?]
  22. according to my client the error message he is getting is: Warning: mysql_pconnect(): Too many connections in /home/www/as01.100webspace.net/Connections/ls01.php on line 9 Fatal error: Too many connections in /home/www/as01.100webspace.net/Connections/ls01.php on line 9 But i am not getting any such kind of an error neither my friends are. r u getting any such kind of an error?
  23. hi check out this website http://as01.100webspace.net/ the admin id is as01 and the password is fluid and let me know if it is not working. my client says it is not wroking but it is working form my place.
×
×
  • 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.