Loop through array for INSERT query parameters

So a INSERT query is like this: $stmt = $db->prepare("INSERT INTO table () VALUES ()"); I have an array here: $array = ['a', 'aa', 'aaa', 'b', 'bb', 'sds', 'asdf', 'sdfswe', 'sdvsd', 'sdasss', 'sbdss', 'sdfabwew', 'asdfavs', 'sdbweq', 'sdfbs',...
more »

2017-08-13 22:08 (1) Answers

PDO::__construct (sqlite) try/catch use

Trying to use a try/catch block for a connection to a sqlite database I found that when a database connection couldn't be made, the database file was created. Checking here the following issue is reported : If 'example.db' does not exist, no exce...
more »

2017-08-13 21:08 (1) Answers

is it Google Login secure? (PHP CLIENT)

I use Google API PHP Client in my website. Once User login with Google after click Google Login button on my site. I collect data from Google Response that's contain Google Profile ID data. CHECK, Register and Login logic If Profile ID not exist ...
more »

2017-08-13 21:08 (1) Answers

Set PHP variable to MySQL wildcard '%'

I'm trying to query posts using PDO where the database column 'tags' = something. My problem is: I want my query to work even if there's no $_GET['tag'] request is set and here's my code. if (!isset($_GET['tag'])) { $tags = '%'; } else { $t...
more »

2017-08-13 18:08 (1) Answers

Insert with PDO messes up with values

I pass some values to a php file which then should insert the data into a MySQL Table using PDO. Here is the file: <?php function makeInsert($query, $paramArray){ include 'db.php'; try { $pdo = new PDO("mysql:hos...
more »

2017-08-13 13:08 (0) Answers

PDO bindValue() is not working

The bindVlaue() is not giving me any result. here is my code. public function query($sql, $values = array()){ $this->_error = false; echo $sql . "<br />"; if($this->_query = $this->_pdo->prepare($sql)){ ...
more »

2017-08-12 17:08 (0) Answers

How to make multiple levels filter PHP + Mysql

I`m trying to make 2 levels filters in php. In short - as I select first option (see image below) the buttons should appear, as I select one of the buttons, the list of data from third_level table should appear. The image explains all in details. Wh...
more »

2017-08-12 00:08 (0) Answers

$_POST PDO update : variable variables

My page receives with $_POST for PDO update: id: 5296 sg: 5285-5034 t_dur: 133867 ... id_200: data... id_651: ... id_38: ... id_971: ... id_326: ... id_327: ... id_89: ... How to update my table without knowing the id ? UPDATE table_name SET id_...
more »

2017-08-11 20:08 (1) Answers

Login form doesn't read sha512

I added sha512 to this login form but I keep getting the error Invalid username or password. I used http://www.convertstring.com/Hash/SHA512 to set the password in the database Why doesn't it work? The password in the database is hashed with sha512 ...
more »

2017-08-11 13:08 (1) Answers

some issue with conversion of old codes to new pdo

I'm trying to convert mysql to pdo. I'm sharing my code below which I've done so far . But I guess I've not done it in the right way as no results are showing, \ Its basically a load more results script with 2 files index.php which throught ajax c...
more »

2017-08-11 07:08 (0) Answers

SQLSTATE[42000] Error

I am working with database using PHP Data Objects(PDO) and I use try-catch block. I have the following code in my try block $name=$email=$subject=$message=""; if($_SERVER["REQUEST_METHOD"]=="POST"){ $name = $_POST["name"]; $e...
more »

2017-08-11 06:08 (1) Answers

PHP, Descending Sort

How to descending Sort result column... This My Code... <?php while (@$row = @$query1->fetch(PDO::FETCH_ASSOC)){ extract($row); ?> <tr> <td class="text-center"><?php echo $row['column1']; ?></td> <td class="tex...
more »

2017-08-11 06:08 (0) Answers

Uncaught Exception SQLState [HY093]

I'm trying to create a social networking site but I'm getting an error in my login page Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: no parameters were bound' in D:\wamp\www\Adding\classe...
more »

2017-08-11 03:08 (0) Answers

Internal Server Error in PDO Statment?

I have written a function that is in the file insert.php and looks like this: <?php function makeInsert($query, $paramArray){ include 'db.php'; try { $pdo = new PDO("mysql:host=localhost;dbname=$db_name", $db_user, $db_pass); ...
more »

2017-08-10 19:08 (1) Answers

PDO php routes not displaying page

I have an index page that runs php route but it does't display any page,it just shows me a white blank page. here is my code for the index page <?php ini_set('memory_limit', '-1'); include 'include/connect.php'; /* The following func...
more »

2017-08-10 11:08 (0) Answers