I upgraded to Phoca Download on my J3.1.5, now I´m getting the problems when I wanted to download the file:
1054 - Unknown column 'c.tokenhits' in 'field list'
SELECT c.catid, c.filename, c.directlink, c.link_external, c.access, c.confirm_license, c.metakey, c.metadesc, cc.access as cataccess, cc.accessuserid as cataccessuserid, c.tokenhits FROM yav95_phocadownload AS c, yav95_phocadownload_categories AS cc WHERE c.id = 33 AND c.published = 1 AND c.approved = 1 AND c.catid = cc.id AND cc.access IN (1,1,5) AND ( c.publish_up = '0000-00-00 00:00:00' OR c.publish_up <= '2013-10-13 13:35:28' ) AND ( c.publish_down = '0000-00-00 00:00:00' OR c.publish_down >= '2013-10-13 13:35:28' ) ORDER BY c.ordering LIMIT 0, 1
since Phoca Download version 3.0.2, there are new table columns in database tables. When you upgrade from 3.0.1 to 3.0.2, Joomla! extension manager correctly reads the update instructions and update your database.
But when you upgrade from 3.0.1 to 3.0.3 or similar, it can happen, that the tables will be not upgraded. You will see e.g. the above mentioned error.
In such case, Phoca Download file table needs to be updated manually. Run your phpMyAdmin application and add the following SQL queries in your database.
See the guide which described it step by step:
http://www.phoca.cz/documents/16-joomla/759-how-to-solve-problems-which-occur-while-upgrading-joomla-extensions
Related
So, we use a script called "phpmydirectory", and at this point it's pretty outdated. It wasn't designed to work on PHP 7+ or MySQL 5.7+ but we're mostly making it work.
Part of the script, you can import new "listings (like articles on a blog)" from a .csv file. We recently updated our database server from Ubuntu 18.04 to 20.04 and MySQL also updated to 8 from 5.7 (we have some strict mode settings turned off for date_time format etc).
I am seeing this error when importing and I'm not sure why:
Fatal Error: Database (1064) SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'ROW, #previous_parent_id := parent_id, parent_id, id FROM pmd_lo' at line 1 in
file /usr/www/dd/phpmyd/includes/class_database.php on line 202 (SQL: UPDATE pmd_locations a, (SELECT IF(#previous_parent_id =
parent_id, #row := #row +1, #row :=1) AS ROW, #previous_parent_id := parent_id, parent_id, id FROM pmd_locations JOIN (SELECT #row :=0,
#previous_parent_id :=0) i ORDER BY parent_id, left_) aa SET a.child_row_id = aa.row WHERE a.parent_id = aa.parent_id AND a.id = aa.id) in
/usr/www/dd/phpmyd/includes/class_database.php on line 207
Here is the trace:
File: /usr/www/dd/phpmyd/includes/class_tree_gateway.php
Line: 111
Class: Database
Relevant PHP/MYSQL code:
https://www.paste.org/112726
File: /usr/www/dd/phpmyd/includes/class_imports.php
Line: 666
Class: Tree_Gateway
Relevant PHP/MYSQL code:
https://www.paste.org/112731
File: /usr/www/dd/phpmyd/cp/admin_ajax.php
Line: 616
Class: Imports
Relevant PHP/MYSQL code:
https://www.paste.org/112732
I'm really not sure here. Apologies.
Based on the keyword and reserved words information since version 8.0.2, ROW is now a reserved word:
So simply add quotes (or backticks) around that alias should help, such as: 'ROW'. There, and anywhere else the same may be needed.
I installed something called the "STHS Web Portal" (Here: http://www.simhl.net/node/8)
It's on an older php version and I have been going through and fixing the many small problems that keep coming up in the different files.
I got to one file, and after fixing most the problems, this happens:
Unknown column 'o.PlayerType' in 'where clause'
This seems to be the section where the problem is coming from:
$query_GetTransactions = sprintf("SELECT o.*, 'False' as PosG, p.Number, p.Name FROM playerscontractoffers as o, players as p WHERE o.Player=p.Number AND o.PlayerType='player' AND (o.Type='Extension' OR o.Type='Signed') AND o.Approved='True' UNION ALL SELECT o.*, 'True' as PosG, p.Number, p.Name FROM playerscontractoffers as o, goalies as p WHERE o.Player=p.Number AND o.PlayerType='goalie' AND (o.Type='Extension' OR o.Type='Signed') AND o.Approved='True' ORDER BY DateCreated DESC LIMIT 0,50");
$GetTransactions = mysqli_query($connection, $query_GetTransactions) or die(mysqli_error($connection));
$row_GetTransactions = mysqli_fetch_assoc($GetTransactions);
$totalRows_GetTransactions = mysqli_num_rows($GetTransactions);
I'm quite new to php, and I have no idea what to do. If you need more of the file, please let me know.
I have just upgraded Magento from 1.5.1.0 to 1.9.2.1 and I am stuck at this error when I try to view a product:
a:5:{i:0;s:1427:"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'rule.calculate_subtotal' in 'field list', query was: SELECT `main_table`.`tax_calculation_rate_id`, `main_table`.`tax_calculation_rule_id`, `main_table`.`customer_tax_class_id`, `main_table`.`product_tax_class_id`, `rule`.`priority`, `rule`.`position`, `rule`.`calculate_subtotal`, `rate`.`rate` AS `value`, `rate`.`tax_country_id`, `rate`.`tax_region_id`, `rate`.`tax_postcode`, `rate`.`tax_calculation_rate_id`, `rate`.`code`, IF(title_table.value IS NULL, rate.code, title_table.value) AS `title` FROM `tax_calculation` AS `main_table` INNER JOIN `tax_calculation_rule` AS `rule` ON `rule`.`tax_calculation_rule_id` = main_table.tax_calculation_rule_id INNER JOIN `tax_calculation_rate` AS `rate` ON rate.tax_calculation_rate_id = main_table.tax_calculation_rate_id LEFT JOIN `tax_calculation_rate_title` AS `title_table` ON rate.tax_calculation_rate_id = title_table.tax_calculation_rate_id AND title_table.store_id = '1' WHERE (customer_tax_class_id = 3) AND (product_tax_class_id IN ('2')) AND (rate.tax_country_id = 'GB') AND (rate.tax_region_id IN(0, 0)) AND (rate.zip_is_range IS NULL) AND (rate.tax_postcode IS NULL OR rate.tax_postcode IN('*', '', 'ig9 5bw', 'ig9 5bw*', 'ig9 5b*', 'ig9 5*', 'ig9 *', 'ig9*', 'ig*', 'i*')) ORDER BY `priority` ASC, `tax_calculation_rule_id` ASC, `tax_country_id` DESC, `tax_region_id` DESC, `tax_postcode` DESC, `value` DESC";i:1;s:6703:"#0 /home/wwwarabesquecost/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
I have tried to manually add it using this link : https://sarfarazlaghari.wordpress.com/2015/06/06/magento-sqlstate42s22-column-not-found-1054-unknown-column-rule-calculate_subtotal-in-field-list/ but this doesn't make a difference.
Has anybody had this issue before?
Regarding
I have tried to manually add it using this link : https://sarfarazlaghari.wordpress.com/2015/06/06/magento-sqlstate42s22-column-not-found-1054-unknown-column-rule-calculate_subtotal-in-field-list/ but this doesn't make a difference
Are you saying you've added the column to the tax_calculation_rule table but you're still getting the above error? If that's the case then you've updated the wrong database table, or a configuration file in app/etc is pointed at a different database from the one you think it is.
If that's not what you're saying then be clearer in your question.
The query that you found at that link has an obvious error: it create a new field in the table with the same name of the table.
The right query, which solve the error, is the following:
ALTER TABLE tax_calculation_rule
ADD calculate_subtotal TINYINT(1) NOT NULL DEFAULT 0
Hope it helps.
You shouldn't run sql alternations just like that. The OP mentioned this has happened after an upgrade to 1.9x.
Having such errors means that your codebase is upgraded but your database is still outdated.
The best way for this would be to alter the core_resource table for the module (e.g. tax_setup) to the version that his database was aware previously, and let magento handle the database updates.
I have been facing an issue after another wile trying to access data from MySql Server from SQL server.
Here is what I have done so far.
1) installed MySQL ODBC Driver 5.2w on my SQL Server
2) I created a link server from Microsoft SQL Server Managment S (MSQLSMS)
following the instructions on this site
http://sql-articles.com/blogs/creating-linked-server-to-mysql-from-sql-server/
Now in my MSQLSMS I opened a connection to a server called "SERV1" I executed the following query and it is working with no problem.
SELECT
p.team_name,
p.fullname,
SUM( ISNULL(i.CallDurationSeconds, 0) ) AS totalTime
FROM OPENQUERY(SERVPHP, 'SELECT
CAST(t.name AS CHAR) AS team_name,
CAST(TRIM(REPLACE(CONCAT(su.first_name, " ", su.middle_name , " ", su.last_name), " ", " ")) AS CHAR) AS fullname,
CAST(su.login_user AS CHAR) AS username,
CAST(p.account_id AS UNSIGNED) AS account_id
FROM call_managment_system.phone_calls AS p
INNER JOIN call_managment_system.users AS su ON p.owner_id = su.user_id
INNER JOIN call_managment_system.teams AS t ON su.team_id = t.team_id
WHERE p.status = 2 AND t.client_id = 1 AND p.last_attempt_on BETWEEN "2013-01-01 08:00:00" AND "2013-04-30 07:00:00"
GROUP BY t.team_id, p.owner_id') AS p
INNER
JOIN OPENQUERY(SERVPHP, 'SELECT
CAST(cn.contact_number AS CHAR) AS phone_number,
CAST(cn.account_id AS UNSIGNED) AS account_id
FROM call_managment_system.contact_numbers AS cn
WHERE cn.contact_link = "Account"
UNION
SELECT CAST(cn2.contact_number AS CHAR) AS phone_number,
CAST(cn2.account_id AS UNSIGNED) AS account_id
FROM call_managment_system.contact_personal AS cp
INNER JOIN call_managment_system.contact_numbers AS cn2 ON cn2.person_id = cp.person_id AND cn2.contact_link = "Account" ') AS cn ON cn.account_id = p.account_id
INNER
JOIN I3_IC.dbo.CallDetail AS i ON p.username = i.LocalUserId AND RIGHT(i.RemoteNumber, 10) = cn.phone_number
WHERE i.I3TimeStampGMT BETWEEN '2013-01-01 08:00:00' AND '2013-04-30 07:00:00'
GROUP BY p.team_name, p.fullname
Now Since I am using PHP to execute this query. I have done the following
1) using PDO api to connect to the SQL server "SERV1" where I executed this query before.
2) try to execute that same query listed above.
But this time I get error where I am not able to solve.
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "SERVPHP"
Note that "SERVPHP" is the server where my PHP application is running and my MySql Server is running.
"SERV1" if where my SQL server is running and where I installed the ODBC driver.
More,
When I run this query the same way from my PHP application it works
SELECT
LocalUserId AS loginName,
RemoteNumber AS PhoneNumber,
SUM(CallDurationSeconds) AS totalTalk
FROM CallDetail
WHERE LocalUserId = 'test' AND
I3TimeStampGMT BETWEEN '2013-01-01 08:00:00' AND '2013-04-30 07:00:00'
GROUP BY LocalUserId, RemoteNumber
Why is it now working?
What do I need to make this query execute from my PHP server?
Thanks
Using the suggestions in the comments above, I discovered it was a permission issue.
I had to go to the Linked Server Properties and clicked on the "Security" menu on the left.
Then I had to add a user and a password. I also selected "Be made using the login's current security context".
Few weeks ago my code was all fine, but recently I've been unable to load my test database on my web app (built using CakePhp).
This is the error :
Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near ') LEFT JOIN blogs AS Blog ON
(Song.blog_id = Blog.id) WHERE 1 = 1' at line 1
[CORE/cake/libs/model/datasources/dbo_source.php, line 684]
SELECT COUNT(*) AS `count`
FROM `songs` AS `Song`
LEFT JOIN libraries AS `Library` ON (`Song`.`id` = `Library`.`song_id` AND `Library`.`user_id` =)
LEFT JOIN `blogs` AS `Blog` ON (`Song`.`blog_id` = `Blog`.`id`)
WHERE 1 = 1
Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near ') WHERE 1 = 1 ORDER BY Song.postdate
desc LIMIT 100' at line 1
[CORE/cake/libs/model/datasources/dbo_source.php, line 684]
SELECT *, Blog.id
FROM `songs` AS `Song`
LEFT JOIN libraries AS `Library` ON (`Song`.`id` = `Library`.`song_id` AND `Library`.`user_id` =)
WHERE 1 = 1
ORDER BY `Song`.`postdate` DESC
LIMIT 100
You don't have a condition for the Library.userid column:
Library.user_id =)
You need to specify a value on the right side of the equals sign!
your error is here:
Library.user_id =)
maybe you want to change it to:
Library.user_id ='$user_id')
It appears that some value for user_id is not being passed into the query:
`Library`.`user_id` =)
//-----------------^^^^
Likely, there is some PHP variable missing here, or a PDO parameter is not being correctly bound.
SELECT COUNT(*) AS `count` FROM `songs` AS `Song`
left JOIN libraries AS `Library`
ON (`Song`.`id` = `Library`.`song_id` AND `Library`.`user_id` =) <-- HERE's something missing
LEFT JOIN `blogs` AS `Blog` ON (`Song`.`blog_id` = `Blog`.`id`) WHERE 1 = 1
SELECT *,
Blog.id FROM `songs` AS `Song` left JOIN libraries AS `Library`
ON (`Song`.`id` = `Library`.`song_id` AND `Library`.`user_id` =) <-- HERE's something missing
WHERE 1 = 1 ORDER BY `Song`.`postdate` desc LIMIT 100
Since this is a CakePHP question, my answer will approach from the paradigms of the framework. However, given your SQL output, you are either NOT using CakePHP or you are doing something that is definitely a no-no.
Please post the Find statement that you are using the build this SQL statement and your Library's hasMany relationship to Blog. Unless you are using the query method, I think you would get a PHP error before you could build this type of SQL statement using the CakePHP find conventions. If you are using the query method to find your data, then don't. This is a simple query that can be done with CakePHP find easily.
Your library model should like like:
public $hasMany => array('Blog');
And the find:
$this->Library->find(
'all',
array(
'conditions' => array(
'1' => 1 //Not sure why you have Where 1=1
)
'order' => "Library.name DESC",
'limit' => 100
)
);