Skip to content

Tag: mysql

Laravel 5.1 – Checking a Database Connection

I am trying to check if a database is connected in Laravel. I’ve looked around the documentation and can’t find anything. The closest thing I’ve found is this, but this doesn’t solve my problem. I have three instances of MySQL that are set up on different machines. Below is a simplifie…

mysql_query returns TRUE for SELECT statement [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 29 …

How to create PDO connection in __construct()?

I have one class that is containing three methods. All of those methods need to database, Then I want to create a system for connection to database before everything. Something like this: Now I want to know (in first) what I did is a standard approach? and (in second) how can I check [if connection was discon…

How to calculate total price in php

I am getting the price of the product from db using the product id i have stored in php array. i have a php function where in i want to hold a total of all the products purchased. here i am getting the cart items and i am calling the function which should hold total amount. i am passing the