Incessant-Logic Posted January 14, 2006 Share Posted January 14, 2006 Using DW8, MySQL and PHP: I'm extracting three parts of a recordset. $row_query_fiction['fiction_title'] (story) $row_query_fiction['chapter_no'] (nothing) $row_query_fiction['chapter_title'] (A good start) I want to display the title folloed by the name of the chapter, then if thats empty by the chapter number and if thats empty nothing. <?php if { $row_query_fiction['chapter_title'] == "" { if $row_query_fiction['chapter_no'] == "" {} else {echo ': Chapter ', $row_query_fiction['chapter_no'];} else {echo ': ', $row_query_fiction['chapter_title'];} } ?> Would output: Story: A good start. But all I get is Parse error: parse error, expecting `'('' in D:\http\ilweb-v\fiction.php on line 126 (which is first line) What am I doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/3201-if-value-is-blank-show-this-record-if-thats-blank-show-nothing/ Share on other sites More sharing options...
degsy Posted January 17, 2006 Share Posted January 17, 2006 You seem to be mixed up with your brackets and order of if statements. You could use something like <?php if($row_query_fiction['chapter_title'] != ""){ echo ': ' . $row_query_fiction['chapter_title']; } if($row_query_fiction['chapter_no'] != ""){ echo ': Chapter ' . $row_query_fiction['chapter_no']; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/3201-if-value-is-blank-show-this-record-if-thats-blank-show-nothing/#findComment-10952 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.