Solved

php if statment to compile a string

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP Healthcheck 2 85
Php pie charts 3 26
Preventing users manipulating URL strings 10 36
PHP & MySQL - Rounding Results from a Select Query 3 13
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.  …
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

920 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

15 Experts available now in Live!

Get 1:1 Help Now