Solved

php if statment to compile a string

Posted on 2009-05-07
2
175 Views
Last Modified: 2012-05-06
$recname = "stk_" . if($row[4]==1){return "a";}else{return "b";} . $row[0];

is there a replacement for "if" if i want to write a statement like this ?
0
Comment
Question by:CMDAI
2 Comments
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 125 total points
ID: 24332921
try:

$recname = "stk_" . (($row[4]==1)?"a":"b") . $row[0];
0
 
LVL 1

Author Comment

by:CMDAI
ID: 24332965
thanks
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now