How to separate with (query and php) [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
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].'';
}
?>

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

Echo colon array in table format [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 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;
?>

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 search string in MySQL [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 search number in my MySQL data. String is +310623212542 but the mysql row data is only 0623212542. How can i compare ? Please help i am new to the mysql
Use
In php
<?php
$search_text = substr('+310623212542',3);
mysqli_query("SELECT * FROM tbl WHERE search LIKE '%$search_text%'");
?>
or
in mysql
use SUBSTRING
SELECT * FROM tbl WHERE search = SUBSTRING('+310623212542' FROM 4)
Note: using substring in mysql impact performance issue, when large data present

Categories