40 Solved Topics

Remove Filter
Member Avatar for
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
502
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 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
280
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 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 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
449
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
575
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
573
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 fireburner29

Hi, Please help me to resolve my Script Redirection problem. Actually i have developing simple crm application php using pdo->prepare. this is working fine in localhost. but what is my problem means redirection is not working, when i uploaded to server. for refernce i hereby attached . please help me …

Member Avatar for fireburner29
0
751
Member Avatar for nadiam

hello. i got this error and i have no idea why or what is going on. could someone explain in layman's term please and help me out. > Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'event_id' cannot be null' in /home/dhsbnet/public_html/ems/add_guest.php:36 Stack trace: #0 …

Member Avatar for nadiam
0
1K
Member Avatar for nadiam

hi, i have an import csv script but it does not get entered into the database. only "uploaded successfully" and the data is echoed but nothing in the database is something wrong with it? and is it sql injection safe? <?php if(isset($_SESSION['sess_user_id'])) { if (isset($_POST['ubmit'])) { require "connection.php"; $session = …

Member Avatar for cereal
0
3K
Member Avatar for nadiam

hey guys. i have this table that lists contacts that are stored in database. the data is selected from 2 tables using join which i have already got working: SELECT c.contact_id,c.salutation,c.fname,c.lname,c.dob,c.houseadd,c.personalno,c.officeno,c.email,c.spouse,c.child, s.spouse_id,s.s_salutation,s.s_fname,s.s_lname,s.my_spouse FROM contact1 c LEFT JOIN spouse1 s ON c.contact_id = s.my_spouse what im having trouble with is selecting …

Member Avatar for nadiam
0
215
Member Avatar for nadiam

hello. I have a table populated by name. The names are links when clicked will pop up a form for editing. each input (for editing) is populated by the equal value from database but im having trouble with one particular text box. this text box is for date of birth …

Member Avatar for diafol
0
583
Member Avatar for nadiam

Hey guys, so im wondering if theres a way to insert 2 input values into one column in PDO? coz in mysql_* i just did something like this and it worked: INSERT INTO tablename VALUES ('input1 input 2', 'input3'); pdo i tried : $event = $dbh->prepare("INSERT INTO event(event_name,start_event,end_event,event_venue) VALUES('$name', CONCAT_WS('$dstart', …

Member Avatar for hericles
0
275
Member Avatar for joshl_1995

Hello Community, I'm trying to connect to my database using PDO but for some reason it keep coming back saying "Undefined variable: db_c" db_c is the variable I've chossen for the name of my database connection. I've placed the database connection in another file, and I'm trying to connect to …

Member Avatar for cereal
0
287
Member Avatar for joshl_1995

Hello Community, I have recently been having a big of a look into connecting to a database using PDO but I'm not too sure what I should stick with, the normal way to connect to a MySql database or should I start using PDO. What would be better to use? …

Member Avatar for joshl_1995
0
257
Member Avatar for tony75

HI I'm working with a php script and connecting via PDO to a database My php file retrieves all data from datebase when I selected one radio button for example 2GB usb driver. This is my html code <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>form php pdo</title> </head> <body> …

Member Avatar for tony75
0
521
Member Avatar for rhodoscoder

<?php // post_view.php require 'connection.php'; $id =$conn->lastInsertId('id'); $stmt = $conn->prepare('SELECT * FROM posts WHERE id = LAST_INSERT_ID(id) LIMIT 1'); $stmt->execute(array('id' => 'LAST_INSERT_ID(id)')); while($row = $stmt->fetchAll(PDO::FETCH_ASSOC)) { //$row is an array object? that has one array in index 0 print_r($row); echo '<h2>'.$row[':title'].'</h2>'; //echo '<em>Posted '.date('F j<\s\up>S</\s\up>, Y', $row['date']).'</em><br/>'; echo nl2br($row[':body']).'<br/>'; echo …

Member Avatar for LastMitch
0
127
Member Avatar for Eagle.Avik

why is the code below is not working? $sql = "SELECT password, fullname, active FROM ".$mysql_table.""; $sql = $sql . "WHERE username = :username, password = :password"; $statement = $pdo->prepare($sql); $statement->bindValue(':username', $_POST['username']); $statement->bindValue(':password', md5($_POST['password'])); $statement->execute();

Member Avatar for minitauros
0
554
Member Avatar for dany12

I would like some help with my connect class.This class is created by me it is my way of thinking so i would like to know why this class dossent get my variables and connect proprely to mysql. the code <?php /** * Exp:Connect to database in oop style @params …

Member Avatar for pritaeas
0
1K
Member Avatar for joshmac

I have this search method that doesn't seem to work, and I am not sure why. I need an extra pair of eyes to see why my search query brings back false results. Thanks in advance. public function search($data) { $person = $data['person']; $bind = [ ":person" => "%$person%" ]; …

Member Avatar for joshmac
0
944
Member Avatar for everton.retweets

Hi Everyone... I have been digging around the web for the last two days trying to fix this problem myself, but have come to the realization that I need some help. I have a mysql query that selects all country names from my country db, (works as described) I then …

Member Avatar for phorce
0
731
Member Avatar for titos97

On the form user enter rego no where it search database and display the output what i am looking is, if the entered data not match its should display " Record not found." <?php $search_Rego = ($_POST['RegoNo']); try { //open the database $db = new PDO('sqlite:iSearch.sqlite'); $result = $db->query("SELECT Fname …

Member Avatar for minitauros
0
361
Member Avatar for joshmac

I am not a jquery guru in any sense, so I am seeking some help with the below code. What I am trying to do, is populate two input fields, based on what is selected from a dropdown field via a database call. When I select a term from the …

Member Avatar for joshmac
0
969
Member Avatar for joshmac

I few weeks ago, I posted some code that I need help converting to MySQLi, now I need some help converting it to PDO. The code allows you to enter queries and commands and brings back the column headings and the information that I am looking for into a table. …

Member Avatar for joshmac
0
3K
Member Avatar for code_rum

Below is my code.. $stmt->execute($params) is not getting executed $name = $_REQUEST['name2']; $surname = $_REQUEST['surname2']; $add = $_REQUEST['add2']; $pdo = new PDO( "mysql:host = localhost;dbname = employee", "xxx", ""); $stmt = $pdo->prepare( 'INSERT INTO test_differ VALUES( :name2 , :surname2 , :add2 )' ); $params = array( ':name2' => $name, ':surname2' …

Member Avatar for code_rum
0
172

The End.