-
Posts
24,573 -
Joined
-
Last visited
-
Days Won
824
Everything posted by Barand
-
https://lmgtfy.com/?q=html+meta+refresh
-
A meta-refresh will do what you want <?php echo "Your pizza is ready<br>"; echo "<meta http-equiv=\"refresh\" content=\"5; url='url-to-go-to'\" />" ?>
-
Don't hijack other people's topics Try Google
-
pass date variable to SQL Server pivot query correctly
Barand replied to kat35601's topic in Microsoft SQL - MSSQL
One problem you have is that you cannot correctly compare date values in m/d/Y format. To compare reliably they need to be Y-m-d. 08/01/2020 > 02/01/2021 whereas 2021-01-02 > 2020-01-08 - correct -
Cannot call Session Variable to regular variable for SQL lookup
Barand replied to bakertaylor28's topic in PHP Coding Help
RTFM https://www.php.net/manual/en/language.operators.assignment.php https://www.php.net/manual/en/language.operators.comparison.php- 12 replies
-
Why have you got three tables with the same apparent structure instead of a single table with an extra column to indicate paye/contract/permanent?
-
If it did it was only by luck. The information returned for each id could come from any of the records with that id, not necessarily the one with the max value.
-
You need to match aginst the subquery on id and time. Table subqueries require an alias (as virtual table name) try SELECT pda.* FROM production_data_archive pda INNER JOIN ( SELECT order_id MAX(insert_time) as insert_time FROM production_status_archive GROUP BY order_id ) pda2 USING (order_id, inser_time)
-
You have this situation if (....) { // define row row = something } echo row; // here you attempt to use row whether it was defined or not
-
Also, your data table design is wrong. Don't store data (particularly IDs) in comma separated lists.
-
Yes, you are - the answer was given to you ... The answer to the above question, BTW, is NO.
-
1) do not double post. 2) we don't like being shouted at.
-
https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required
-
Adding a "required" attribute to your input fields will do it for you on the client side.. Don't forget you still need to check within PHP when you process the posted data.
-
Your form needs name="formpay" for document.formpay to work. It also doesn't like a varaiab;e called "sum" and a function called "Sum". Try <script type="text/javascript"> function calcSum () { var Pay = document.formpay.Pay.value; var Charge = document.formpay.Charge.value; var sum = (Charge - (Pay * 1.295)); document.getElementById('Total').value = sum; } </script> <form name="formpay" action="" method="post"> <br> <br> <table> <tr> <td><input type="text" id="Pay" value="" name="Pay" placeholder="Pay"></td> </tr> <tr> <td><input type="text" id="Charge" value="" name="Charge" placeholder="Charge"></td> </tr> <tr> <td><input type="text" id="Total" value="" name="Total" placeholder="Total"></td> </tr> </table> <input type="button" name="button" Value="Calculate" onClick="calcSum()"> </form>
-
Does it help if you force it to use numeric values? function Sum () { var Pay = parseFloat(document.formpay.Pay.value); var Charge = parseFloat(document.formpay.Charge.value); var sum = (Charge - (Pay * 1.295)); document.GetElementByid('Total').value = Sum; }
-
if you "echo $oak" you should see that it has a value of "Cut a tree", which has a numeric value of zero. Therefore, setting the value of your column called "oak" to $oak+1 will always result in 1. What does this "users" table of yours look like?
-
There is nothing in your form that has the name "alltree" so $_POST['alltree'] will not exist. (Turn php error reporting on. It would have told you that) The line "$oak = $_POST['oak']" is a waste of space. the column identifiers (puud, sire1) should not have the $s. mysqli_query() requires 2 parameters (see manual link provided)
-
Use JOINs with a single query to get the information you want instead of running multiple queries If you are only retrieving a single record, don't use a while loop - a single fetch will suffice Use prepared statements - don't put variables directly into the SQL string <?php /* MK_users MK_role_access MK_baccounts +-----+---------------+ +----------+----------+ +-----+------------------------+ | uid | fullname | | role_uid | role_bid | | bid | businessname | +-----+---------------+ +----------+----------+ +-----+------------------------+ | 1 | Laura Norder | | 1 | 10 | | 10 | Amazon | | 2 | Peter Dowt | | 2 | 20 | | 20 | Apple | | 3 | Tom Di Canari | | 3 | 30 | | 30 | Paula's Poodle Parlour | +-----+---------------+ +----------+----------+ +-----+------------------------+ */ $_SESSION['id'] = 2; // provide a value $res = $conn->prepare("SELECT ba.bid , ba.businessname FROM MK_role_access ra JOIN MK_baccounts ba ON ra.role_bid = ba.bid WHERE ra.role_uid = ? "); $res->bind_param('i', $_SESSION['id']); $res->execute(); $res->bind_result($bid, $business); $res->fetch(); echo "$bid - $business <br>"; //==> 20 - Apple ?>
-
Find a better way to store the ids than a comma-separated list.
-
Just put a link in the head section of the HTML <!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="path/to/my.css"> </head>
-
As the string is JSON, use json_decode(); EG $str = '{ "success": true, "delivered": true, "contactDetailsRequired": false, "message": "Signed For by: D ANDERSON ", "signature": "https://webservices.thedx.co.uk/PodImage/ImageHandler.ashx?tn=906732192165", "date": "21-07-2020", "serviceLevelName": "Consigned", "time": "13:33:19", "trackedProductName": "DataExchange" }'; $data = json_decode($str); echo $data->message . '<br>'; //--> Signed For by: D ANDERSON echo $data->date . '<br>'; //--> 21-07-2020
-
Easiest way is a DATETIME type column in your table. Give it a value NOW() when updating. This can also be automated by specifying the column default value of CURRENT_TIMESTAMP when updated.
-
Evidently can't create a view with a subquery in MySQL 5.6...
Barand replied to Jim R's topic in MySQL Help
If you had used a data model like the one I suggested to you in May 2019 ... ... the coached_from and coached_until dates would give you who the coach was/is at any point in time. -
Need Help with showing all postcodes from a DB into Google Maps
Barand replied to snowymasta's topic in PHP Coding Help
It isn't calling the addPostCode() function, it is just echoing its name ??? echo 'addPostCode("'.$mig_postcode.'")';