I am working on adding an if statement to my while loop that is returned from my mysql query.
I have 4 document paths, depending on the category the path is different.
I have been searching Google all day, so far the best I have been able to come up with is using a Ternary which i have put into my code but it keeps throwing an err, and I get a blank white page. I think I must have my quotes wrong or something.
I need to repeat the if statement 4 times but i am trying to get it to work right once first.
Here is my code.
echo "<td><a href=\"".((.$row ['category'].=='Validation_Letter') ? "../../../../Docs/Doc/val_letters/":"")."".$row ['filepath']."\">".$row ['filepath']."</a></td>";
Thanks in advance for any help you can give.
You don’t need the two periods in .$row[‘category’].==’Validation_Letter’
echo “”.$row [‘filepath’].””;
It works like this – ( $val == true ? ‘true’ : ‘false’ )