As stated in title, when trying to install Magento through Installatron on cPanel it throws an error everytime saying:-
"A database query has failed. Is the entered database information correct? Does the account have available disk space?
Technical information:
method = query
arguments = array ( 0 => 'SELECT user_id FROM mg_admin_user WHERE is_active=\'1\' ORDER BY user_id ASC LIMIT 1', 1 => NULL, 2 => 'user_id',)"
We have a website vehicle search page and over a week ago we migrated to a new hosting provider.
All old users who are revisting and some select users don't see any results on our search however when utilising dd on the collection of products it shows the correct count however the list of results are not part of the collection.
If we use incognito or flush our dns, chrome cache and local cache we can see the results properly.
I can provide the code pieces in question if required, however wondering if anyone has had this issue before.
Thanks
We have done the following;
Flushed the cache and cookie via code in the controller
localstorage refresh with jquery
localsession refresh with jquery
updated all versions on style sheets and javascript to refresh them
ran composer update to see if that helps
Cleared every inch of cache via laravel commands on the server ,application cache, views, routes, configs
new key
change cache clearance in htaccess
changed from Public to no-store in htaccess
The following 3 worked however not ideal as we can't utilise this on customers machines;
Flushed chrome cache via browser
Flushed dns via cmd line
Icognito
This is the part of code that retrieves and makes up the collection;
$products = $this->product->search($data, $page->id, 24, $type, $userlatLon);
This function is the following;
public function search($data, $pageId, $productsPerPage, $type, $userlatLon)
{
if($pageId == 1536){
unset($data['images']);
}
$sortArray = self::sortArray();
$avaiableFilters = self::avaliableFiltersArray();
$types = self::determineTypeFromGivenInt($type);
$select = 'products.url, products.id, products.registration_date, products.created_at as in_stock_date, products.location_code, products.type, products.special_order, products.price, products.sale_price, products.make, products.model,
products.derivative, products.mileage, products.live_until, products.model_year, products.year, products.times_viewed_in_the_last_week, products.transmission, products.tax_cost, products.fuel_type, our_title, our_description, i.our_src_440, f.term, f.first_payment, f.id as finance_id,
no_of_regular_payments, monthy_payments, final_payment, cash_price, cash_deposit, engine_size_formatted, total_deposit, amount_of_credit, total_charge_for_credit, total_amount_payable, products.plus_vat, products.attention_grabber,
apr, l.friendly_name as location_name, l.url as location_url, l.gmaps_url as gmaps, l.address_1, l.town, l.city, l.postcode, l.telephone, if(sale_price > 0 AND sale_price < (price - 100) , 1 , 0) as reduced';
!!!MORE QUERYING IS HERE!!!
if ($type == 4) {
$products = $products->has('pdfRecord')->groupBy('products.make', 'products.model')->paginate($productsPerPage, ['products.url']);
} else {
$products = $products->groupBy('products.id')->paginate($productsPerPage, ['products.url']);
}
return $products;
}
The expected results should be all products showing like a normal user sees.
However the collection returns 648 results but non of the results are part of the collection
I have followed this link to create database notification in my laravel ecommerce app , when buyer user send question to seller
my application successfully able to create database notification as follows
table : notifications
id | type | notifiable_id | notifiable_type | data | read_at | created_at | updated_at
id = 0b2a7fdf-eea4-4982-a86d-e874bb4f28ef
type = App\Notifications\BuyerQuestionNotification
notifiable_id= 48
data = {"message":"Someone asked question for Hostelfe","url":"#", "question_id":12024}
read_at = NULL
created_at = 2018-04-07 12:46:42
updated_at = 2018-04-07 12:46:42
now i want to delete database notification row by data->question_id
I have tried below query :
DB::table('notifications')
->where('type','App\Notifications\SellerAnswerNotification')
->where('data->question_id',2079107489)
->first();
got error :
[2019-03-31 13:22:03] local.ERROR: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>'$."question_id"' = ?' at line 1 (SQL: select * from notifications where type = App\Notifications\SellerAnswerNotification and data->'$."question_id"' = 2079107489)
I have also tried below query:
$result=DB::table('notifications')->whereRaw("JSON_EXTRACT(data, '$.question_id') = ?", [2079107489]);
But got similar error
How to correct the query to get row and delete row by json in notifications table?
Here you go, I tried this one and it worked:
DB::table('notifications')
->where('type','App\Notifications\BuyerQuestionNotification')
->where('data->question_id',12024)
->first();
NOTE: it will work only for MySQL 5.7.13 and later.
For further reading :
https://dev.mysql.com/doc/refman/5.7/en/json-search-functions.html#operator_json-inline-path
https://laravel.com/docs/5.8/queries#json-where-clauses
When you do json_decode($data) then try where($data['question_id'])
I have a query as:
SELECT ps_node_id,name
FROM cz_ps_nodes WHERE cz_ps_nodes.ps_node_type=261
START WITH NAME = 'Bundle Rule Repository',cz_ps_nodes.devl_project_id = P_devl_project_id AND cz_ps_nodes.deleted_flag = 0
CONNECT BY PRIOR ps_node_id = parent_id.
This query works.
But if I just remove the name from the select part like:
SELECT ps_node_id
FROM cz_ps_nodes WHERE cz_ps_nodes.ps_node_type = 261
START WITH NAME = 'Bundle Rule Repository',cz_ps_nodes.devl_project_id = P_devl_project_id AND cz_ps_nodes.deleted_flag = 0
CONNECT BY PRIOR ps_node_id = parent_id.
The query just hangs but was working on oracle 10 g and the problem started when we upgraded to oracle 11g.
Could anyone explain why?
Got the issue solved by using : alter session set optimizer_features_enable='10.2.0.4' –
I have a website under the joomla in one of the hosting servers. It was working fine until yesterday. But starting from yesterday when I open the web site it gives me following error:
500 - No valid database connection:MySQL server has gone away SQL=SELECT a.*, CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug, CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug FROM jos_content AS a INNER JOIN jos_categories AS cc ON cc.id = a.catid INNER JOIN jos_sections AS s ON s.id = a.sectionid WHERE a.state = 1 AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2012-03-04 17:59:41' ) AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2012-03-04 17:59:41' ) AND s.id > 0 AND a.access <= 0 AND cc.access <= 0 AND s.access <= 0 AND s.published = 1 AND cc.published = 1 ORDER BY a.created DESC LIMIT 0, 5
Or sometimes it just says :
Internal Server Error.
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#mysite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
What could be wrong with it? Or it is the host center who has a problem?
Change the database type from mysql to mysqli.