PHP variable values issue [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 4 days ago.
Improve this question
$int['nume_serv'] = variable values from mysql.
echo $int['nume_serv'] // looks like "1, 2, 3"
I run a javascript code to do something based on values
NOT Running
$listpers = $cru->GetListPersonal($_SESSION['struct'],$selected = array($int['nume_serv']));
Running
$listpers = $cru->GetListPersonal($_SESSION['struct'],$selected = array(1, 2, 3));
I want to run code when it looks like this:
$listpers = $cru->GetListPersonal($_SESSION['struct'],$selected = array($int['nume_serv']));

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.

Check when a information provided from sql changes in php [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 5 years ago.
Improve this question
I want to get a warning when a date is different like:
I have a while and wanted to when it reaches to a different date, it warns me
$hist=mysqli_query($db, "SELECT * from history");
while($his=mysqli_fetch_assoc($hist)){
If(certain_date != last_date){
echo certain_date;
}
}
Certain date and last date is the ones I wanna get
This is simply done like this
$hist=mysqli_query($db, "SELECT * from history");
$last_date = '';
while($his=mysqli_fetch_assoc($hist)){
If($his['ano'] != $last_date){
echo $his['ano'];
$last_date = $his['ano'];
}
}

select different value according to different condition [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
How to select and sum different values according to different condition in mysql and PHP in a single statement. Please look at the picture for understanding the concept clearly. Thanks
The general strategy is like this:
SELECT City,
SUM(IF(MONTH(DateColumn) = 1, AmountColumn, 0)) AS JanuaryTotal,
SUM(IF(MONTH(DateColumn) = 2, AmountColumn, 0)) AS FebruaryTotal,
. . .
SUM(IF(MONTH(DateColumn) = 12, AmountColumn, 0)) AS DecemberTotal
FROM YourTable
WHERE YEAR(DateColumn) = 2015
GROUP BY City

change specific values of array in PHP [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
<?php
$x=6;
$y=9;
$time = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
for ($i=$x;$i<=count($y);$i++)
{
If($x!=$y)
{
$time[$i]=1;
}
}
?>
Depending on the value of x and y,the values in array should change.
In this example... array[5] until array[8] should be value 1.
The value of x and y will not same.
Not a very good question, but I'm a little bored. So for fun:
array_splice($time, $x-1, $y-$x-1, array_fill(0, $y-$x+1, 1));
Not exactly sure of the logic using 6 and 9 and array[5] until array[8] is, but adjust the numbers to fit the range.

PHP Select MYSQL select id from Array [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 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']).')';

Categories