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

sql statement

Thread began 6/17/2018 10:43 am by Jamie | Last modified 6/19/2018 1:43 pm by Ray Borduin | 99 views | 3 replies |

Jamie

sql statement

Hey Ray

That sql statement that you helped me with on Friday is causing me another problem. Have attached a screenshot of the 3 tables in the relational join.

On the page_contents_update.php page (which is where you select the row(s) associated with that page_content if you select onle one row on one page the row selected shows on every page in the front end rather than the single page selected. The user can select the same row to show on multiple pages, but if it is only selected to go on one page it should not show up on other pages.

Not sure where the statement below needs to be changed?

<?php
$Rows = new WA_MySQLi_RS("Rows",$DBConnection,0);
$Rows->setQuery("SELECT homepage_panels.*, join_rows.*, page_contents.* FROM homepage_panels INNER JOIN join_rows ON homepage_panels.HomepagePanelsID = join_rows.RowsHomepageID INNER JOIN page_contents ON join_rows.RowsHomepageID = page_contents.PageContentsID AND join_rows.RowsHomepageID = page_contents.PageContentsID WHERE homepage_panels.Live AND homepage_panels.Type = 1 ORDER BY homepage_panels.PanelOrder ASC");
$Rows->execute();
?>
Sign in to reply to this post

Ray BorduinWebAssist

It seems like you would need a WHERE clause that filters by the page you are on.... WHERE PageContentsID = ?

Sign in to reply to this post

Jamie

like this?

<?php
$Rows = new WA_MySQLi_RS("Rows",$DBConnection,0);
$Rows->setQuery("SELECT homepage_panels.*, join_rows.*, page_contents.* FROM homepage_panels INNER JOIN join_rows ON homepage_panels.HomepagePanelsID = join_rows.RowsHomepageID INNER JOIN page_contents ON join_rows.RowsHomepageID = page_contents.PageContentsID AND join_rows.RowsHomepageID = page_contents.PageContentsID WHERE page_contents.PageContentsID AND homepage_panels.Live AND homepage_panels.Type = 1 ORDER BY homepage_panels.PanelOrder ASC");
$Rows->bindParam("i", "".($_GET['PageContentsID']) ."", "-1"); //colname
$Rows->execute();
?>



dont think thats working...not sure how to structure it?

Sign in to reply to this post

Ray BorduinWebAssist

WHERE page_contents.PageContentsID = ? AND homepage_panels.Live...

you are missing the " = ? "

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