SQLSTATE[42S22]: Column not found: 1054 Unknown column PhP PDO MariaDB10 - php

I found myself in a really weird situation in PDO. A query doesn't want to execute when called from PhP but it does when called from HeidiSQL.
The error is in title.
SQL query from statement debugDumpParams :
SELECT s_id AS id,
s_title AS title,
genre.g_name AS genreName,
accounts.ac_public_name AS producerName,
s_price AS price,
DATE_FORMAT(s_last_modified_date, '%d/%m/%Y %H:%i:%s') AS lastModifiedDate,
DATE_FORMAT(s_added_date, '%d/%m/%Y %H:%i:%s') AS addedDate,
s_downloads AS downloads,
s_sales AS sales,
s_rating AS rating,
s_status AS STATUS
FROM song
JOIN accounts ON accounts.ac_id = song.s_producer
JOIN genre ON genre.g_id = song.s_genre
WHERE 1=1 AND genre.g_id = '1'
ORDER BY s_status ASC, s_added_date DESC
LIMIT 0, 5;
Next is the part where I add genre.g_id = :id in the query string
if(isset($filterData["genreId"]) && $filterData["genreId"] !== ""){
$queryString .= " AND genre.g_id = :genreId";
}
And where I bind it
if(isset($filterData["genreId"]) && $filterData["genreId"] !== ""){
$genreParam = $filterData["genreId"];
$stmt->bindParam('genreId', $genreParam);
}
In both cases $filterData["genreId"] is set and it have a value, so no problems with the if. And if $filterData["genreId"] would be empy or not set there would be no problem with the query.
And the error : SQLSTATE[42S22]: Column not found: 1054 Unknown column \'genre.g_id\' in \'where clause\'
But wait, there is more.
If I put genre.g_id2 instead of genre.g_id it will look like this:
if(isset($filterData["genreId"]) && $filterData["genreId"] !== ""){
$queryString .= " AND genre.g_id2 = :genreId";
}
Now it won't even reach $stmt->debugDumpParams();
And all it gives out it's this error: SQLSTATE[42S22]: Column not found: 1054 Unknown column \'genre.g_id2\' in \'where clause\ , no query like before.
The column 100% exists in the table. Similar problem whith this query:
SELECT s_id AS id,
s_title AS title,
genre.g_name AS genreName,
accounts.ac_public_name AS producerName,
s_price AS price,
DATE_FORMAT(s_last_modified_date, '%d/%m/%Y %H:%i:%s') AS lastModifiedDate,
DATE_FORMAT(s_added_date, '%d/%m/%Y %H:%i:%s') AS addedDate,
s_downloads AS downloads,
s_sales AS sales,
s_rating AS rating,
s_status AS STATUS
FROM song
JOIN accounts ON accounts.ac_id = song.s_producer
JOIN genre ON genre.g_id = song.s_genre
WHERE 1=1 AND accounts.ac_id = '999999'
ORDER BY s_status ASC, s_added_date DESC
LIMIT 0, 5;
It seems the problem is only with columns that are from the tables that table song JOIN with.
Next query works perfectly.
SELECT s_id AS id,
s_title AS title,
genre.g_name AS genreName,
accounts.ac_public_name AS producerName,
s_price AS price,
DATE_FORMAT(s_last_modified_date, '%d/%m/%Y %H:%i:%s') AS lastModifiedDate,
DATE_FORMAT(s_added_date, '%d/%m/%Y %H:%i:%s') AS addedDate,
s_downloads AS downloads,
s_sales AS sales,
s_rating AS rating,
s_status AS STATUS
FROM song
JOIN accounts ON accounts.ac_id = song.s_producer
JOIN genre ON genre.g_id = song.s_genre
WHERE 1=1 AND s_status = '0'
ORDER BY s_status ASC, s_added_date DESC
LIMIT 0, 5;
2 days on this and no solutons. Most solutions I find are to check again if the column really exists :|
Does any one have a better solution for this specific problem ?
The goal is to select the data where the g_id is equal with the value I pass to it.
How I create the query string:
$queryString = "SELECT s_id as id,
s_title as title,
genre.g_name as genreName,
accounts.ac_public_name as producerName,
s_price as price,
DATE_FORMAT(s_last_modified_date, '%d/%m/%Y %H:%i:%s') as lastModifiedDate,
DATE_FORMAT(s_added_date, '%d/%m/%Y %H:%i:%s') as addedDate,
s_downloads as downloads,
s_sales as sales,
s_rating as rating,
s_status as status
FROM song
JOIN accounts on accounts.ac_id = song.s_producer
JOIN genre on genre.g_id = song.s_genre
WHERE 1=1 ";
then in a function I add this
if(isset($filterData["genreId"]) && $filterData["genreId"] !== ""){
$queryString .= " AND genre.g_id = :genreId";
}
then I do this
$queryString .= " ORDER BY s_status asc, s_added_date desc";
$queryString .= " LIMIT :offset, :limit;";
and finally
$stmt = $dbConnector->getConnection()->prepare($queryString);
This is the part that is related to the problem. I can't post the entire function, it's really long.
This is used to search data based on some inputs or combinations of inputs. The entire DAO class is really big :)
OS: Windows 10,
PhP version: 7.2.19,
Apache version: 2.4.35,
MariaDB version: 10.4
Heidi SQL: 10.2.0.5599
One more edit:
If I add the columun in the queryString when I first declare it:
$queryString = "SELECT s_id as id,
s_title as title,
genre.g_name as genreName,
accounts.ac_public_name as producerName,
s_price as price,
DATE_FORMAT(s_last_modified_date, '%d/%m/%Y %H:%i:%s') as lastModifiedDate,
DATE_FORMAT(s_added_date, '%d/%m/%Y %H:%i:%s') as addedDate,
s_downloads as downloads,
s_sales as sales,
s_rating as rating,
s_status as status
FROM song
JOIN accounts on accounts.ac_id = song.s_producer
JOIN genre on genre.g_id = song.s_genre
WHERE 1=1 AND genre.g_id = :genreId";
$queryString = $this->filterDataQuery($queryString, $filterData, "songs");
$queryString .= " ORDER BY s_status asc, s_added_date desc";
$queryString .= " LIMIT :offset, :limit;";
$stmt = $dbConnector->getConnection()->prepare($queryString);
$genreParam = $filterData["genreId"];
$stmt->bindParam(':genreId', $genreParam);
and not inside $this->filterDataQuery($queryString, $filterData, "songs"); when I build the queryString based on selected filters it works perfectly.
This is the select from the browser console now:
SELECT s_id AS id,
s_title AS title,
genre.g_name AS genreName,
accounts.ac_public_name AS producerName,
s_price AS price, DATE_FORMAT(s_last_modified_date, '%d/%m/%Y %H:%i:%s') AS lastModifiedDate, DATE_FORMAT(s_added_date, '%d/%m/%Y %H:%i:%s') AS addedDate,
s_downloads AS downloads,
s_sales AS sales,
s_rating AS rating,
s_status AS STATUS
FROM song
JOIN accounts ON accounts.ac_id = song.s_producer
JOIN genre ON genre.g_id = song.s_genre
WHERE 1=1 AND genre.g_id = '1'
ORDER BY s_status ASC, s_added_date DESC
LIMIT 0, 5;
Isn't this one the same with the first? For it is. I am blind ?

