Echo colon array in table format [closed] - php

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;
?>

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 ...

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'];
}
}

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']).')';

How to separate with (query and 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 8 years ago.
Improve this question
I have a post table like this one:
id|title|slug| tags |
1 |aaaaa|aaaa|cms,php,review|
How can I split the "tags" string and make each one into a tag that is clickable like these:
this is title of post
this is description of the post
category(blog, internet)
tags(cms, php, review)"each of them will be a link".
try something like this using explode
<?php
$explo_str = explode(',',$tags_string)//tags string is your data straight from the mysql table in this case cms,php,review
for($i=0 ; $i < sizeof($explo_str) ; $i++)
{
echo ''.$explo_str[$i].'';
}
?>

Categories