I’ve got a database query that gets symbols from a database and if they’re not there adds the word ‘NO’ to the result.
What I want to do is change it so that if it’s not there is adds a value to at column but I can’t work out how to do it.
This is what I’ve got
$query="select * from symbols where visible=1 order by name";
$result=dbselect( $query,"db" );
if( is_array( $result ) ) {
foreach( $result as $key=>$value ) {
$symbols[$value['id']]['name']=$value['name'];
$symbols[$value['id']]['character']=$value['character'];
$symbols[$value['id']]['color']=$value['color'];
$symbols[$value['id']]['image1']=$value['image'];
$symbols[$value['id']]['image2']=$value['image2'];
$symbols[$value['id']]['image']=$value['image2'];
$symbols[$value['id']]['text']="NOT ".$value['name'];
$symbols[$value['id']]['color2']="#4e4e4e"; // This is what I want to add
}
}
$query="select symbols.id from symbols,symbols_map where symbol_id=symbols.id and visible=1 and id=".$id." order by name";
$result=dbselect( $query,"db" );
if( is_array( $result ) ) {
foreach( $result as $key=>$value ) {
$symbols[$value['id']]['image']=$symbols[$value['id']]['image1'];
$symbols[$value['id']]['text']=$symbols[$value['id']]['name'];
$symbols[$value['id']]['color']=$symbols[$value['id']]['corolla']; // This works but the complete other way round - it added the color if it's there instead.
}
}