After rereading your first post dozens of times and testing locally all sorts of normal things without getting the same error, I think the $stmt variable inside filterDataQuery() holds a total different query than posted here. And it just doesn't include the table genre as shown in the error message.
If you're not using that function, seeing your second last code block, all works well (if I understand you correctly).
Also according to the code shown, I don't understand how you would call filterDataQuery() to add criteria to the querystring, and directly binding the params to the statement object that's prepared later on and thus is not available there (or not the one you would expect).
To prove my theory my complete test code, still using this db-fiddle:
ini_set('display_errors', 1);
error_reporting(E_ALL);
$DB_USER = '*****';
$DB_PASS = '*****';
$db = new PDO('mysql:host=localhost;dbname=testing.project', $DB_USER, $DB_PASS);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$select = 'SELECT s_id AS id,
s_title AS title,
genre.g_name AS genreName,
accounts.ac_public_name AS producerName,
s_price AS price,
DATE_FORMAT(s_last_modified_date, "%d/%m/%Y %H:%i:%s") AS lastModifiedDate,
DATE_FORMAT(s_added_date, "%d/%m/%Y %H:%i:%s") AS addedDate,
s_downloads AS downloads,
s_sales AS sales,
s_rating AS rating,
s_status AS STATUS
FROM song
JOIN accounts ON accounts.ac_id = song.s_producer
JOIN genre ON genre.g_id = song.s_genre';
$where = ' WHERE genre.g_id = :genreId';
$order = ' ORDER BY s_status ASC, s_added_date DESC';
$limit = ' LIMIT 0, 5';
// No problemo:
$sql = $select . $where . $order . $limit;
$stmt = $db->prepare($sql);
$genreId = 1;
$stmt->bindParam(':genreId', $genreId);
$stmt->execute();
// Trigger error column not found, $stmt containing an unexpected query:
$select = 'SELECT * FROM `song`';
$sql = $select . $where . $order . $limit;
$stmt = $db->prepare($sql);
$genreId = 1;
$stmt->bindParam(':genreId', $genreId);
$stmt->execute();

