Linked Questions
34 questions linked to/from Bind multiple parameters into mysqli query
6
votes
5
answers
5k
views
How to use prepared statements in queries with an IN clause in PHP [duplicate]
I need to make a simple query
$array_of_ids = array();
//poulate $array_of_ids, they don't come from another db but from Facebook
//so i can't use a subquery for the IN clause
$wpdb->prepare("...
0
votes
1
answer
731
views
dynamically add variables to mysql:bind_param [duplicate]
I wanna add dynamically variables to mysqli:bind_param ...
I saw a lot of tutorials and examples but the code I made isn't working for hours now.
$params = array('');
$params[0] = $variableType; //...
0
votes
1
answer
414
views
Dynamic number of arguments in bind_param [duplicate]
I have been trying to use call_user_func_array()but dont seem to get it right.
$sql_sentence = "SELECT * FROM test_table WHERE Fag = ? AND (" . $sql_subject . ") AND (" . $sql_grade . ") AND (" . $...
3
votes
0
answers
174
views
PHP - Select statement in a foreach loop [duplicate]
Am trying to run this code:
foreach ($tags as $tag)
{
$tag = strtolower($tag);
$tag = trim($tag);
echo "<br>" . $tag . " checking<br>";
$query = "SELECT `tag_id`, `...
1
vote
1
answer
114
views
How to convert a string into a usable array [duplicate]
Right now I'm currently attempting to make a MySQLi class to make typing code easier and so it looks cleaner and is more usable overall.
I'm attempting to write a function which will execute a query ...
0
votes
0
answers
74
views
Using an Array in the where clause of a MySQL query [duplicate]
I am trying to use an array in the where clause of a MySQL query but the query is not displaying the posted array correctly.
I post the array and the console displays:
[RoomOverrideRoomSelect] => ...
0
votes
0
answers
38
views
Using prepared statements on insert query [duplicate]
I have a function which inserts data into a mysql database table. How can I use mysqli prepared statements to make sure the values are safe?
//Inserts a new row into the database.
//takes an array of ...
0
votes
0
answers
33
views
Prepared statement for each value of array PHP [duplicate]
I'm doing a webapp with PHP and I have an array with some values which is greatherThan[], I need to make a prepared statement for each value of the array, for example if the array has the values 4,5,6
...
0
votes
0
answers
32
views
php mysql update multiple rows in different values [duplicate]
I am doing update the table values of multiple rows.
So i using the query is
UPDATE `notification` SET `flag`='1' WHERE id IN (1,2,3,4)
Where it is working as fine. But don't how to use it in php. ...
0
votes
0
answers
27
views
PHP Prepared statement with IN clause shows nothing [duplicate]
Following is the code I am testing now for a comparison website.
But I couldn't make it work with the prepared statement function.
My code works well if I didn't use the prepared statement method.
The ...
1
vote
0
answers
27
views
binding dynamic data from arrays using php mysqli extension [duplicate]
I have an html form from which i trying to dynamically search for data from the database
Here is the minified html which contains the form and the div with the class results-area containing some php ...
0
votes
0
answers
25
views
mysqli where php while issue [duplicate]
can i put more then just 1 int in where mysqli select.
and can i put var in at.
$selectQuery22 = mysqli_query($db,
"SELECT * FROM `messages` WHERE `user_id` in(21,2) ORDER BY `date`DESC");
i put ...
0
votes
0
answers
25
views
Using an array in mysqli param bind [duplicate]
I am getting a PHP Warning:
mysqli_stmt_bind_param() expects parameter 2 to be string, array given. The line in question is: mysqli_stmt_bind_param($stmt, $types, $values);
I guess this is because $...
1
vote
2
answers
54
views
Php mysqli query with array [duplicate]
I have database with users, I want to show results without users that i have id's in array.
How should i do it, any ideas?
<?php
include_once "dbh.php";
session_start();
$id = $_SESSION['userId'];...
2738
votes
14
answers
263k
views
Why shouldn't I use mysql_* functions in PHP?
What are the technical reasons for why one shouldn't use mysql_* functions? (e.g. mysql_query(), mysql_connect() or mysql_real_escape_string())?
Why should I use something else even if they work on ...