close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

if statement

Thread began 6/15/2015 1:54 pm by Cameron | Last modified 6/15/2015 8:24 pm by Ray Borduin | 253 views | 4 replies |

Cameron

if statement

I'm having a little trouble with an "if" statement I want to generate text with on an order history page that lies within a repeat region. The repeat region is functioning perfectly, but the variable that my php statement is returning for this if statement is just the first value in my database column. I must have missed something. Help? The if statement I'm talking about is below the <!--order status--> comment.

The code looks like this:

<?php
while(!$rsOrders->atEnd()) {
?>
<tr class="color_dark">
<!--order number-->
<td><a href="order_details.html" class="color_dark"><?php echo($rsOrders->getColumnVal("OrderID")); ?></a></td>
<!--order date-->
<td><em><?php echo($rsOrders->getColumnVal("OrderDate")); ?></em></td>
<!--order status-->
<td><?php if ($row_rsOrders['OrderShipped'] =0){echo "Your order has shipped!" ;} else {echo "Your order is being processed.";} ?></td>
<!--quanity-->
<td><span class="f_size_large fw_medium">$<?php echo number_format_drop_zero_decimals($rsOrders->getColumnVal("OrderAmount"),2); ?></span></td>
</tr>
<?php
$rsOrders->moveNext();
}
$rsOrders->moveFirst(); //return RS to first record
?>

Sign in to reply to this post

Ray BorduinWebAssist

Since you are using MySQLi the statement should be:

if ($rsOrders->getColumnVal("OrderShipped") =0)

Your code is using the old standard recordset syntax

Sign in to reply to this post

Cameron

Thanks for the help. I replaced that syntax and am now receiving this error:

Fatal error: Can't use method return value in write context in C:\xampp\htdocs\....\i_orders_list.php on line 333

Sign in to reply to this post

Ray BorduinWebAssist

Sorry, since it is an if statement you also need a double = like this:

if ($rsOrders->getColumnVal("OrderShipped") == 0)

otherwise you are trying to set the value and not compare it.

Sign in to reply to this post

Cameron

Thanks Ray! It works like a champ now. I appreciate you explaining it as well (double = vs. single =)

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...