First, I don't pass the $stmt variable to filterDataQuery. I pass it to bindParams. bindParams function is called aftert filterDataQuery is done and after adding the strings for order by and limit.
I really have to thank you,Piemol , for trying to help me.
I checked Maria DB logs after a professor from my college adviced me to do so, and I found the problem there
In the same controller I was calling two DAO methods, one after another, one to bring the data, and the sencond to do a count.
$responseMessage = json_encode(AdminDAO::getInstance()->getFilteredSongsList($message));
$count = AdminDAO::getInstance()->getFilteredSongsListItemsCount($message); // this one was the problem
The problem was not in the one that was getting the data, the one I posted about. The problem was with the one doing the count. I did not added the joins there :| .
Alose there where no indication from what method the error was comming so I focused on the wrong one(the one that was displayed in log). Something like this would have never happened if I would have used a logger like I do in Java.
Here are the queries from MariaDB log file: https://www.heypasteit.com/clip/0IUPWG
First one is the one that fails and the 2nd one is the one that works.
I miss log4j from Java so much.
Thanks to everybody who tried to help me.
For those who have this kind of weird problems, check logs, put echos, don't focus on the first thing you see in a AJAX response log.

Related

MySQL: How to SELECT only three of each differing x-column-name

I want to display my blogs in a very future proof way. So I need to make a query that will reference new blog types if they are created. Hence the x-column-name. In this case that's blogType. This select query should contain the blog information for all blog types, but for each blog type get 3 Blogs. It's kind of confusing so this is why I am reiterating!
I have done a bit of work already in googling how to limit the results. Shown below:
$query = 'SELECT * FROM blogs
ORDER BY dateWritten
ASC LIMIT 3';
I'll be outputting the results to blog_rss.php using an array and a foreach loop. I get the array from a function like this:
function get_Recent_Blogs() {
global $db;
$query = 'SELECT * FROM blogs
ORDER BY dateWritten
ASC LIMIT 3';
try {
$statement = $db->prepare($query);
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
$statement->closeCursor();
return $result;
} catch (PDOException $e) {
$error_message = $e->getMessage();
display_db_error($error_message);
}
}
It's not too important but at least it gives you some context.
SELECT *
FROM (
SELECT b.*, ROW_NUMBER() OVER (PARTITION BY b.blogType ORDER BY b.blogID DESC) as rn
FROM blogs b
) x
WHERE x.rn <= 3
ORDER BY x.blogType, x.blogID DESC';
So I've done my best to implement the solution but I'm getting some errors. I'm not sure if I should start a new post for this one or not but the code above is what I used and this is the error I'm getting:
You have an error in your SQL syntax; it seems the error is around: '( PARTITION BY b.blogType ORDER BY b.dateWritten DESC ' at line 7
Since your MySQL version supports window functions, you can use ROW_NUMBER(), which will enumerate your entries per blog type. Then you just need to pick the first three rows per type.
SELECT *
FROM (
SELECT b.*, ROW_NUMBER() OVER (PARTITION BY b.type ORDER BY b.dateWritten DESC) as rn
FROM blogs b
) x
WHERE x.rn <= 3
ORDER BY x.type, x.dateWritten DESC -- adjust as needed
Notes:
I assume that the blog type is determined by the type column. Adjust it if needed.
You should use DESC instead of ASC, since you want to get the most recent entries.
I would rather use an AUTO_INCEMENT id column instead of dateWritten for sorting. That is more reliable, since a DATE or even a TIMESTAMP can have duplicates.
For older versions which don't support window functions I would first fetch all types and generate a UNION ALL query. With PDO it could be something like the following:
$types = $db
->query('SELECT DISTINCT type from blogs ORDER BY type')
->fetchAll(PDO::FETCH_COLUMN);
$subqueries = array_map(function($type){
return '(SELECT * FROM blogs WHERE type = ? ORDER by dateWritten DESC LIMIT 3)';
}, $types);
$query = implode(' UNION ALL ', $subqueries) . ' ORDER BY type, dateWritten DESC';
$statement = $db->prepare($query);
$statement->execute($types);
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
This will generate the following query:
(SELECT * FROM blogs WHERE type = ? ORDER by dateWritten DESC LIMIT 3)
UNION ALL
...
UNION ALL
(SELECT * FROM blogs WHERE type = ? ORDER by dateWritten DESC LIMIT 3)
ORDER BY type, dateWritten DESC
Note 1: Even though two queries are executed, given a composite index on (type, dateWritten) this can still be faster than other solutions. When you have a couple of blog types and many articles per type, this can even be faster than the ROW_NUMBER() solution.
Note 2: I would usually have a separate table for types, and the blogs table would reference the primary key type_id column. In that case the first query would be SELECT type_id from blog_types, and the subqueries would have the condition WHERE type_id = ?.

