Jump to content

Recommended Posts

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?

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'];
}
?>

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.