close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

MySQLi - What are the new methods we need to use?

Thread began 7/03/2014 1:43 pm by Steve | Last modified 7/07/2014 12:02 pm by Jason Byrnes | 1975 views | 12 replies |

Steve

MySQLi - What are the new methods we need to use?

Is there a list or some reference on how to use the new record set values when hand coding?

for instance:

if (isset($rscoupons->getColumnVal("id"))) { 
do something
}



This does not work. So it seems there are a number of things we will need to learn to adapt to the new methods. Are there any examples for a smooth migration?

Sign in to reply to this post

Jason ByrnesWebAssist

what is it you are trying to do with this?

you wouldn't use isset for this with a standard recordset or with mySQLi.

Sign in to reply to this post

Steve

Jason,
just trying to use isset like with any other recordset value. For instance IF there is a value present (existing in a recordset) then do something.


In the actual case I am submitting a coupon code and IF it is valid (value sent to SQL query creating a recordset with the resulting ID) I show a region, if not show other region.

Can we not use isset with MySQLi record sets?

Sign in to reply to this post

Jason ByrnesWebAssist

in this case use the Recordset is empty / is not empty behaviors.

Sign in to reply to this post

Steve

So there is are a number of php functions that don't work with mySQLi recordsets?

I tried this one also (not empty) and it also failed:

<?php
if (!empty($rscoupons->getColumnVal("id"))) {
?>

Please let me know so I don't spend a bunch of time thinking it's my syntax that is off

http://www.php.net/manual/en/function.empty.php
http://www.php.net/manual/en/function.isset.php

Sign in to reply to this post

Jason ByrnesWebAssist

there are server behaviors for this in the MySQLi server behaviors:
WebAssist -> MySQLi -> Show Region

Show Region if Recordset is Empty
Show Region if Recordset is Not Empty

Sign in to reply to this post

Steve

ok, thanks for that, but also people should be aware that there are missing features in the new mySQLi generated record sets when compared to recordsets created in the prior version.

isset and empty can't be applied directly to a recordset variable.

Hopefully WebAssist sorts this in the future as there are many of us that don't just use behaviors but rather appreciate web assist extensions for rapid development / prototyping while still writing our own code for more unique conditions.


As a tip to others that are running into this problem, you can use a recordset value assigned to your own variable.


For instance:

<?php $id = $rscoupons->getColumnVal("id"); ?>


<?php
if (!empty($id)) {
?>

Sign in to reply to this post

Jason ByrnesWebAssist

these aren't missing features, isset and empty shouldn't be used for regular MySQL recordsets either.

There are Corresponding show if behaviors for Is Empty / Is not empty for standard recordsets also.

Sign in to reply to this post

Jason ByrnesWebAssist

you may have been able to get isset and empty to work with standard MySQL recordsets, but that is not the proper way for determining if they are empty or not.

the proper way to determine if a recordset is empty or not is to look at the number of rows returned. if it returns 0:
$RecordsetName->TotalRows == 0

it is empty.

Sign in to reply to this post

Steve

yes, $RecordsetName->TotalRows == 0 makes logical sense for determining if a recordset with values was generated.

But what about recordset values being present or not?

For instance you have 3 recordset values and one of the three not always populates since it's an optional item.

In this case we would use the isset(recordset['name']) to do something if present or something else if not present.

Is there a way to do that with mySQLi record sets without using a behavior? I would expect that we would use the bindings to determine the values name (drag from bindings to generate an echo value) then apply a isset or other php function like empty.

Sign in to reply to this post
loading

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...