Put a PHP variable in a SQL Query

I have the following code:
try
{
$sql = 'SELECT id, type, date, amount, description, category
FROM `transactions`
WHERE type = "income"
AND month(date) = '$monthselect'
ORDER BY `transactions`.`id` DESC
LIMIT 0,50';
$result2 = $pdo->query($sql);
}
Now, I want to give this month(Date) a variable which month I want to select. if I put 1, it will give me January. So i thought, if I define a variable with 1, I can use it to select a month, right?
$monthselect = 1;
It doesnt work. What am I doing wrong?
Use prepared statements:
$stm = $pdo->prepare('SELECT id, type, date, amount, description, category
FROM `transactions`
WHERE type = "income"
AND month(date) = ?
ORDER BY `transactions`.`id` DESC
LIMIT 0,50');
$stm->execute(compact('monthselect'));
$result2 = $stm->fetchAll();
Since you're not adding "1" directly in your query, I'm assuming here that the variable comes from user input.
To concatenate strings in PHP you need to use the . operator.
$sql = 'SELECT id, type, date, amount, description, category
FROM `transactions`
WHERE type = "income"
AND month(date) = ' . $monthselect . '
ORDER BY `transactions`.`id` DESC
LIMIT 0,50';
I'll frequently use double quotes to substitute variables in PHP:
$sql = "SELECT id, type, date, amount, description, category
FROM `transactions`
WHERE type = 'income'
AND month(date) = $monthselect
ORDER BY `transactions`.`id` DESC
LIMIT 0,50";
Note that you need to swap the existing double quotes (inside the string) to single quotes. You can escape them too, but I find this way makes it much more readable.
Your issue is that you are trying to use a variable inside single quotes, inside which php is not translated
I find by using double quote marks around my queries it allows me to not only use variables in them but to also be able to use single quote mark around the values passed to the db
$sql = "SELECT id, type, date, amount, description, category
FROM `transactions`
WHERE type = 'income'
AND month(date) = $monthselect
ORDER BY `transactions`.`id` DESC
LIMIT 0,50";

$_GET for MySQL query causing Unknown column error

I have a series of links that pass information to a new page to run a MySQL query. This is one of the links from source code:
<a class="bloglink" href="parknews.php?tpf_news.park_id=5">
and this is the code that generates the links:
<a class="bloglink" href="parknews.php?tpf_news.park_id=<?php echo $row2['park_id'];?>">
<?php echo $row2['name']; ?>
</a>
The query that uses that info is here:
$park_id = $_GET['tpf_news.park_id'];
$sql = 'SELECT headline, story, DATE_FORMAT(date, "%d-%M-%Y") AS date, name
FROM tpf_news
INNER JOIN tpf_parks ON tpf_news.park_id = tpf_parks.park_id WHERE tpf_news.park_id = $park_id ORDER BY date DESC' ;
This causes this error to display:
Error fetching news: SQLSTATE[42S22]: Column not found: 1054 Unknown column '$park_id' in 'where clause'
I can't work out why it is not working. If in the query I replace WHERE tpf_news.park_id = $park_id with WHERE tpf_news.park_id = 6 (or any other number), it works fine.
Any ideas?
When your strings are in quotes your variables aren't interpolated. So you need to use double quotes instead:
$sql = "SELECT headline, story, DATE_FORMAT(date, '%d-%M-%Y') AS date, name
FROM tpf_news
INNER JOIN tpf_parks ON tpf_news.park_id = tpf_parks.park_id WHERE tpf_news.park_id = $park_id ORDER BY date DESC" ;
Or use concatenation:
$sql = 'SELECT headline, story, DATE_FORMAT(date, "%d-%M-%Y") AS date, name
FROM tpf_news
INNER JOIN tpf_parks ON tpf_news.park_id = tpf_parks.park_id WHERE tpf_news.park_id =' . $park_id .' ORDER BY date DESC' ;
FYI, you also wide open to SQL injections
You have your SQL in single quotes. That means the variable will not be displayed as you think. Use double quotes.
And for the love of GOD us prepared statements.
$sql = "SELECT headline, story, DATE_FORMAT(date, "%d-%M-%Y") AS date, name
FROM tpf_news
INNER JOIN tpf_parks ON tpf_news.park_id = tpf_parks.park_id WHERE tpf_news.park_id=$park_id ORDER BY date DESC" ;
$sql = 'SELECT headline, story, DATE_FORMAT(date, "%d-%M-%Y") AS date, name
FROM tpf_news
INNER JOIN tpf_parks ON tpf_news.park_id = tpf_parks.park_id WHERE tpf_news.park_id='.$park_id.' ORDER BY date DESC' ;

Mysql Query Selecting Results With A Distinct Column Value

I have a table that displays books. However I would like only only 1 book to be shown per unique email address (strContactEmail). I tried the below query, it didn't work. Any help greatly appreciated.`
$sql = "SELECT lngbookid, strTitle, strAuthor, strcoursecode, strISBN, ".
" strcontactname, DISTINCT(strContactEmail) AS strContactEmail, ".
" curPrice, ysnsalerent, dtmpostdate, memcomments, school, ".
" ASIN, BookIMG, ISBN10, ISBN13, Updated, ".
" datetime, user_ip, NoOtherBooks ".
" FROM tblbooks ".
" WHERE strcoursecode LIKE '%$search%' ".
" ORDER BY datetime DESC LIMIT 50";
Try a GROUP BY statement:
http://www.w3schools.com/sql/sql_groupby.asp
The easiest way:
SELECT max(lngbookid) as lngbookid,
max(strtitle) as strtitle,
max(strauthor) as strauthor,
max(strcoursecode) as strcoursecode,
max(strisbn) as strisbn,
max(strcontactname) as strcontactname,
strcontactemail,
max(curprice) as curprice,
max(ysnsalerent) as ysnsalerent,
max(dtmpostdate) as dtmpostdate,
max(memcomments) as memcomments,
max(school) as school,
max(asin) as asin,
max(bookimg) as bookimg,
max(isbn10) as isbn10,
max(isbn13) as isbn13,
max(updated) as updated,
max(datetime) as datetime,
max(user_ip) as user_ip,
max(nootherbooks) as nootherbooks
FROM tblbooks
WHERE strcoursecode LIKE '%$search%'
GROUP BY strcontactemail
ORDER BY datetime DESC
LIMIT 50
EDIT
Well, the above was actually too "dummy". Better way to do this is (providing that column "lngbookid" is a primary key):
SELECT a.lngbookid,
a.strtitle,
a.strauthor,
a.strcoursecode,
a.strisbn,
a.strcontactname,
a.strcontactemail,
a.ontactemail,
a.curprice,
a.ysnsalerent,
a.dtmpostdate,
a.memcomments,
a.school,
a.asin,
a.bookimg,
a.isbn10,
a.isbn13,
a.updated,
a.datetime,
a.user_ip,
a.nootherbooks
FROM tblbooks AS a
JOIN (SELECT strcontactemail,
Max(lngbookid) AS lngbookid
FROM tblbooks
GROUP BY strcontactemail) AS b
ON ( a.strcontactemail = b.strcontactemail
AND a.lngbookid = b.lngbookid )

Change sprintf into simple UNION

$STH_1 = $DBH_R->query("SELECT table_name
FROM information_schema.tables
WHERE table_name
LIKE 'v_c_ei\_9%'
");
$stmts_1 = array();
while (($row_1 = $STH_1 -> fetch_assoc()) !== null){
$table_name = $row_1['table_name'];
$stmts_1[] = sprintf("SELECT *
FROM $table_name
WHERE (ei_code = '1117') AND (DAY(date_time) != '00')
");
}
$stmt_1 = implode("\nUNION\n", $stmts_1);
$stmt_1 .= "\nORDER BY date_time ASC";
$STH_5_2 = $DBH_R->query($stmt_1);
while (($row_5_2 = $STH_5_2 -> fetch_assoc()) !== null){
OK, the script above is working ok. But, I want (must) change its functionality. I must do selection before UNION (something like ORDER BY ... LIMIT) but I know - this is not working. The solution is to change sprintif into UNION & UNION & UNION ... But the problem is - we don't know how much tables we have.
The table names from the first query looks like
v_c_ei_9001
v_c_ei_9002
..........
v_c_ei_9030
..........
ect.
Than the q: how change the sprintif (and maybe array $stmts_1 too) from abowe into the UNION in situation when we don't know how much tables we have?
thnks
When you add ORDER BY and LIMIT clauses to each constituent of the UNION, as follows:
while (($row_1 = $STH_1 -> fetch_assoc()) !== null){
$table_name = $row_1['table_name'];
$stmts_1[] = sprintf("SELECT *
FROM $table_name
WHERE (ei_code = '1117') AND (DAY(date_time) != '00')
ORDER BY date_time DESC LIMIT 1
");
}
And then you do the following:
$stmt_1 = implode("\nUNION\n", $stmts_1);
$stmt_1 .= "\nORDER BY date_time ASC"; // <---- remember this bit
The resulting string in $stmt_1 will look something like this:
SELECT *
FROM v_c_ei_9001
WHERE (ei_code = '1117') AND (DAY(date_time) != '00')
ORDER BY date_time DESC LIMIT 1
UNION
...
UNION
SELECT *
FROM v_c_ei_9030
WHERE (ei_code = '1117') AND (DAY(date_time) != '00')
ORDER BY date_time DESC LIMIT 1
ORDER BY date_time ASC -- it's appearing down here!
As you can see, the final constituent of your UNION has two ORDER BY clauses, which is a syntax error. Either remove the line commented remember this bit above, or else (if you need to reorder the unified queries) you must make the UNION a subquery to an outer query that performs the reordering:
$stmt_1 = "SELECT * FROM ("
$stmt_1 = implode("\nUNION\n", $stmts_1);
$stmt_1 .= ") ORDER BY date_time ASC";
As I see, the simple way to show itself is write whatever, instead consider the solution of the problem. The situation is similar to evaluating questions - if the complexity of the problem is beyond the involvement of the viewer it is easier to evaluate them negatively than actually help the man who asks. And not just speak, instead of writing anything.
For all those who may face such a problem I give operating solution.
The simplest overall solution was to specify the tables on which the main query is executed. What was to be obtained in the main query by ORDER BY was obtained first auxiliary request on the first query by pre-rank the tables on the main query is executed.
In this way we avoid the problem 2x ORDER BY in the main query, because the ORDER BY clause is transferred to the first auxiliary request.
$STH_1 = $DBH_R->query("SELECT c.table_name
FROM v_c_country c
INNER JOIN information_schema.tables i ON i.table_name = c.table_name
ORDER BY c.country_name_pl ASC ");
while (($row_1 = $STH_1 -> fetch_assoc()) != null){
$table_name = $row_1['table_name'];
$stmts_1[] = sprintf("SELECT *,'$table_name' AS table_name, time(date_time) AS time_dt, date(date_time) AS date_dt, MAX(date_time) AS MAXdate
FROM $table_name
WHERE ei_code = '1117' AND (DAY(date_time) != '00')
AND date_time = (SELECT MAX(date_time) FROM $table_name WHERE ei_code = '1117' AND index_released = '1')
");
}
$stmt_1 = implode("\nUNION\n", $stmts_1);
$STH_5_2 = $DBH_R->query($stmt_1);
Often I meet here with the tolerant approach to the questions asked, you know that if someone asks a question that awaits us - looking for - ask for help in solving the problem. I really, really thank all those who reach out a helping hand and give really helpful answer. These people really do happen.

Categories