98 Topics

Member Avatar for
Member Avatar for mexabet

I have two MySQL tables, which I want to SELECT using a single PDO query and positional placeholders. I've been going through similar questions here to find a solution, but none seems to match the issues I'm having. The following code is the section of my script: <?php // query …

Member Avatar for mexabet
0
856
Member Avatar for mexabet

I'm trying to redirect user to "**userinfo.php**" after successful registration, but the browser terminates the redirection because it goes into endless loops. Moreover, I need your insight on if the script is secure or not. I need your help, please. Thanks. The following is the "**register.php**" script: <?php // include …

Member Avatar for Dani
0
341
Member Avatar for mexabet

I'm struggling to build a PHP registration script using PDO prepared statements with positional placeholders. But the MySQL queries don't execute. `var_dump();` doesn't display any error. Please, I need your help to fix this. Your time and input are much appreciated in advance. Thanks. **register.php:** <?php // include configuration file …

Member Avatar for rproffitt
0
605
Member Avatar for mexabet

I'm struggling to add a course to a MySQL database table using PDO prepared query with positional placeholders. When the form is submitted, the database table is not updated, as expected and no error is displayed. Please, where exactly do I place `var_dump()` to display the error? And how can …

Member Avatar for mexabet
0
225
Member Avatar for jeffersonalomia

I hve encountered this error that I was using php pdo and wamp server 3.0. I couldnt insert data in ms sql server 2012 because it says that it couldnt find the table Error sql state[ 42S02] Base table or view not found: 208 invalid object name isys.ref_product sql insert …

0
204
Member Avatar for mexabet

I have a script that populates a form from MySQL database table row for editing. I'm performing MySQL SELECT and UPDATE via PDO. After editing a particular table row and clicking on the submit button, the table row doesn't update. The following is "modify-course.php": <?php // configuration require("../includes/config.php"); // query …

Member Avatar for rproffitt
0
1K
Member Avatar for mexabet

I'm doing both SELECT and UPDATE queries using named placeholders. But course data from the database doesn't populate form, as expected. The database table row records don't populate, each time I try to edit a course in the browser. I connect to the database usining PDO. And I do SELECT …

0
316
Member Avatar for mexabet

I'm trying to upgrade my script from PHP 5.5 to PHP 7.2. And that came with the script not able to modify a selected table row as before. The records don't even populate whenever I try to edit a course in the browser. Please, note that I'm connecting to the …

Member Avatar for alan.davies
0
486
Member Avatar for random_1

Hi, I don't know if this is possible or a really stupid question. I was wondering if after a select query has been executed can the results be filtered for specific values, and not just a single value but 7 different values. with what i want to accomplish its either …

Member Avatar for random_1
0
444
Member Avatar for random_1

Hello, I am trying to insert a registration form with password using `password_hash()` but I am not sure what is wrong with whatever i am doing because the password doesn't get inserted into the database although all the other values do and no errors. database : password | varchar(255) php: …

Member Avatar for random_1
0
500
Member Avatar for seularts

I have a little issue I can't figgure out. I can't seem to figure out how to add dots to my pagination so I don't have more pagination numbers than mysql results in the page XD . This is my code: $query = "SELECT id, ....."; $records_per_page=10; $crud->paginglink($query,$records_per_page); public function …

Member Avatar for seularts
0
1K
Member Avatar for seularts

I'm trying to find a way to output whatever BLOB files are inserted into a silly database. In my code when I query the CV column I get all sorts of weird symbols. Can you guys please help me fix my code? $crud->dataview($query); }else{ $query = "SELECT id, from_unixtime(cheie_wp) as …

Member Avatar for cereal
0
3K
Member Avatar for seularts

please help me cause I am totally lost on this one. I am trying to fetch the results from a database that has the data inserted in a weird way. The IDs are not unique, thus I have multiple values with the same ID in the ID column. I am …

Member Avatar for jkon
0
2K
Member Avatar for developer707

Hello, Recently I am starting to code my scripts in PDO method to manage the information in a mysql database. In this case I am having an issue how to use the best practice conditions when dealing with a POST **int** value. With the posted values I am making a …

