[PHP-DB] Prepared Statements - Search

2012-12-03 Thread Ethan Rosenberg, PhD
Dear List - I am trying to use prepared statements with the following code: $allowed_fields = array ('Cust_Num' => 'i', 'Fname' => 's', 'Lname' => 's', 'Street' => 's','City'=> 's', 'State' => 's', 'Zip' => 'i', 'Phone' => 'i', 'Note

Re: [PHP-DB] Prepared Statements - Select - Bind Parameters w/ correction

2012-09-28 Thread Matt Pelmear
$stmt = mysqli_stmt_prepare( $cxn, $sql12 );// line 507 //Warning: mysqli_stmt_prepare() expects parameter 1 to be mysqli_stmt, object given in /var/www/x5.php on line 507 $cxn is not a mysqli_stmt. Are you perhaps passing the mysqli database resource instead of the statement? See this

Re: [PHP-DB] Prepared Statements - Select - Bind Parameters w/ correction

2012-09-27 Thread Matt Pelmear
Ethan, Please accept my apologies for the minor errors in the untested code I previously provided for your edification. Consider the following tested code: CREATE TABLE test (id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, data INT UNSIGNED); INSERT INTO test (data) VALUES (123),(124),(1

[PHP-DB] Prepared Statements - Select - Bind Parameters w/ correction

2012-09-27 Thread Ethan Rosenberg, PhD
Dear list - SEE CORRECTION IN $_POST VARIABLE BELOW. Thanks to all for your help. I hope [??] that this question will solve all the remaining problems. So that we are on the same page, here is what was previously stated. mysqli_stmt_bind_param expects three variables, in this order mysq

[PHP-DB] Prepared Statements - Select - Bind Parameters

2012-09-27 Thread Ethan Rosenberg, PhD
Dear list - Thanks to all for your help. I hope [??] that this question will solve all the remaining problems. So that we are on the same page, here is what was previously stated. mysqli_stmt_bind_param expects three variables, in this order mysqli_stmt_bind_param($stmt, "num", $a, $b, $

Re: [PHP-DB] Prepared Statements - Select

2012-09-21 Thread Matt Pelmear
Ethan, I believe the root of your problem is that you are passing $bind3 as a string to mysqli_stmt_bind_param() where the function was expecting multiple arguments. Let's say $binder = array( 'one', 'two', 'three' ); // I'll call this $arguments in my example below and $typer = array( 's',

[PHP-DB] Prepared Statements - Select

2012-09-19 Thread Ethan Rosenberg, PhD
Dear List - Thanks to all for your responses. Here is another one I wish to accomplish the following mysqli_stmt_bind_param($stmt, 'sis', $_POST['Site'], $_POST['MedRec'], $_POST['Sex']); This statemnt was hand coded. I wish to be able to generalize it. Therefore - $sql11 =

Re: [PHP-DB] Prepared Statements - Search

2012-09-13 Thread Karl DeSaulniers
Ethan, 9 times out of 10 your answer is in the error statement. Warning: mysqli_stmt_bind_result(): Number of bind variables doesn't match number of fields in prepared statement. GL, Best, Karl On Sep 13, 2012, at 7:09 PM, Ethan Rosenberg, PhD wrote: Dear List - Here is another problem

[PHP-DB] Prepared Statements - Search -- SOLVED!!!

2012-09-13 Thread Ethan Rosenberg, PhD
Dear List - -->> THANKS TO ALL. See below <-- Here is another problem I am having with prepared statements. The last one was INSERT, this one is SELECT. Here is the database: mysql> describe Intake3; ++-+--+-+-+---+ | Field | Type| Null | Ke

Re: [PHP-DB] Prepared Statements - Search

2012-09-13 Thread Fjalar Sigurðarson
Does the list of the SELECT fields not have to match the variables you are binding? E.g. if you do not include MedRec in your SELECT then you have no MedRec data to bind from your $sql11 variable to the $MedRec varable and then nothing to print there... or what? Am I just fabulating? :). Cheers,

[PHP-DB] Prepared Statements - Search

2012-09-13 Thread Ethan Rosenberg, PhD
Dear List - Here is another problem I am having with prepared statements. The last one was INSERT, this one is SELECT. Here is the database: mysql> describe Intake3; ++-+--+-+-+---+ | Field | Type| Null | Key | Default | Extra | ++---

Re: [PHP-DB] Prepared Statements Insert Problem - Any more ideas?

2012-09-02 Thread Matijn Woudt
On Sun, Sep 2, 2012 at 10:41 PM, Ethan Rosenberg, PhD wrote: > On Sun, Sep 2, 2012 at 6:45 AM, Ethan Rosenberg, PhD > wrote: >> >> Dear List - >> >> I wish to accomplish the following with prepared statements: >> >> $stmt = mysqli_stmt_init($cxn); >> if($stmt = mysqli_stmt_prepare($stmt, "

Re: [PHP-DB] Prepared Statements Insert Problem - Any more ideas?

2012-09-02 Thread Ethan Rosenberg, PhD
On Sun, Sep 2, 2012 at 6:45 AM, Ethan Rosenberg, PhD wrote: Dear List - I wish to accomplish the following with prepared statements: $stmt = mysqli_stmt_init($cxn); if($stmt = mysqli_stmt_prepare($stmt, "INSERT INTO Intake3 (Site, MedRec, Fname, Lname, Phone, Height, Sex, Hx, Bday, Age)

Re: [PHP-DB] Prepared Statements Insert Problem

2012-09-02 Thread Ethan Rosenberg, PhD
Ethan Rosenberg, PhD /Pres/CEO/ *Hygeia Biomedical Research, Inc* 2 Cameo Ridge Road Monsey, NY 10952 T: 845 352-3908 F: 845 352-7566 erosenb...@hygeiabiomedical.com On 09/02/2012 08:33 AM, Matijn Woudt wrote: On Sun, Sep 2, 2012 at 6:45 AM, Ethan Rosenberg, PhD wrote: Dear List - I wish to

Re: [PHP-DB] Prepared Statements Insert Problem

2012-09-02 Thread Matijn Woudt
On Sun, Sep 2, 2012 at 6:45 AM, Ethan Rosenberg, PhD wrote: > Dear List - > > I wish to accomplish the following with prepared statements: > > $stmt = mysqli_stmt_init($cxn); > if($stmt = mysqli_stmt_prepare($stmt, "INSERT INTO Intake3 (Site, > MedRec, Fname, Lname, Phone, Height, Sex, Hx,

[PHP-DB] Prepared Statements Insert Problem

2012-09-01 Thread Ethan Rosenberg, PhD
Dear List - I wish to accomplish the following with prepared statements: FYI - The Database: mysql> describe Intake3; ++-+--+-+-+---+ | Field | Type| Null | Key | Default | Extra | ++-+--+-+-+---+ | Site

[PHP-DB] Prepared Statements

2011-11-15 Thread Gavin Chalkley
Hi all, I am struggerling with a prepared statement (may not even be suited) $stmt = $db->stmt_init(); if($stmt->prepare("SELECT title,live,where FROM content")) { $stmt->bind_param('sii',$t,$l,$w); ## This bit here $stmt->execute(); $stmt->bind_result($title

Re: [PHP-DB] Prepared Statements

2011-11-12 Thread tamouse mailing lists
On Fri, Nov 11, 2011 at 10:41 AM, Ron Piggott wrote: > > $dsh = 'mysql:host=localhost;dbname='.$database; > $dbh = new PDO($dsh, $username, $password); > > #query for the authorization code > > $query = "SELECT `authorization_code` FROM > `directory_listing_update_authorizations` WHERE NOW() BET

Re: [PHP-DB] Prepared Statements

2011-11-11 Thread Matijn Woudt
On Fri, Nov 11, 2011 at 5:41 PM, Ron Piggott wrote: > > I have two questions about Prepared Statements from the code below: > > #1: > The purpose of the first $query is to determine if the authorization code > supplied is both accurate and also live > - When the authorization code is generated it

[PHP-DB] Prepared Statements

2011-11-11 Thread Ron Piggott
I have two questions about Prepared Statements from the code below: #1: The purpose of the first $query is to determine if the authorization code supplied is both accurate and also live - When the authorization code is generated it is given a time frame when it must be used in. The columns `st

Re: [PHP-DB] Prepared Statements With Multiple Databases

2011-09-30 Thread Bastien
On 2011-09-30, at 8:26 PM, "Ron Piggott" wrote: > > I need my Prepared Statement database connection to be able to connect with > two different databases (which use the same username / password). > > They are assigned variables > > $database1 and $database2 > > What I have been using so fa

[PHP-DB] Prepared Statements With Multiple Databases

2011-09-30 Thread Ron Piggott
I need my Prepared Statement database connection to be able to connect with two different databases (which use the same username / password). They are assigned variables $database1 and $database2 What I have been using so far is: $dsh = 'mysql:host=localhost;dbname='. $database1; $dbh = new

Re: [PHP-DB] Prepared Statements Rows Selected

2011-05-23 Thread Giff Hammar
$stmt->rows() should give you the number of rows returned. Giff On Mon, 2011-05-23 at 18:53 -0400, Ron Piggott wrote: > What command will tell me the # of rows the SELECT query retrieved using > Prepared Statements. > > > $dsh = 'mysql:host=localhost;dbname='.$database; > $dbh = new PDO($dsh,

[PHP-DB] Prepared Statements Rows Selected

2011-05-23 Thread Ron Piggott
What command will tell me the # of rows the SELECT query retrieved using Prepared Statements. $dsh = 'mysql:host=localhost;dbname='.$database; $dbh = new PDO($dsh, $username, $password); $stmt = $dbh->prepare($query); $stmt->bindParam(':email', $email); $stmt->bindParam(':pass', $pass); $stm

Re: [PHP-DB] Prepared Statements # of rows

2011-03-04 Thread Adriano Rodrigo Guerreiro Laranjeira
Hey friend! You can use the PDOStatement::RowCount, but there is a problem (extracted from the PHP Manual, http://php.net/manual/en/pdostatement.rowcount.php): PDOStatement->rowCount - Returns the number of rows affected by the last SQL statement. If the last SQL statement executed by the ass

[PHP-DB] Prepared Statements # of rows

2011-03-04 Thread Ron Piggott
When I used Prepared Statements how do I check for the # of rows found (Equal to mysql_numrows )? IE Following the command: $stmt->execute() or die(print_r($stmt->errorInfo(), true)); Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info

[PHP-DB] Prepared Statements

2011-02-11 Thread Ron Piggott
I am just starting to use Prepared Statements and am in a learning curve. I am working on the code below. It is for a directory. This is to select the listing for updating. How do I tell if there are more than 1 search result? Am I correctly retrieving the results, if there is more than 1?

[PHP-DB] Prepared Statements and mySQL

2010-12-27 Thread Ron Piggott
I am trying to implement Prepared Statements on my web site and this is the first time I have ever used this. #1) I received the error “class mysql not defined”. That is a reference to the first line of code (below) where the database connection is established. #2) How do I assign the aut

[PHP-DB] Prepared statements via mssql extension

2004-06-28 Thread Gerard Samuel
Is it possible? Just checking... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DB] prepared statements under load with pconnect

2001-09-13 Thread John Espey
When I use pconnect to connect to a db2 back end, I get the expected faster connection times. However, when the site is under any sort of load (6 or more concurrent accesses), we have noted that the time spent preparing statements increases greatly (execution time remains fairly consistent howeve