-
Posts
24,609 -
Joined
-
Last visited
-
Days Won
831
Everything posted by Barand
-
Do you still get that notice if you enter a valid id?
-
Instead of using hyphens, use array indices in your form input field names <input type="text" name="guestname[0]" > <input type="text" name="guestname[1]" >
-
how to use the values get in AJAX method in sql query?
Barand replied to sashavalentina's topic in PHP Coding Help
If you use an aggregation function (SUM, COUNT, AVG etc) without a GROUP BY clause you get a single aggregation (row) for the whole table. Don't use "SELECT * ", especially with aggregations. Don't run queries inside loops. Get the data you need with a single query Don't litter the forum with multiple threads on the same topic. From your earlier post it looked like you want the average daily total for each month SELECT YEAR(day) as yr , MONTH(day) as mth , AVG(price) as avprice FROM ( SELECT DATE(order_datetime) as day , SUM(purchase_price) as price FROM ordered_items WHERE YEAR(order_datetime) = YEAR(CURDATE()) AND order_status = 5 GROUP BY day ) daily GROUP BY yr, mth; -
See https://www.php.net/manual/en/language.variables.external.php
-
You don't say what the problem is, but WHERE username = !null - WRONG WHERE username IS NOT NULL - CORRECT;
-
Different error messages in connection mysqli script.
Barand replied to LeonLatex's topic in PHP Coding Help
Aside from that, mysql will only report that the combination of username, password and domain was invalid, not which portions. -
Different error messages in connection mysqli script.
Barand replied to LeonLatex's topic in PHP Coding Help
How to help your local neighbourhood hacker - let them know whether it was the username or the password that they got wrong. At least then they know they are half-way there. -
The key names there - you just have to use it. $myArray = array(); $myArray[0]['Name'] = 'fred'; $myArray[0]['Age'] = 55; $myArray[1]['Name'] = 'Joe'; $myArray[1]['Age']= 765; echo '<pre>', print_r($myArray, 1), '</pre>'; foreach ($myArray as $key => $value): echo "<br><b>Person $key:</b><br>"; foreach ($value as $k => $v) { echo " • $k : $v<br>"; } endforeach; Outputs Array ( [0] => Array ( [Name] => fred [Age] => 55 ) [1] => Array ( [Name] => Joe [Age] => 765 ) ) Person 0: • Name : fred • Age : 55 Person 1: • Name : Joe • Age : 765
-
The usual method for processing an array is with "foreach" which gets you the key and value on each iteration foreach ($myArray[$i] as $key => $value) { if isInvalid($key, $value) { report($key); } }
-
You need to provide context details and a better explanation than that if you want any meaningful replies.
-
F***ed Up Beyond All Recognition. I think it's an army acronym, like SNAFU(Situation Normal, All F***ed Up)
-
I still don't understand the process going on here but the feel of that table is wrong - it has a distinct unnormalized aroma about it, as though it should be 2 tables without triple keys..
-
What are these fields? `original_request_id` int(11) NOT NULL, `ref_request_id` int(11) DEFAULT NULL,
-
All that line does in your ajax script is send the name of the file. It is NOT uploading the file. https://www.php.net/manual/en/features.file-upload.php
-
Show us your table definition.
-
PHP isn't the only language ot there, and compiled code would be very difficult to spot.
-
Example <div> <img class='product-img' src='images/mac128.jpg' ></div> <div class='overlay'>Pre Order</br>NOW</div> CSS <style type='text/css'> .overlay { width: 60px; height: 60px; padding-top: 20px; border-radius: 50%; font-size: 8px; text-align: center; background-color: #E02222; color: #FFF; position: relative; top: -70px; left: 10px; z-index: 5; } </style> Result
-
Does $_FILES['photo']['error'] give any clues?
-
Generating XML from an html form and sending an attachment to e-mail
Barand replied to superzoom's topic in PHP Coding Help
You are creating an XML document in $doc, then right at the end, you decide to reference it as $xml instead of $doc.