PHP Select MYSQL select id from Array [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Hello I have this array:
$_SESSION['id'] = array();
I would like to select all array ID'S and then select them from the database.
How to do it? I have no idea..

$sql='select name from table where id in ('.implode(",",$_SESSION['id']).')';

Related

PHP - duplicate value [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I had this code
$loop ="5";
$value = "1";
how to insert value to db like this 1:1:1:1:1 (where loop have 5)
thanks
string $val_for_Db = "";
for ($i=0;$i<$loop;$i++) {
$val_for_Db = $val_for_Db."".$value.":";
}
$val_for_Db = substr($val_for_Db ,-1);
Now insert $val_for_Db to database.

Get value from type point in php [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a field in the database of type POINT (phpMyAdmin). I use this column to save gps coordinates.
Now I want to extract the value of latitude and longitude from database.
Can I do that without having to add other fields?
$query="SELECT * FROM risk_disposal WHERE id=$id";
$result=mysqli_query($conn,$query);
while ($row2 = mysqli_fetch_array($result))
{echo "$row2['gps']";}
Database
Try it:
SELECT ST_X(point), ST_Y(point) FROM ...

MySQL select from users where there are more matches [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to know how to choose the users that have the highest number of columns to match the columns of the logged in user.
order by sum matches conditions ex:
SELECT * FROM table where fColumn = 'name' and column2='value2' or colmun3='value3'
ORDER BY (
(column2='value2') + (column3='value3')
) DESC

Get the closest value of a column in MYSQL [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have a table that have a CP value (numeric), for example, 28030, 28060, 27100 etc. And the user can introduce a number via PHP. I want to, having this number for example, 28050, order in MYSQL my table putting 28060 as the first position.
This is the basic of my table:
SELECT * FROM `tiendas` ORDER BY `CP`
ABS() will work. Here's a query that does the job:
SELECT
CP
FROM tiendas
ORDER BY ABS(CP- 28050) ASC

Selecting data from MySQL in random order [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to extract each row from a table, but in random order. How can I do that? I tried using rand(), but I was not successful.
My database is named "permis54_permis-online-date" and my table is named: "intrebari".
Use ORDER BY RAND() MySQL:
SELECT column FROM intrebari
ORDER BY RAND()
select * from intrebari order by rand();

Categories