Member Avatar for cereal
0
352
Member Avatar for Amaina

This question is similar to this [one](https://www.daniweb.com/programming/web-development/threads/371092/notice-undefined-index-id-on-line-26) However, my insert does not involve a form but a direct mysql query that looks like this $query2 = "insert into table(author,title,abstract) values(:author,:title,:abstract) "; $stm=$con->prepare($query2); $stm->bindValue(':author', $author, PDO::PARAM_STR); $stm->bindValue(':title', $title, PDO::PARAM_STR); $stm->bindValue(':abstract', $abstract, PDO::PARAM_STR); $stm->execute(); echo "$author &nbsp $title &nbsp $abstract <br>" In …

Member Avatar for Amaina
0
279
Member Avatar for Amaina

I have this code session_start(); $username = $_SESSION['username']; function getUserRole($username, $roleid){ $con=dbConnect(); $query="select * from user inner join userrole on user.id = userrole.userid inner join role on role.id = userrole.roleid where username = $username"; $sql=$con->prepare($query); $sql->bindValue(':username',$username); $sql->bindValue(':roleid',$roleid); $sql->execute(); $row = $sql->fetch(); $username = $row['username']; $roleid = $row['roleid']; if($row > 0){ …

Member Avatar for diafol
0
2K
Member Avatar for rouse

Apparently I don’t know how to insert a row into a MySQL data base using PDP and I would like to know what I am missing This PHP PDO script does not insert data into a database. I would like to know why. It does not error out but the …

Member Avatar for cereal
0
573
Member Avatar for spud91

Im working on a small website and im a little confused on one step. I'm following a very simple mvc pattern, ive currently got one controller that creates a session array that holds all the posted data IF the form has been submitted, This data is coming from several different …

Member Avatar for spud91
0
329
Member Avatar for spud91

SEEMS AS IF MY ARTICLE HAS BEEN SUBMITTED TWICE. I DO APOLOGISE FOR THAT Hi guys, I'm working on a small website and I'm currently stuck on a small issue. Ive got a set of dropdown boxes created and populated in HTML, for example: <select name="heatingType" id="heatingType" required> <option value="" …

Member Avatar for spud91
0
257
Member Avatar for shany0786

i have following code first insert is working properly and data in to database but second insert query which depends on last_insert_id() fails.I have tried to find out mistake but failed to do so? <?php namespace Solutions\File; class AddUserData { function __construct($DB_con) { $this->db = $DB_con; } public function insert_detail($productDetails){ …

Member Avatar for cereal
0
2K
Member Avatar for jkon

Hello, This tutorial is the next of “[A simple Data Layer for OOP PHP Applications](https://www.daniweb.com/programming/web-development/tutorials/500118/a-simple-data-layer-for-oop-php-applications)” so having read it and made your own tests is needed to understanding what we are doing. So far we have a Db object (child of PDO that standardize and simplifies its use) , a …

Member Avatar for jkon
4
587
Member Avatar for jkon

A simple Data Layer for OOP PHP Applications Hello, first of all to understand this tutorial would be best if you have some knowledges about OOP ( https://www.daniweb.com/programming/web-development/tutorials/437592/introduction-to-phps-object-orientation by priteas ) and DB usage (MySQL in this case) with PHP https://www.daniweb.com/programming/web-development/threads/499320/common-issues-with-mysql-and-php by diafol ). What we will try to achieve …

Member Avatar for jkon
4
2K
Member Avatar for rpv_sen

Hi I am trying to create a update function. But it not updating in the database. Please help me to fix. **Test-2.php** $whereString = ''; $bind = NULL; if(isset($_POST['Submit'])) { if($_POST) { $SCYQ64UKID = $_GET['SCYQ64UKID']; $SCYQ64AVGP = $_POST['SCYQ64AVGP']*100; $searchFields = array('SCYQ64EMAL'=>$_POST['SCYQ64EMAL'],'SCYQ64EV01'=>$_POST['SCYQ64EV01'],'SCYQ64EV02'=>$_POST['SCYQ64EV02'],'SCYQ64EV03'=>$_POST['SCYQ64EV03'],'SCYQ64EV04'=>$_POST['SCYQ64EV04'],'SCYQ64EV05'=>$_POST['SCYQ64EV05'],'SCYQ64EV06'=>$_POST['SCYQ64EV06'],'SCUSER'=>$_POST['SCUSER'],'SCYQ64AVGP'=>$SCYQ64AVGP,'SCYQ64TZ'=>$_POST['SCYQ64TZ'],'SCJOBN'=>gethostname(),'SCPID'=>'SSWEB','SCUPMJ'=>$_POST['SCUPMJ'],'SCUPMT'=>$_POST['SCUPMT']); if($post = array_filter($_POST)) { if($fields = array_intersect_key($searchFields, $post)) { …

Member Avatar for rpv_sen
0
448
Member Avatar for rpv_sen

Hi I am trying to display count of a row using function with get values. Please help me to fix the issue **class** class Users { private $conn; private $db_name= "DATABASE"; public function __construct($db) { $this->conn = $db; } /*Join Two Tables with where condition and order by*/ public function …

Member Avatar for rpv_sen
0
570
Member Avatar for rpv_sen

I have created a function. if i provide correct username and password. i am getting a error message as **Sorry, that username / password is invalid !** can any one please help me to fix the issue. **login.php** <?php require 'include/init.php'; $general->logged_in_protect(); if(empty($_POST) === false) { $username = trim($_POST['username']); $password …

Member Avatar for rpv_sen
0
571
Member Avatar for rpv_sen

Hi I am trying to connection my database ODBC using function. I am getting an error **Connection error: could not find driver** **mycode is** <?php class Database{ // specify your own database credentials private $host = "servername"; private $db_name = "databsename.schemaname"; private $username = "username"; private $password = "password"; public …

Member Avatar for rpv_sen
0
3K
Member Avatar for praba_web

Hi there, I have a login form.which contains two input parameters. login_id and password. login_id may be mobile or email. user may use mobile no or email as login id. my table structure is uid email mobile password status when i login through mobile no it is validating and showing …

Member Avatar for diafol
0
450
Member Avatar for rpv_sen

Hi Friends I am facing an issue in update query using PDO Prepare method. Please help me to fix the issue. $consql = "UPDATE $database.$constant_application SET SCYQ64EMAL=:SCYQ64EMAL, SCYQ64EV01=:SCYQ64EV01, SCYQ64EV02=:SCYQ64EV02, SCYQ64EV03=:SCYQ64EV03,SCYQ64EV04=:SCYQ64EV04, SCYQ64EV05=:SCYQ64EV05, SCYQ64EV06=:SCYQ64EV06, SCUSER=:SCUSER, SCJOBN=:SCJOBN, SCPID=:SCPID, SCYQ64AVGP=:SCYQ64AVGP, SCYQ64TZ=:SCYQ64TZ, SCUPMJ=:SCUPMJ, SCUPMT=:SCUPMT where SCYQ64CID=:SCYQ64CID"; $row = $dbh->prepare($consql); $row->bindParam(":SCYQ64EMAL",$SCYQ64EMAL); $row->bindParam(":SCYQ64EV01",$SCYQ64EV01); $row->bindParam(":SCYQ64EV02",$SCYQ64EV02); $row->bindParam(":SCYQ64EV03",$SCYQ64EV03); $row->bindParam(":SCYQ64EV04",$SCYQ64EV04); $row->bindParam(":SCYQ64EV05",$SCYQ64EV05); …

Member Avatar for diafol
0
296
Member Avatar for diafol

I've been playing with PDO and got quite a shock, so I thought I'd run this past you all. I love PDO, and I thought that the "prepare once, execute many" idea behind prepared statements was beautiful. Now previous to using prepared statements, I used to build up a long …

Member Avatar for diafol
4
12K
Member Avatar for blueguy777

how to put `where clause variable $didno` in following code: $pdo = Database::connect(); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "SELECT * FROM misscall WHERE did_no = ?"; $q = $pdo->query($sql); $mobile1 = array(); while ($mobi1 = $q->fetchColumn()) { $mobile1[] = $mobi1; } $mobile1list = join(",", $mobile1); Database::disconnect(); thanks in advance

Member Avatar for diafol
0
565

The End.