mysqli - How to bold some php string -


i trying make string bold in text. went through php book , looked online, no solutions helped problem. variable $mapname , $post_title change because they're in while loop working fine replacing characters, 1 example:

$data_p = "select * posts verified='yes' order (posvotes - negvotes) desc $max";  $exec_p = $mysqli->query($data_p); while($row = $exec_p->fetch_object()) {  $post_id = $row->post_id; $maps = "select name maps id='$post_id'"; $getmaps = $mysqli->query($maps); $mapname = $getmaps->fetch_object(); $post_title = preg_replace('/(free )/',"<b>\\0</b>", $post_title); 

but when try replace string

$post_title = str_replace($mapname,'<b>'.$mapname.'</b>', $post_title); 

i don't output @ all. ideas on doing wrong? when disable str_replace , var_dump variables, correct variables.
i browsed web solutions , str_replace function should working according manuals.

from code provided, $mapname object, not string. need try this: $post_title = str_replace($mapname->name,'<b>'.$mapname->name.'</b>',$post_title);


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -