Jump to content

Quick bit of php code needing correcting


runnerjp

Recommended Posts

Your code doesn't make much sense I'm afraid... Something like this?

 

<?php echo '<tr class = "'.(($important == 1) ? 'mainrow1' : 'mainrow'). '">'; ?>

 

Worked great thanks.... its just to change colour of <td> dependant on whats selected in db :) ... thanks !

If you want to expand variables in strings, you need to use double quotes.

 

See this:

$var = "Hello!";
echo 'Single quoted $var';
echo "Double quoted $var"

;

 

and for arrays you need {}

 

$arr = array('Hello!');
echo "Double quoted array {$arr[0]}";

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.