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.
Related
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 ...
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'];
}
}
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 am not able to convert this array which is defined by colon to display in table (as mentioned below). Can anyone please guide me.
$info='Title:Beckham,Age:43,Address:UK';
Must look like this table format:
<?php
$info='Title:Beckham,Age:43,Address:UK';
$info_array = explode(",",$info);
$table = "<table>";
foreach($info_array as $row){
$row_obj_array = explode(":",$row);
$table .= "<tr><td>$row_obj_array[0]</td><td>$row_obj_array[1]</td></tr>";
}
$table.="</table>";
echo $table;
?>
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']).')';
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
I have a MySQL query that does a selection. I then have a $numrows variable which I have set to $numrows = mysql_num_rows($query);. If the value of $numrows == 0, I want the array variable I have to be set to empty. I tried setting the array variable to null and ""; but those don't work. Any suggestions? Thanks.
Empty an array
$array= array();
Delete it altogether
unset($array);