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

recordset conversion issue

Thread began 5/26/2018 8:12 am by Jamie | Last modified 5/29/2018 9:04 am by Ray Borduin | 72 views | 2 replies |

Jamie

recordset conversion issue

Hey Ray

Am trying to convert a mysql recordset to mysqli and am getting this error:

SELECT optiongroups.*, group_concat(OptionName) AS options FROM optiongroups Left Outer Join options ON options.OptionGroupID = optiongroups.OptionGroupID WHERE OptionProductID = %s GROUP BY optiongroups.OptionGroupID

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s GROUP BY optiongroups.OptionGroupID LIMIT 0,1000' at line 1



The recordset I am converting i

<?php
$maxRows_WADAoptiongroups = 1000;
$pageNum_WADAoptiongroups = 0;
if (isset($_GET['pageNum_WADAoptiongroups'])) {
$pageNum_WADAoptiongroups = $_GET['pageNum_WADAoptiongroups'];
}
$startRow_WADAoptiongroups = $pageNum_WADAoptiongroups * $maxRows_WADAoptiongroups;

$colname_WADAoptiongroups = "-1";
if (isset($_GET['ProductID'])) {
$colname_WADAoptiongroups = $_GET['ProductID'];
}
mysql_select_db($database_PowerCMSConnection, $PowerCMSConnection);
$query_WADAoptiongroups = sprintf("SELECT optiongroups.*, group_concat(OptionName) AS options FROM optiongroups Left Outer Join options ON options.OptionGroupID = optiongroups.OptionGroupID WHERE OptionProductID = %s GROUP BY optiongroups.OptionGroupID", GetSQLValueString($colname_WADAoptiongroups, "int"));
setQueryBuilderSource($query_WADAoptiongroups,$WADbSearch1,false);
$query_limit_WADAoptiongroups = sprintf("%s LIMIT %d, %d", $query_WADAoptiongroups, $startRow_WADAoptiongroups, $maxRows_WADAoptiongroups);
$WADAoptiongroups = mysql_query($query_limit_WADAoptiongroups, $PowerCMSConnection) or die(mysql_error());
$row_WADAoptiongroups = mysql_fetch_assoc($WADAoptiongroups);

if (isset($_GET['totalRows_WADAoptiongroups'])) {
$totalRows_WADAoptiongroups = $_GET['totalRows_WADAoptiongroups'];
} else {
$all_WADAoptiongroups = mysql_query($query_WADAoptiongroups, $PowerCMSConnection);
$totalRows_WADAoptiongroups = mysql_num_rows($all_WADAoptiongroups);
}
$totalPages_WADAoptiongroups = ceil($totalRows_WADAoptiongroups/$maxRows_WADAoptiongroups)-1;
?>



and the one that is being converted into is this

<?php
$WADAoptiongroups = new WA_MySQLi_RS("WADAoptiongroups",$DBConnection,1000);
$WADAoptiongroups->setQuery("SELECT optiongroups.*, group_concat(OptionName) AS options FROM optiongroups Left Outer Join options ON options.OptionGroupID = optiongroups.OptionGroupID WHERE OptionProductID = %s GROUP BY optiongroups.OptionGroupID");
$WADAoptiongroups->bindParam("i", "".($_GET['ProductID']) ."", "-1"); //colname
$WADAoptiongroups->execute();
?>
Sign in to reply to this post

Ray BorduinWebAssist

The %s should have been changed to ?. Just update it manually in the code and it should fix the problem.

Sign in to reply to this post

Jamie

got it thanks Ray

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