Questions tagged [prepare]

A prepared statement is used to execute the same SQL statement repeatedly with high efficiency.

A prepared statement is used to execute the same SQL statement repeatedly with high efficiency.

See documentation for more information.

210 questions
4
votes
1 answer

Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in...filetext

$fields is an array that after printing gets values like: Array ( [first_name] => Nisse [last_name] => Example [ssn] => 198306205053 [address] => Stockholm, Sverige [phone_number] => 54654987321546 [latitude] => 55.717089999999999…
HolyMackerel
  • 157
  • 2
  • 3
  • 12
4
votes
1 answer

Qt QSqlQuery prepare and bindValue not working

I have a problem with prepare and bindValue :( db.open(); QSqlQuery q; q.prepare("SELECT id_malade,nom,prenom FROM Malade WHERE nom LIKE %:p% OR prenom = %:f% ;"); q.bindValue(":p",ui->lineEdit->text()); …
3
votes
2 answers

MVN release:prepare with Mercurial push FAIL

Here's the steps I take: Clone mercurial project at the head. On local repository, perform hg status (no results), then hg in (no changes). mvn clean install. Build is successful. mvn release:prepare. Get's to the point where it's excuting a…
user1042520
  • 51
  • 1
  • 3
3
votes
1 answer

Why does my PDO statement -> execute return false?

After near endless rounds of testing different aspects of this, I've determined that the PDO connection works (I can run a simple query and display results), I've determined that the statement is successfully preparing, and that the values are…
somewhatsapient
  • 390
  • 2
  • 3
  • 10
3
votes
1 answer

Understanding PDO Prepared Statements and Binding Parameters

From experience and also having been told constantly the benefits of using prepared statements and binding my parameters, I have constantly used those two techniques in my code, however I would like to understand exactly the purpose of each of those…
Webeng
  • 7,050
  • 4
  • 31
  • 59
3
votes
1 answer

MediaPlayer sometimes not preparing when screen is locked

I have a MusicService for MediaPlayback, wich uses a MediaPlayer with the settings: player.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); player.setAudioStreamType(AudioManager.STREAM_MUSIC); and those Listeners are…
Dominik Seemayr
  • 830
  • 2
  • 12
  • 30
3
votes
1 answer

Clearing bindings on an SQLite3 statement doesn't seem to work (PHP)

When inserting multiple rows to SQLite3 in PHP using a prepared statement, if you don't bind a parameter for a row then the value from the previous row will be inserted, even if you "clear" the statement between lines. Look at the following…
symos
  • 31
  • 3
3
votes
1 answer

updating my table with prepare command increase the value by 2

I am trying to run this simple mysqli command in php: $query = "UPDATE config SET visit = visit + 1"; if ($stmt = $con->prepare($query)) { $stmt->execute(); $stmt->close(); } Table config only has 1 row. However, the value instead of 1, it…
Soley
  • 1,716
  • 1
  • 19
  • 33
3
votes
2 answers

When does a prepared statement fail?

I've been messing around with the MySQLi object in PHP, and was getting used to preparing statements before executing them. Thus far I've mostly been doing the following : if($stmt = $mysqli->prepare($sql) == false){ return…
Gary
  • 1,120
  • 10
  • 14
3
votes
1 answer

How to write "create user ?" with MySQL prepared statement

I tried: SET @user = 'foo@localhost'; SET @pass = 'bar'; SET @sql = 'CREATE USER ? IDENTIFIED BY ?'; PREPARE stmt FROM $sql; and I get error ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL…
DarkSide
  • 3,670
  • 1
  • 26
  • 34
3
votes
2 answers

Using prepared statements with SQLite3 and PHP

I'm trying to add data to a database using SQLite3 in PHP. I got it working without prepared statements but now I'm trying to make it safer. I'm not using PDO. So far the following code doesn't work. It just inserts the words ":name" and ":email"…
Conor Taylor
  • 2,998
  • 7
  • 37
  • 69
3
votes
0 answers

MediaPlayer takes to long on prepareAsync, how to minimize time

My issue is that the app stays about 3-4 seconds in the prepareAsync: This takes to long, so i need to change something, to minimize the time it stays there. This is my code: if (path_to_play == "") { …
rosu alin
  • 5,674
  • 11
  • 69
  • 150
3
votes
1 answer

How to interrupt android MediaPlayer.prepareAsync()?

I use Android MediaPlayer for streaming audio playback. But some times record preparing stage takes too long. So I would like to give user ability to interrupt preparing and start another. How can I do this? Thanks in advance. Michael
Lampapos
  • 1,063
  • 1
  • 12
  • 26
3
votes
1 answer

How to close prepare statement connections? this is correct? - PDO

i use this code, for example: $result = $link->prepare("SELECT * FROM animals WHERE id = '$id'"); $result->execute(); $row = $result->fetch(PDO::FETCH_ASSOC); $result = null; $link = null; It's ok use "$result = null;" to close this connection?
3
votes
3 answers

MySQL Select into variable

I want to further use in the procedure the values I get from a select into execution but can't figure out how to do it. As a test I wrote the following but cannot use the v_1, v_2 or v_3 variables for further logic as they don't take the values 1,2…
Leo
  • 123
  • 1
  • 3
  • 10
1
2
3
13 14