Jump to content

[SOLVED] Adding text to a variable already defined


twilitegxa

Recommended Posts

How can I add soem text to display to this variable? I currently have an if statement to make the variable diaply as blank if the value is null or zero, but if the variable does contain a value, I want the text "(for Sailor Scout Attack)" to display after the value. Like here is the variable and how I want it to display, I just don't have it added to the variable right:

 

acv2 = $derived_info['acv2'] + '(for Sailor Scout Attack)';

 

Here is the rest of the statement so you can see the if statement:

 

//gather derived values
$get_derived = "select * from derived_values where identity = '$identity'";

$get_derived_res = mysql_query($get_derived, $conn) or die(mysql_error());

while ($derived_info = mysql_fetch_array($get_derived_res)) {
$health = $derived_info['health'];
$energy = $derived_info['energy'];
$acv1 = $derived_info['acv1'];
$acv2 = $derived_info['acv2'];
$dcv1 = $derived_info['dcv1'];
$dcv2 = $derived_info['dcv2'];
$total_cp = $derived_info['total_cp'];

if($health == 0 || $health == '0' || $health == null){$GLOBALS['health'] = "";}
if($energy == 0 || $energy== '0' || $energy == null){$GLOBALS['energy'] = "";}
if($acv1 == 0 || $acv1 == '0' || $acv1 == null){$GLOBALS['acv1'] = "";}
if($acv2 == 0 || $acv2 == '0' || $acv2 == null){$GLOBALS['acv2'] = "";}
if($dcv1 == 0 || $dcv1 == '0' || $dcv1 == null){$GLOBALS['dcv1'] = "";}
if($dcv2 == 0 || $dcv2 == '0' || $dcv2 == null){$GLOBALS['dcv2'] = "";}
if($total_cp == 0 || $total_cp == '0' || $total_cp== null){$GLOBALS['total_cp'] = "";}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.