-
Posts
24,566 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
My code contains a loop to output the divs. Your code contains a loop. Work it out.
-
It's much easier with CSS and divs than it is with a table. <?php $output = ''; for ($i=1; $i<=28; $i++) { $output .= "<div class='db-entry'>Entry $i</div>\n"; } ?> <!DOCTYPE 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> <style type="text/css"> .db-entry { width: 18%; height: 50px; padding: 20px 2px; border: 1px solid gray; margin: 0 2px 2px 0; float: left; } </style> <body> <?=$output?> </body> </html>
-
-
Check my sample
-
I doubt it. That will link to ... <a href="mydloader.php?ip=" ... because you put quotes in the middle of the query string. Don't know why you've stuck demo_app at the end.
-
foreach ($_POST['purchases'] as $line) { fputcsv($file, [$line]); } ?
-
Sample HTML <!DOCTYPE> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Sample</title> </head> <body> <a href="mydloader.php?ip=xyz&filename=banner.png">banner.png</a><br> <a href="mydloader.php?ip=xyz&filename=punchcard.jpg">punchcard.jpg</a><br> <a href="mydloader.php?ip=xyz&filename=demo_app.html">demo_app.html</a><br> </body> </html> mydloader.php <?php include 'db_inc.php'; # YOUR CONNECTION $db = pdoConnect('test'); # GOES HERE if (isset($_GET['ip'])) { $add = $db->prepare("INSERT INTO download (IP_ADDRESS, FILENAME) VALUES (?, ?)"); $add->execute( [ $_GET['ip'], $_GET['filename'] ] ); header('Content-Type: octet-stream'); header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); header('Pragma: no-cache'); header('Expires: 0'); readfile("download/{$_GET['filename']}"); } ?> mysql> select * from download; +-------------+------------+---------------+ | download_id | ip_address | filename | +-------------+------------+---------------+ | 1 | xyz | banner.png | | 2 | xyz | punchcard.jpg | | 3 | xyz | demo_app.html | +-------------+------------+---------------+
-
try foreach ($_POST['purchases'] as $line) { fputcsv($file, $line); }
-
Because you should always work with yyyy-mm-dd format in your database (column type DATE) If you always want to insert the current date, use VALUES ('$oracleid','$name','$des',CURDATE(),'$username', '$pass','$isadmin') EDIT: and use prepared statements!
-
If he result of a query is boolean (ie false) then the query failed. Check for failures. Easiest way is to put this line before your mysqli connection line mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); You must like living on the edge. Embedded variables in the query AND multi query. That's not just opening the door to SQL injection, it's demolishing the whole wall.
-
Instead of linking directly to the target file, link to a php script which updates your db and sends the file for download.
-
https://lmgtfy.com/?q=html5+download+attribute
-
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; }
-
Add them to the array inside the loop.
-
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.
-
Remove the quotes from your table and column name identifiers.
-
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>
-
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)
-
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.
-
How does wp_vxcf_leads relate to the source table?
-
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.
-
He already has
-
Then you have some more reading to do if that's what you think.
-
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.
-
Have you tried the "F" option?