Solved

php if statment to compile a string

Posted on 2009-05-07
2
196 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 50

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

777 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