download multiple pdo files

how to upload multiple files in database with this script also i want to make the input file and database not required What do you think? Is the script protected? Here's my php pdo script: $file = $_FILES['file']; $fileName = $_FILES['file']['name'];

Connect the IBM database using PDO

I tried connect IBM database through PDO using below code. But, it is not working try { $db = new PDO("odbc:DRIVER={IBM DB2 ODBC DRIVER};DATABASE=BLUDB;HOSTNAME=hostname;PORT=50000;PROTOCOL=TCPIP;", "username", "password"); e

PDO MSSQL - bad value BIGINT returned

I'm trying to query against a BIGINT primary key on a MSSQL database and some of the returned values turn up rounded, different than the ones stored in the database: See screenshot here 9200000000000359 exists in the DB, as well as 9200000000000361.

echo json_encode returns an empty string

I have a php script that runs a simple SELECT query, and it seems to work fine. Here's the script: error_reporting(E_ALL); ini_set('display_errors', 1); try { $hostname = "localhost"; $username = "root"; $password = ""; $db =

PHP MySQL PDO: get the last inserted ROW non ID

I have currently a script to insert new data automatically when using the form to add a new element. I use public string PDO::lastInsertId ([ string $name = NULL ] ) Logic of course. Now I am only wondering if this might cause any problems in case a

The alert function does not work in code js

here is my Index file: <!Doctype html> <html> <head><title>The Database Entry Project</title></head> <body> <div> <form> <h3>Input Details Here</h3> <label for="fn">First Na

php message displays a blank message and no output

I am trying to send a group of variables and using PDO to insert into my database, however when i run the page, i get an empty message box and nothing is happening on the page. This is how I am getting the user inputs. <div class="caption1" c

Incrementation via MySQL / PHP

I am looking for a way to increment and decrement by a step of three records in a table and return them. Say ID '4' is currently active. I want to get the next 3 and the previous 3 records with IDs and category of 3.2.1 and 5.6.7 (via incrementing an

The PDO insertion request will not work

My PDO query won't work. This is my page: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta

How to pass the PDO variable to another class?

Since im too new in PHP, i dont know how to pass a PDO variable to another class? This is settings file for connection. <?php try { $kullanici = 'root'; $sifre = ''; $baglan = new PDO ("mysql:host=localhost;dbname=ders", $kullanici, $sifre);

PHP / MySQL to PDO?

I'm very new to PHP/Mysql and I naturally have a few questions. I was following a youtube tutorial on creating a simple dynamic website that pulls data content from a MySQL database then displays the content on a single PHP index page. I followed thi

Using $ _POST Variables in Prepared Statements

I have been trying to work out prepared statements, and using $_POST variables in it, but nothing I've seen online seems to work. I know that questions are meant to show proper research, but I can't find anything that matches this question online. Pl

Live verification does not work using PDO

I am using JQuery to check if username is in use, however I have some issues. It is always stuck of "Searching". Image below shows exactly what the issue is. Register.JS: $(document).ready(function(){ $('#username').keyup(function() { var userna

PDO reports failed but the error code indicates the opposite

I'm just using PDO to insert customers into my table but it has been overcomplicated by something which is unexplainable by myself or other research. It gives the error code: 00000 (which means that is a success, apparently) but no data was actually

Track the error in the PDO update request

This question already has an answer here: Reference - frequently asked questions about PDO 3 answers I have an update query $query = $db->prepare("UPDATE user SET UserID='6',UserName='xyz' WHERE UserID= '6' "); $query->execute(); it runs f

simple connection function using PDO

im still in the early learning stages, banging my head against walls looking for clues. Iv been reading the manual to no avail. im building a user log in system based on the phpAcadamy tutorial 'Register & Login'. They use mysql_connect in the tutori

Problem of the MySQL PHP connection function

I have made a login function only i get a internal server error. I have checked the function but i don't see the issue. If i use this: function login($username, $password) { if (!isset($username) || !isset($password)) { return false; } if ($this->db-

How to change an update request from mysql to pdo?

I am using the bellow query to update but now I tried to change it to pdo and it failed to work Please any help will be appreciated function updateonlinesession(){ if(isset($_SESSION['username']['id'])){ $uid = $_SESSION['username']['id']; $page = $_

PHP PDO loop results

I'm trying to fetch all records from my table on my site, I have the following $sth = $conn->prepare("SELECT * FROM directory WHERE user_active != ''"); $sth->execute(); /* Exercise PDOStatement::fetch styles */ $result = $sth->fetch(PD

How to use sessions in PDO?

I am still redoing and getting rid of old mysql_* commands in my code. I tried to transfer my session login form old code and this is what I got so far: public function login($user, $password) { if (!empty($user) && !empty($password)) { $password

Insert a php variable with latin characters in mysql db

I'm pretty sure, a common problem but am looking for the best practice solution. I have a legacy database, for which I have written a script to migrate the data. In my script I have the following: $select = $dbh->query("SELECT CollectionID, Collec

Syntax error with PDO Prepared instructions

I've only just started working with prepared statements, and my first few examples worked out great, but now I'm running into an SQL syntax that I don't understand. I have a function that performs an INSERT, taking a parameter of an associative array

How to get the total number of rows of a GROUP BY query?

From the PDO manual: PDOStatement::rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding PDOStatement object. If the last SQL statement executed by the associated PDOStatement was

PHP PDO: charset, define names?

I had this previously in my normal mysql_* connection: mysql_set_charset("utf8",$link); mysql_query("SET NAMES 'UTF8'"); Do I need it for the PDO? And where should I have it? $connect = new PDO("mysql:host=$host;dbname=$db",