close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

variables in mysql

Thread began 10/24/2019 6:32 pm by nmc381879 | Last modified 10/28/2019 5:28 pm by Ray Borduin | 50 views | 7 replies |

nmc381879

variables in mysql

Ray, thank you in advance.
I have been trying for some time to understand how the testing block for mysql works. I have this simple q:

SELECT COUNT(pil_knotg_info.FID)
FROM pil_knotg_info
WHERE pil_knotg_info.FID = $FID_num LIMIT 1
====================
Now, when I enter FID_num as the variable name in the advanced test section, and then enter 226 (a record id to find) as the default value and also 226 as the run time value , I get the return message "unknown column '$226' in the WHERE clause". I cannot figure what else to enter here. Can you help, as my program which used to work now returns "You have a syntax error in your SQL statement" with no line numbers or any other help. I am trying to check each query one by one to find where the error might be.

Sign in to reply to this post

Ray BorduinWebAssist

You can't add a dollar sign in front of the parameter name in the recordset SQL statement. You also don't need to add the Limit statement, it will be added automatically.

Your SQL statement would be:

SELECT COUNT(pil_knotg_info.FID) AS FIDCount
FROM pil_knotg_info
WHERE pil_knotg_info.FID = FID_num
Sign in to reply to this post

nmc381879

That statement (without the $) works ok in the tester, but it will not run in the live php environment. That requires the $FID_num. The code that WA writes just won't work (at least in my setup).

Sign in to reply to this post

Ray BorduinWebAssist

It should. Can you attach the page with the code I suggested. I can take a look and see why it isn't working. The correct syntax is definitely not using the dollar sign in the parameter name.

Sign in to reply to this post

nmc381879

I have created a "simple" test example of this. (The other one comes from a much larger set of q's, but the principles are the same...).
The code with the $FID_num works in php but not the tester. The code without the $ (ie, FID_num) works in the tester, but NOT in the live php.
Now that I know how it works, I can live with it, as all you have to do is test, but once the test works, do NOT let WA write the code until you have re-inserted the $.
Thanks so much for your help and cosideration. I am so pleased to be using WA again. (I had to switch to Scriptcase some time ago, as you guys did not support mysqli, but now you do.)

Attached Files
simple.php
Sign in to reply to this post

Ray BorduinWebAssist

I see... This is the code you should be using to work with both:

php:
<?php

    $FID_num 
=103;
?>
<?php
$Recordset1 
= new WA_MySQLi_RS("Recordset1",$pil1_i,1);
$Recordset1->setQuery("SELECT pil_shared_data.FID, pil_shared_data.Family_Name FROM pil_shared_data WHERE pil_shared_data.FID = ?");
$Recordset1->bindParam("d""".($FID_num)  ."""-1"); //FID_num
$Recordset1->execute();
?>



Copy and paste that onto your page and then open the Recordset to see how you set up parameters correctly to work in dreamweaver and on the page.

Sign in to reply to this post

nmc381879

Thank you, Ray. I am a total amateur (and don't write code for anyone except our products). I will soon need a programmer to assist with stuff like this. I checked the "community", and I don't need web development, but will soon need a "shadow programmer" to speed things like this up. This is our product page (www.iapsystems.com) .
The code you provided works great, and I will use it as a model for the future.
Too bad the charting modules have been discontinued. Hope they will be back sometime. I would sell them as a separate module, it is worth it.

Sign in to reply to this post

Ray BorduinWebAssist

The old charts were Flash, so they are obsolete. I'd have to integrate a new charting system, but unfortunately the demand isn't high.

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