close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

mysqli syntax

Thread began 7/25/2014 4:29 am by Jamie | Last modified 7/29/2014 12:48 am by Jamie | 3733 views | 10 replies |

Jamie

mysqli syntax

Hey Jason

Am trying to convert

<?php
$_GET["GalleryContent"] = "gallery_".$row_PageContents['ProductContentsID'];

$colname_Gallery = "-1";
if (isset($_GET['GalleryContent'])) {
$colname_Gallery = $_GET['GalleryContent'];
}
mysql_select_db($database_PowerCMSConnection, $PowerCMSConnection);
$query_Gallery = sprintf("SELECT * FROM gallery WHERE GalleryPage = %s ORDER BY GalleryOrder ASC", GetSQLValueString($colname_Gallery, "text"));
$Gallery = mysql_query($query_Gallery, $PowerCMSConnection) or die(mysql_error());
$row_Gallery = mysql_fetch_assoc($Gallery);
$totalRows_Gallery = mysql_num_rows($Gallery);
?>



into mysqli

So far I have managed to put together

<?php
$Gallery = new WA_MySQLi_RS("Gallery",$DBConnection,1);
$Gallery->setQuery("SELECT * FROM gallery WHERE GalleryPage = ? ORDER BY GalleryOrder ASC");
$Gallery->bindParam("s", "".$_GET['GalleryContent'] ."", "-1"); //colname
$Gallery->execute();
?>



I just dont know how (or where) the mysql line $_GET["GalleryContent"] = "gallery_".$row_PageContents['ProductContentsID']; gets added in the mysqli

cheers

Jamie

Sign in to reply to this post

Jason ByrnesWebAssist

Just like in the old MySQL recordset, that line should be added at the begining, just after the opening php tag.

Sign in to reply to this post

Jamie

thanks Jason

I have put that there but I am getting the error: Notice: Undefined variable: row_PageContents in C:\xampp\htdocs\lestudiom\interiors-results.php on line 12

Have attached the file so you cn see the RS.

Just to give you the overview, in the database, I have 2 tables product_contents and gallery

In the backend, when adding an entry to the product_contents you have the option of adding a gallery that is associated with that entry.

If the gallery is created it takes the ProductContentsID column from product_contents and appends it with "gallery_" and adds it to the column GalleryPage in the gallery table

So in the front end, my pages are interiors.php which displays a list of entries from the product_contents table which link, using mod_rewrite, to the interiors-results.php which displays the gallery images that are associated with the ProductContentsID column from the product_contents table

But on the results page (interiors-results.php) I am getting the above error

I hope that that makes sense.....

Jamie

Sign in to reply to this post

Jason ByrnesWebAssist

try this instead:

$_GET["GalleryContent"] = "gallery_".$PageContents->getColumnVal("ProductContentsID");

Sign in to reply to this post

Jamie

as ever, you da man! thanks that works perfectly

btw, if i were to add image 3 of 10, I can do the of 10 (of <?php echo $Gallery->TotalRows ?>), but how would I do the bit which says which image number it is?

oh and another btw, the query builder is amazing! thanks

Sign in to reply to this post

Jason ByrnesWebAssist

you would need to hand code a counter.

just before the repeat region for the gallery recordset:
<?php $imgCount = 1; ?>

then inside the repeat where you wan to show the count:

<?php
echo("".$imgCount." of ".$Gallery->TotalRows."");
$imgCount++;
?>

Sign in to reply to this post

Jamie

thanks Jason but the problem is that the jquery that I am using to run the slideshow is placing the scrolling nav points that make them outside of the repeat region. Have tried multiple ways of including them within the repeat region but it stops the slideshow from working.

have added the file and below is the script if that helps

<script type="text/javascript">

$(document).ready(function(){
$('.sp').first().addClass('active');
$('.sp').hide();
$('.active').show();

$('#button-next').click(function(){

$('.active').removeClass('active').addClass('oldActive');
if ( $('.oldActive').is(':last-child')) {
$('.sp').first().addClass('active');
}
else{
$('.oldActive').next().addClass('active');
}
$('.oldActive').removeClass('oldActive');
$('.sp').fadeOut();
$('.active').fadeIn();


});

$('#button-previous').click(function(){
$('.active').removeClass('active').addClass('oldActive');
if ( $('.oldActive').is(':first-child')) {
$('.sp').last().addClass('active');
}
else{
$('.oldActive').prev().addClass('active');
}
$('.oldActive').removeClass('oldActive');
$('.sp').fadeOut();
$('.active').fadeIn();
});



});
</script>



cheers

Jamie

Sign in to reply to this post

Jason ByrnesWebAssist

i dont follow, it looks like the gallery repeat region is here:

<?php
while(!$Gallery->atEnd()) {
?>
<div class="sp"> <img src="images/gallery/<?php echo($Gallery->getColumnVal("GalleryImage")); ?>" width="500"> </div>
<?php
$Gallery->moveNext();
}
$Gallery->moveFirst(); //return RS to first record
?>




add the code for counter loop there.

Sign in to reply to this post

Jamie

I am trying to put the counter loop in this portion of code

<div id="nav"></div>
<div id="button-previous" class="buttons" style="cursor: pointer;"><<</div>
<div class="buttons" style="float: left; margin-right:20px;"> of <?php echo $Gallery->TotalRows ?> </div>
<div id="button-next" class="buttons" style="cursor: pointer;">>></div>



I have tried placing that within the recordset but it stops the << and >> from working as navigation points for the slideshow

Sign in to reply to this post

Jason ByrnesWebAssist

To show the image number in the navigation will take custom coding in your gallery javascript

we can help with this in a premiere support appointment:
http://www.webassist.com/premier_request.php

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