If I execute an insert query with a stored procedure with php and the mysqli_* functions, is there a way to retrieve the value of an autoincrement id field?
mysqli->insert_id does not seem to work.
...
I'm having trouble finding documentation about how exactly to go about "turning on" mysqli. I'm running OS X SL and, as I understand it, since php5 is installed, the mysqli extension should already be there as well.
Is this as simple as adding a LoadModule line to php.ini? If I need to re-compile php, does anyone know of a good link...
I am having trouble using the mysqli class in PHP and I haven't been able to find the answer anywhere.
In my script a class creates a mysqli connection that it uses throughout it's functions. Afterward, this script forks. The connection is used by the children as well, but I'm running into the problem of the connection being closed (MYS...
I'm having trouble trying to use $stmt->store_result() after executing a prepared statement. The manual says "Transfers a result set from a prepared statement", but to where?
I would ideally like to use it, all nice an buffered in memory, like mysqli->query() returns.
The php documentation examples make it seem like the only good reaso...
I'm wondering if prepared statements work the same as a normal mysql_query with multiple VALUES.
INSERT INTO table (a,b) VALUES ('a','b'), ('c','d');
VS
$sql = $db->prepare('INSERT INTO table (a,b) VALUES (?, ?);
If I use the prepared statement in a loop, is MySQL optimizing the insert in the background to work like it would in the...
Hi there
i'm trying to check if a string match one of the fields in a certain column in a table for this i need to get all the rows from result object i'm using php 5.2.x so can't use fetch_row_all method instead i'm tring to build a new array that will hold all rows
here is my code:
$sql = new mysqli($config['host'],$config['user'],$co...
I need an extra set of eyes on this one. Any help will be greatly appreciated. This is a very simple search query, but for whatever reason I cannot find the bug. Well, I know where the bug is. I just can't get past it. Anyway.....
I am taking a search value from a POST variable, setting that variable and then setting a column variable a...
I have a project we are about to wrap up, but just got a request from the DBA to make all our connections SSL. So I switched the driver to mysqli in the object that turns out ADODB instances, but I don't see any native method to create secure connections.
To make things more difficult, there is a different set of certs and keys per con...
Hey all,
I recently set up a SQL logging framework with PEAR, and everything was working fine. However, I thought that the default length of the message field (VARCHAR 200) was a little short, so I changed my database structure in phpmyadmin to increase this to 512. However, I quickly realized that this changed completely stopped loggi...
Hi.
Couldn't find a method like the int executeUpdate(String sql, int autoGeneratedKeys) in php.
I want to insert data to the database, and then get an autogenerated int key in return (the ID).
Thanks :)
Oh, and PS: it has to be a method from the mysqli class =)
...
According to http://us2.php.net/manual/en/mysqli-stmt.bind-param.php,
the different types are:
i corresponding variable has type integer
d corresponding variable has type double
s corresponding variable has type string
b corresponding variable is a blob and will be sent in packets
However, how can you handle this:
->prepare(...
Hi all
i'm trying to save data to database and i get an error i never saw before
i have a hunch it has something to do with the db collation but I'm not sure whats wrong,
here is the query:
$query1 = "INSERT INTO scape.url (url,normalizedurl,service,idinservice) VALUES (url, normalizedurl, 4, 45454)";
$query = "INSERT INTO ...
Hello!
I use a little search script in my site.
After post the search form, i get this variable:
$var = $_GET[$q] ;
$trimmed = trim($var);
Then i try to search in database:
$query = "select * from test where acc like \"%$trimmed%\"";
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
.......
I try to search...
I've been using ADODB for PHP on several projects for quite some time, and I like it for the ease of use and the efficiency.
I've never been too curious about the way that lib accesses data because you know...it just worked :) But today I realized I'm still relying on the legacy MySQL4 ADODB drivers. I'm using MySQL 5.x, and it would pr...
Hello everone,
I am buidling a small job application website, and i'm using a the basis of a login system taken from a Nettuts.com tutorial.
The logging in works fine, but I am having trouble getting the details for the currently logged in user, for example if a user enters their personal details, i can process the data into the databas...
Historically, I've always used
mysql_real_escape_string()
for all input derived from users that ends up touching the database.
Now that I've completely converted over to MySQLi and I'm using prepared queries with bound parameters, have I effectively eliminated the possibility of SQL injection attacks?
Am I correct in saying I no lon...
I have a database table where I need to pull a row, test user input for a match, then update the row to identify the user that made the match. Should a race condition occur, I need to ensure that the first user's update is not overwritten by another user.
To accomplish this I intend to:
1. Read row
2. Lock table
3. Read row again and c...
Hello everyone, i am looking to count the number of records returned by the query below using mysqli / prepared statements:
$mysql = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('There was a problem connecting to the database');
$stmt = $mysql->prepare('SELECT id,vcref,jobtitle,jobtype,jobintro,closingdate FROM jobs WHERE...
Hi, I have two classes in a PHP application, B extending A for example.
Class A has a function which returns some of its other properties in the form of an array of SQL insert queries eg
Class A {
$property_a;
$property_b;
$property_c;
$property_d;
function queries() {
$queries = array();
$queries[] = "INSERT INTO xxx VALUES " . $this-...
I'm considering changing some PHP code to use PDO for database access instead of mysqli (because the PDO syntax makes more sense to me and is database-agnostic). To do that, I'd need both methods to work while I'm making the changeover.
My problem is this: so far, either one or the other method will crash Apache.
Right now I'm using XA...