Jump to content

Barand

Moderators
  • Posts

    24,605
  • Joined

  • Last visited

  • Days Won

    830

Everything posted by Barand

  1. https://lmgtfy.com/?q=html5+download+attribute
  2. Maybe something like this. I cannot guarantee the code as we don't know what you have now or what the correct format is. But it should give you something to work on. $n = 0; $query = []; foreach($complete_req as $myItem ){ $query['request'][$n]['_kf_personnel'] = $_POST['uid']; $query['request'][$n]['_kf_requirementP'] = $complete_req[$n]; $n = $n + 1; }
  3. Add them to the array inside the loop.
  4. I have just tried your first piece of posted code that "doesn't work" and it produced this for all 10 rounds ... So what is it that "doesn't work"? Your second piece of code (extract below) ... $sql="SELECT * FROM $tbl_name13 ORDER BY sid DESC LIMIT 1 "; $result=mysqli_query($con, $sql); while($rows=mysqli_fetch_array($result)){ ?> <title>RR <?php echo $rows['d1header']; ?></title> <link rel='stylesheet' type='text/css' href='../../tracklog.css'> <style type="text/css"> body { font-family: sans-serif; font-size: 12pt; background-color:#666; } table { margin-left: auto; margin-right: auto; width: 90%; /* border-collapse: collapse; } th { ... has a query that is impossible decipher what it does. It also outputs the HTML header info in its while loop! I didn't even try to run it.
  5. Remove the quotes from your table and column name identifiers.
  6. PMFJI, but I ran a simple test Text entered in form Text then stored in db table, retrieved then echoed to page No escaping, adding or stripping slashes required. Just use a prepared statement. EG <?php include 'db_inc.php'; $db = pdoConnect('timeclock'); $db->exec("DROP TABLE IF EXISTS test_jimr"); $db->exec("CREATE TABLE IF NOT EXISTS test_jimr ( quotation varchar(50) )"); $txt = ''; if ($_SERVER['REQUEST_METHOD']=='POST') { $res = $db->prepare("INSERT INTO test_jimr VALUES (?)"); $res->execute( [ $_POST['quote'] ] ); // retrieve it and display it $res = $db->query("SELECT quotation FROM test_jimr LIMIT 1 "); $txt = "<p>" . $res->fetchColumn() . "</p>\n"; } ?> <!DOCTYE html> <html> <head> <meta http-equiv="content-language" content="en"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Example</title> </head> <body> <h1>Example</h1> <form method="post"> Text: <input type="text" name="quote" size="40" value=""> <input type="submit" name="btnSum" value="Submit"> </form> <br> <hr> <br> <?=$txt?> </body> </html>
  7. Try this INSERT IGNORE INTO monthly_fee SELECT DISTINCT lead_id, cname.value as cname, chno.value as chno, mode.value as mode, email.value as email, mobile.value as mobile, amount.value as amount, omode.value as omode, tid.value as tid, date.value as date, comments.value as comments wp_vxcf_leads.created -- added FROM wp_vxcf_leads_detail JOIN wp_vxcf_leads ON wp_vxcf_leads_detail.lead_id = wp_vxcf_leads.id -- added LEFT JOIN(SELECT lead_id, value FROM wp_vxcf_leads_detail WHERE name='cname') cname USING (lead_id) LEFT JOIN(SELECT lead_id, value FROM wp_vxcf_leads_detail WHERE name = 'chno') chno USING (lead_id) LEFT JOIN(SELECT lead_id, value FROM wp_vxcf_leads_detail WHERE name='mode') mode USING(lead_id) LEFT JOIN(SELECT lead_id, value FROM wp_vxcf_leads_detail WHERE name='email') email USING (lead_id) LEFT JOIN(SELECT lead_id, value FROM wp_vxcf_leads_detail WHERE name='mobile') mobile USING(lead_id) LEFT JOIN(SELECT lead_id, value FROM wp_vxcf_leads_detail WHERE name='amount') amount USING(lead_id) LEFT JOIN(SELECT lead_id, value FROM wp_vxcf_leads_detail WHERE name='omode') omode USING(lead_id) LEFT JOIN(SELECT lead_id, value FROM wp_vxcf_leads_detail WHERE name='tid') tid USING(lead_id) LEFT JOIN(SELECT lead_id, value FROM wp_vxcf_leads_detail WHERE name='date') date USING(lead_id) LEFT JOIN(SELECT lead_id, value FROM wp_vxcf_leads_detail WHERE name='comments') comments USING(lead_id)
  8. So it looks like the "lead_id" in the target table will be unique (and could be the primary key). As you have an auto primary key, set a UNIQUE constraint on lead_id in the target table. Change the "CREATE TABLE monthly_fee" to ... INSERT IGNORE INTO monthly_fee () SELECT .....(as now) See how that goes. I can't test as I have no data (too time consuming typing it all out again from your pictures) so you'll have to test for me.
  9. How does wp_vxcf_leads relate to the source table?
  10. So if someone has worked there for 10 years you want to list all 10 years' worth of their attendances and absences? You want all employees; that is not the same as all records.
  11. He already has
  12. Then you have some more reading to do if that's what you think.
  13. Timestamp the source data records. Then you know when they were added. If it was after the last time you extracted data then they're new ones.
  14. Have you tried the "F" option?
  15. I thought you needed start and end dates? For example ... <a href="my_pdf_report.php?sdate=2020-03-01&edate=2020-03-05">Create PDF</a>
  16. With which bit do you need help ?
  17. If you are putting the reports for everyone in a single file you don't need to pass an id. You are going to process all of them.
  18. Sounds like you want to view the totals one by one yet have all the data in one PDF file. Yet another reason to put the PDF code in a separate file.
  19. You change your query. Remove "WHERE oracleie = ?" Add "ORDER BY oracleid" Create new page after each id's totals
  20. Try outputting the pdf to a file instead of the screen.
  21. Because ->Output() will be sending header data tell the browser to expect PDF output. You cannot send headers after output has been sent. This is why, on March 27, I told you
  22. Your randomNr array contains 10 elements so foreach($randomNr as $number) will give 10 columns. You need to pick a random 6 numbers out of the 10. Separate the php code from the html. Use CSS for styling the output. Example <?php $randomNr = range(0,9); $bingokaart = display($randomNr); function display ($arr) { $result = ""; for ($row = 1; $row < 7; ++$row) { $rand6 = array_rand($arr, 6); $result .= '<tr>'; foreach ($rand6 as $n) { $result .= "<td>$row$arr[$n]</td>"; } $result .= "</tr>\n"; } return $result; } ?> <!DOCTYPE html> <html> <head> <title>Sample</title> <style type="text/css"> table { border-collapse: collapse; } td { padding: 2px; } </style> </head> <body> <table border='1'> <?= $bingokaart ?> </table> </body> </html>
  23. Try ending the previous line with a ";"
  24. That query should return a single record containing a count of all the records found What does "not working" mean? Were you expecting more records?
×
×
  • 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.