Does this not work? or am I just doing it wrong? Tried multiple variations of it, and can't seem to find any solid info on the subject. any ideas?
$given_id = 1;
while ($row = mysql_fetch_array($sql))
{
if ($i < 10){
$display = '<a href="' . $row['info'] . '" onMouseOver="' . if($row['type']=="battle"){ . 'showB' . } else { . 'showA'() . "><div class="' . $row['type'] . "_alert" . '" style="float:left; margin-left:-22px;" id="' . $given_id . '"></div></a>';
Concatenate If – in pre-Excel 2019The CONCATENATE Function is available but does not take ranges of cells as inputs or allow array operations and so we are required to use a helper column with an IF Function instead. This formula uses the & character to join two values together.
Concatenate cells if same value with formulas and filter 1. Select a blank cell besides the second column (here we select cell C2), enter formula =IF(A2<>A1,B2,C1 & "," & B2) into the formula bar, and then press the Enter key. 2. Then select cell C2, and drag the Fill Handle down to cells you need to concatenate.
There are two ways to concatenate strings in Java: By + (String concatenation) operator. By concat() method.
if is a self standing statement. It's a like a complete statement. So you can't use it in between concatenetion of strings or so. The better solution is to use the shorthand ternary operatior
(conditional expression)?(ouput if true):(output if false);
This can be used in concatenation of strings also. Example :
$i = 1 ;
$result = 'The given number is'.($i > 1 ? 'greater than one': 'less than one').'. So this is how we cuse ternary inside concatenation of strings';
You can use nested ternary operator also:
$i = 0 ;
$j = 1 ;
$k = 2 ;
$result = 'Greater One is'. $i > $j ? ( $i > $k ? 'i' : 'k' ) : ( $j > $k ? 'j' :'k' ).'.';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With