Answer by andrewsi for Foreach PHP PDO query
I think this should do what you're asking - you're generating $color as a variable in the foreach, but you were accessing it as an array. $colors = explode(' ', $_GET['color']); foreach ($colors as...
View ArticleAnswer by andrewsi for Odd and confusing PHP syntax
It's using the operator precedence rules of PHP in an unusual way. If you have an and statement, PHP will stop processing it if the left side is false - there's no need to check the right hand side,...
View ArticleComment by andrewsi on How to increment a datetime by one day?
if you set d to 8/31/18 then this returns 8/32/18. If you change the year from 18, it just breaks.
View ArticleAnswer by andrewsi for SELECT id FROM table_name WHERE column = $variable
SELECT id FROM order WHERE orderNumber = '$orderNumber'ORDER is a reserver word in SQL; I'd recommend you change the name of the table to something else.If you really can't, then you can escape column...
View ArticleComment by andrewsi on How to set form input data to equal specific strings...
You're using the wrong operator. = is to set a value; try if ($_POST['fName'] == "Megan") to do a comparison, instead.
View ArticleComment by andrewsi on Not returning data from multiple tables (php/sql)
You're running fetch twice, once in each loop. if there's data to be found, then the first fetch will find it, so there's nothing left for the second to do. Try putting the final three echoes inside...
View ArticleComment by andrewsi on Moving through Detail Pages of Recordset
You're not saving the query per se; you're saving the WHERE clause. When the user clicks to pull up an individual record, say id=3, you need to re-run that search query again, and go through the...
View ArticleTransformer stage, with dynamic number of columns
I have an unstructured data file, that's being extracted from a database, and de-normalized along the way. As a very quick example:File References,Reference_Count,Reference_1,Reference_2...
View ArticleTransformer stage and dynamic files structure
I'm reading a datafile that's being generated from a data source that's denormalizing data into a flat file. As an...
View ArticleAnswer by andrewsi for MySql Bulk(ish) Insert
When you use INSERT INTO `order_status_histories` VALUES (....)you need to pass each value that the table structure requires, in the correct order. You can omit fields from the values if they have a...
View ArticleAnswer by andrewsi for Error when tried to allocate bytes
The issue is with these lines:$result = $sth->fetchAll(PDO::FETCH_ASSOC);while ($row = $result) { $data[] = $row;}You're assigning $result, and then using that value in your while loop. What is...
View Article