Jump to content

sonicthehedgehog

Members
  • Content Count

    50
  • Joined

  • Last visited

Community Reputation

0 Neutral

About sonicthehedgehog

  • Rank
    Newbie

Profile Information

  • Gender
    Female
  1. I wonder if somebody can help me please, I’ve got a website that has been working without any problems for over a year then the other day it stopped. I discovered that my hosts had changed things and the root directory was no longer the same. I updated this and the site is now back but all DB query’s are failing and I don’t know why. If I take the select query and run it direct in PHPMyAdmin then I get results but not he site I don’t so would be grateful for any assistance please. I’m using this to connect: function dbselect( $query,$dblink ) { if( $result=$GLOBALS[$dblink]->query( $query ) ) { while( $row=$result->fetch_array( MYSQLI_ASSOC ) ) { $dbdata[]=$row; } if( !isset( $dbdata ) ) { $dbdata=false; } if( is_object( $result ) ) { $result->close(); } return( $dbdata ); } else { logdberr( $query,'Query failed ('.$GLOBALS[$dblink]->error.')' ); exit(); } } mysqli_close($dbLinkInt); } It fails every time but if I run select * from feeds where product_feed_id=5671 in PHPMyAdmin I get the product I’m after. If it helps the version is 5.5.60-MariaDB Thanks in advance
  2. I've changed the code so that an id is attached to the button too (the id of the button is now set to change_0 (or whatever the number is). I've also added an id the the datacolumn div that is data_0 (or again whatever the number is). Now what I want to do it get the data from the div into the form. The div should now look something like this: <div class="datacolumn" id="data_0"> <div><span>01 01 2016</span></div> <div><span>Jane</span> </div> <div><span>Doe</span> </div> <div><span>j.doe@email.com</span> </div> <div><span>jdoe.com</span> </div> <div><span>USA</span> </div> <span class="button button-accept"> <button type="submit" name="change" value="change" class="change" id="change_0"> Change </button> </span></div> with the js now looking like this: <script type="text/javascript"> $j(document).ready(function($) { $j('body').on('click', '.change', function (e) { var divs = $j(this).parent('.datacolumn').find('span'); console.log(divs); $.each(divs, function (i, v) { $j($('.new_form input')[i]).val($j(v).text()); }); }) ; }) ; </script> but I'm not getting past the console.log(divs) line
  3. I've changed the code to this now: <script type="text/javascript"> $(document).ready(function () { $j('body').on('click', '.datacolumn #change', function (e) { var divs = $j(this).parent('.datacolumn').find('span'); console.log(divs); $.each(divs, function (i, v) { console.log("AA"); $j($('.new_form input')[i]).val($j(v).text()); }); }) ; }); </script> Which gives me this in the console: but it doesn't go any futher than that and I'm not sure why or how to fix it. Thanks for helping with this.
  4. I changed the open divs, but it's still not working. I've attached the code below with comments to if that helps <script type="text/javascript"> $(document).ready(function () { $('#change').on("click", function () { // I can't change the class of the button so have put it is a span with an id called change var divs = $(this).parent(".datacolumn").find("span"); // This is the class of the div containing all of the divs and spans $.each(divs, function (i, v) { $($(".new_form input:text")[i]).val($(v).text()); var allInputs = $( ":input" ); var formChildren = $( ".new_form input:text" ); // I changed this because the form is actually huge and there's around 50 inputs but I only want to change the ones within the new_form class div }); }); }); </script>
  5. Thanks, that's really helpful. I've already got the details in the database and am loading them onto the page but the problem Ive got is allowing people to edit them again if they want. This is the html that I've got <div id="data" class="data"> <div class="new_form"> <div style="width: 175px;">Date of Birth</div><input class="text" type="text" name="date" id="date" value=""> <div id="form"> <div> <div style="width: 175px;">First Name </div> <input class="text" type="text" name="firstname" id="firstname" value=""></div> <div> <div style="width: 175px;">Last Name </div> <input class="text" type="text" name="lastname" id="lastname" value=""></div> <input class="text" type="hidden" name="gender" id="gender" value="-"> <div> <div style="width: 175px;">Email </div> <input class="text" type="text" name="email" id="email" value=""></div> </div> <div style="width: 175px;">Website </div> <input class="text" type="text" name="website" id="website" value=""></div> </div> <div style="width: 175px;">Country </div> <input class="text" type="text" name="country" id="country" value=""></div> </div> </div> <div id="results" style="width:10000px;"> <div class="datacolumn"> <div><span>01 01 2016</span> dob</div> <div><span>Jane</span></div> <div><span>Doe</span></div> <div><span>j.doe@email.com</span></div> <div><span>jdoe.com</span></div> <div><span>USA</span></div> <button id="change" class="button button-accept">change</button> </div> <div class="datacolumn"> <div><span>01 01 2016</span> dob</div> <div><span>Joe</span></div> <div><span>Bloggs</span></div> <div><span>j.bloggs@email.com</span></div> <div><span>jbloggs.com</span></div> <div><span>UK</span></div> <button id="change" class="button button-accept">change</button> </div> <div class="datacolumn"> <div><span>01 01 2016</span> dob</div> <div><span>Jane</span></div> <div><span>Doe</span></div> <div><span>j.doe@email.com</span></div> <div><span>jdoe.com</span></div> <div><span>USA</span></div> <button id="change" class="button button-accept">change</button> </div> <div class="datacolumn"> <div><span>01 01 2016</span> dob</div> <div><span>Joe</span></div> <div><span>Bloggs</span></div> <div><span>j.bloggs@email.com</span></div> <div><span>jbloggs.com</span></div> <div><span>UK</span></div> <button id="change" class="button button-accept">change</button> </div> </div> </div> and here's the js: <script type="text/javascript"> $(document).ready(function () { $('#change').on("click", function () { var divs = $(this).parents("div").find("span"); $.each(divs, function (i, v) { $($(".new_form input")[i]).val($(v).text()); }); }); }); </script> but it's not working at all. I don't get any errors either
  6. I wonder if somebody could help me please. I've got a page that displays results from a database but I want people to be able to edit them. At the moment I've got an edit button but that's doing nothing. What I'd like is to be able to put the results from the row somebody is trying to change back into the form. Is that possible and how would I go about doing it? I've attached an image of what I'm trying to do to hopefully help. Thanks in advance.
  7. The form id is #filter_form but if I change it to that then nothing happened at all and the form doesn't even submit
  8. I've now managed to get it to load the new page within the div but it's not loading the results. It just says that the query was empty so for whatever reason the post details aren't being to the page that gets the results. Any thoughts as to why?
  9. I'm trying to get a form the submit and get the results from a database without the page reloading. I've got a form and want the results to update whenever somebody clicks on a checkbox or button. The form works and gets the right results but only if the page loads. This is the code I'm using: $('.filter_link').on('click', function(e) { e.preventDefault // prevent form submission $.ajax({ url:'/results/index.php', data: $(this).serialize(), // serialize form data and attach to request type:'POST', success:function(results) { $(".result").html(results); } });}); I don't get any errors at all and nothing happens. The form also has the /results/index.php as the action too and filter_link is the class id for the checkboxes and buttons. I've also got a div in the page with the class 'result'
  10. Oh okay I see what you're saying. So something like a table that will store the info then delete it after say a day?
  11. Sorry I don't understand what you mean? I can't get YouTube at work. Unfortunately the database was already set up so I can't change the structure of it
  12. I didn't know about INNER JOIN before. I've had a read of it and have change the code to this: $sql_from = " FROM feeds INNER JOIN product_categories_map on product_categories_map.product_id = feeds.product_feed_id INNER JOIN type on type.product_id = feeds.product_feed_id INNER JOIN source on source.product_id = feeds.product_feed_id INNER JOIN sweeteners on sweeteners.product_id = feeds.product_feed_id INNER JOIN flavour on flavour.product_id = feeds.product_feed_id INNER JOIN ingredients on ingredients.product_id = feeds.product_feed_id INNER JOIN dietary on dietary.product_id = feeds.product_feed_id INNER JOIN shipping on shipping.product_id = feeds.product_feed_id INNER JOIN merchant on merchant.product_id = feeds.product_feed_id WHERE feeds.enabled=1 and feeds.stock=1 and feeds.deleted=0 and feeds.brand_name=shipping.merchant and shipping.country_id=".dbstr( $_POST['country'] )." AND ( product_feed_id != 1 "; Does that then mean I can get rid of this line then $sql_end .= " AND feeds.product_feed_id = product_categories_map.product_id ";
  13. I've just been told that a query is too long and doesn't end but I don't understand what that means or how to rectify it? This is the query I'm using (which I do admit is a large query but I need to get all of the info in it) $sql_select = "SELECT * "; $sql_from = " FROM feeds, product_categories_map, type, source, sweeteners, flavour, ingredients, dietary, shipping, merchant WHERE feeds.enabled=1 and feeds.stock=1 and feeds.deleted=0 and feeds.brand_name=shipping.merchant and shipping.country_id=".dbstr( $_POST['country'] )." AND ( product_feed_id != 1 ";$sql_group = " GROUP BY feeds.product_name";$order=$_POST['order'];if ($_POST['order']<>""){ $sql_orderby = " ORDER BY feeds.$order ASC"; } else {$sql_orderby = " ORDER BY feeds.product_name DESC";}//$sql_orderby = " ORDER BY feeds.price ASC";if ($_POST['muscle']<>""){ $sql_where .= " OR category_id=1 "; } if ($_POST['performance']<>""){ $sql_where .= " OR category_id=2 "; } if ($_POST['diet']<>""){ $sql_where .= " OR category_id=3 "; } if ($_POST['lean']<>""){ $sql_where .= " OR category_id=4 "; } if ($_POST['energy']<>""){ $sql_where .= " OR category_id=5 "; } if ($_POST['health']<>""){ $sql_where .= " OR category_id=6 "; } if ($_POST['type_1']<>""){ $sql_where .= " OR type_id=1 "; } if ($_POST['type_2']<>""){ $sql_where .= " OR type_id=2 "; } if ($_POST['type_3']<>""){ $sql_where .= " OR type_id=3 "; } if ($_POST['type_4']<>""){ $sql_where .= " OR type_id=4 "; } if ($_POST['type_5']<>""){ $sql_where .= " OR type_id=5 "; } if ($_POST['type_6']<>""){ $sql_where .= " OR type_id=6 "; } if ($_POST['type_7']<>""){ $sql_where .= " OR type_id=7 "; } if ($_POST['type_8']<>""){ $sql_where .= " OR type_id=8 "; } if ($_POST['type_9']<>""){ $sql_where .= " OR type_id=9 "; } if ($_POST['type_10']<>""){ $sql_where .= " OR type_id=10 "; } if ($_POST['type_11']<>""){ $sql_where .= " OR type_id=11 "; } if ($_POST['type_12']<>""){ $sql_where .= " OR type_id=12 "; } if ($_POST['type_13']<>""){ $sql_where .= " OR type_id=13 "; } if ($_POST['type_14']<>""){ $sql_where .= " OR type_id=14 "; } if ($_POST['type_15']<>""){ $sql_where .= " OR type_id=15 "; } if ($_POST['type_16']<>""){ $sql_where .= " OR type_id=16 "; } if ($_POST['type_17']<>""){ $sql_where .= " OR type_id=17 "; } if ($_POST['type_18']<>""){ $sql_where .= " OR type_id=18 "; } if ($_POST['type_19']<>""){ $sql_where .= " OR type_id=19 "; } if ($_POST['type_20']<>""){ $sql_where .= " OR type_id=20 "; } if ($_POST['source_1']<>""){ $sql_where .= " OR source_id=1 "; } if ($_POST['source_2']<>""){ $sql_where .= " OR source_id=2 "; } if ($_POST['source_3']<>""){ $sql_where .= " OR source_id=3 "; } if ($_POST['source_4']<>""){ $sql_where .= " OR source_id=4 "; } if ($_POST['source_5']<>""){ $sql_where .= " OR source_id=5 "; } if ($_POST['source_6']<>""){ $sql_where .= " OR source_id=6 "; } if ($_POST['source_7']<>""){ $sql_where .= " OR source_id=7 "; } if ($_POST['source_8']<>""){ $sql_where .= " OR source_id=8 "; } if ($_POST['source_9']<>""){ $sql_where .= " OR source_id=9 "; } if ($_POST['source_10']<>""){ $sql_where .= " OR source_id=10 "; } if ($_POST['source_11']<>""){ $sql_where .= " OR source_id=11 "; } if ($_POST['source_12']<>""){ $sql_where .= " OR source_id=12 "; } if ($_POST['source_13']<>""){ $sql_where .= " OR source_id=13 "; } if ($_POST['source_14']<>""){ $sql_where .= " OR source_id=14 "; } if ($_POST['source_15']<>""){ $sql_where .= " OR source_id=15 "; } if ($_POST['source_16']<>""){ $sql_where .= " OR source_id=16 "; } if ($_POST['source_17']<>""){ $sql_where .= " OR source_id=17 "; } if ($_POST['source_18']<>""){ $sql_where .= " OR source_id=18 "; } if ($_POST['source_19']<>""){ $sql_where .= " OR source_id=19 "; } if ($_POST['source_20']<>""){ $sql_where .= " OR source_id=20 "; } if ($_POST['sweeteners_1']<>""){ $sql_where .= " OR sweeteners_id=1 "; } if ($_POST['sweeteners_2']<>""){ $sql_where .= " OR sweeteners_id=2 "; } if ($_POST['sweeteners_3']<>""){ $sql_where .= " OR sweeteners_id=3 "; } if ($_POST['sweeteners_4']<>""){ $sql_where .= " OR sweeteners_id=4 "; } if ($_POST['sweeteners_5']<>""){ $sql_where .= " OR sweeteners_id=5 "; } if ($_POST['sweeteners_6']<>""){ $sql_where .= " OR sweeteners_id=6 "; } if ($_POST['sweeteners_7']<>""){ $sql_where .= " OR sweeteners_id=7 "; } if ($_POST['sweeteners_8']<>""){ $sql_where .= " OR sweeteners_id=8 "; } if ($_POST['sweeteners_9']<>""){ $sql_where .= " OR sweeteners_id=9 "; } if ($_POST['sweeteners_10']<>""){ $sql_where .= " OR sweeteners_id=10 "; } if ($_POST['sweeteners_11']<>""){ $sql_where .= " OR sweeteners_id=11 "; } if ($_POST['sweeteners_12']<>""){ $sql_where .= " OR sweeteners_id=12 "; } if ($_POST['sweeteners_13']<>""){ $sql_where .= " OR sweeteners_id=13 "; } if ($_POST['sweeteners_14']<>""){ $sql_where .= " OR sweeteners_id=14 "; } if ($_POST['sweeteners_15']<>""){ $sql_where .= " OR sweeteners_id=15 "; } if ($_POST['sweeteners_16']<>""){ $sql_where .= " OR sweeteners_id=16 "; } if ($_POST['sweeteners_17']<>""){ $sql_where .= " OR sweeteners_id=17 "; } if ($_POST['sweeteners_18']<>""){ $sql_where .= " OR sweeteners_id=18 "; } if ($_POST['sweeteners_19']<>""){ $sql_where .= " OR sweeteners_id=19 "; } if ($_POST['sweeteners_20']<>""){ $sql_where .= " OR sweeteners_id=20 "; } if ($_POST['flavour_1']<>""){ $sql_where .= " OR flavour_id=1 "; } if ($_POST['flavour_2']<>""){ $sql_where .= " OR flavour_id=2 "; } if ($_POST['flavour_3']<>""){ $sql_where .= " OR flavour_id=3 "; } if ($_POST['flavour_4']<>""){ $sql_where .= " OR flavour_id=4 "; } if ($_POST['flavour_5']<>""){ $sql_where .= " OR flavour_id=5 "; } if ($_POST['flavour_6']<>""){ $sql_where .= " OR flavour_id=6 "; } if ($_POST['flavour_7']<>""){ $sql_where .= " OR flavour_id=7 "; } if ($_POST['flavour_8']<>""){ $sql_where .= " OR flavour_id=8 "; } if ($_POST['flavour_9']<>""){ $sql_where .= " OR flavour_id=9 "; } if ($_POST['flavour_10']<>""){ $sql_where .= " OR flavour_id=10 "; } if ($_POST['flavour_11']<>""){ $sql_where .= " OR flavour_id=11 "; } if ($_POST['flavour_12']<>""){ $sql_where .= " OR flavour_id=12 "; } if ($_POST['flavour_13']<>""){ $sql_where .= " OR flavour_id=13 "; } if ($_POST['flavour_14']<>""){ $sql_where .= " OR flavour_id=14 "; } if ($_POST['flavour_15']<>""){ $sql_where .= " OR flavour_id=15 "; } if ($_POST['flavour_16']<>""){ $sql_where .= " OR flavour_id=16 "; } if ($_POST['flavour_17']<>""){ $sql_where .= " OR flavour_id=17 "; } if ($_POST['flavour_18']<>""){ $sql_where .= " OR flavour_id=18 "; } if ($_POST['flavour_19']<>""){ $sql_where .= " OR flavour_id=19 "; } if ($_POST['flavour_20']<>""){ $sql_where .= " OR flavour_id=20 "; } if ($_POST['ingredients_1']<>""){ $sql_where .= " OR ingredients_id=1 "; } if ($_POST['ingredients_2']<>""){ $sql_where .= " OR ingredients_id=2 "; } if ($_POST['ingredients_3']<>""){ $sql_where .= " OR ingredients_id=3 "; } if ($_POST['ingredients_4']<>""){ $sql_where .= " OR ingredients_id=4 "; } if ($_POST['ingredients_5']<>""){ $sql_where .= " OR ingredients_id=5 "; } if ($_POST['ingredients_6']<>""){ $sql_where .= " OR ingredients_id=6 "; } if ($_POST['ingredients_7']<>""){ $sql_where .= " OR ingredients_id=7 "; } if ($_POST['ingredients_8']<>""){ $sql_where .= " OR ingredients_id=8 "; } if ($_POST['ingredients_9']<>""){ $sql_where .= " OR ingredients_id=9 "; } if ($_POST['ingredients_10']<>""){ $sql_where .= " OR ingredients_id=10 "; } if ($_POST['ingredients_11']<>""){ $sql_where .= " OR ingredients_id=11 "; } if ($_POST['ingredients_12']<>""){ $sql_where .= " OR ingredients_id=12 "; } if ($_POST['ingredients_13']<>""){ $sql_where .= " OR ingredients_id=13 "; } if ($_POST['ingredients_14']<>""){ $sql_where .= " OR ingredients_id=14 "; } if ($_POST['ingredients_15']<>""){ $sql_where .= " OR ingredients_id=15 "; } if ($_POST['ingredients_16']<>""){ $sql_where .= " OR ingredients_id=16 "; } if ($_POST['ingredients_17']<>""){ $sql_where .= " OR ingredients_id=17 "; } if ($_POST['ingredients_18']<>""){ $sql_where .= " OR ingredients_id=18 "; } if ($_POST['ingredients_19']<>""){ $sql_where .= " OR ingredients_id=19 "; } if ($_POST['ingredients_20']<>""){ $sql_where .= " OR ingredients_id=20 "; } if ($_POST['dietary_1']<>""){ $sql_where .= " OR dietary_id=1 "; } if ($_POST['dietary_2']<>""){ $sql_where .= " OR dietary_id=2 "; } if ($_POST['dietary_3']<>""){ $sql_where .= " OR dietary_id=3 "; } if ($_POST['dietary_4']<>""){ $sql_where .= " OR dietary_id=4 "; } if ($_POST['dietary_5']<>""){ $sql_where .= " OR dietary_id=5 "; } if ($_POST['dietary_6']<>""){ $sql_where .= " OR dietary_id=6 "; } if ($_POST['dietary_7']<>""){ $sql_where .= " OR dietary_id=7 "; } if ($_POST['dietary_8']<>""){ $sql_where .= " OR dietary_id=8 "; } if ($_POST['dietary_9']<>""){ $sql_where .= " OR dietary_id=9 "; } if ($_POST['dietary_10']<>""){ $sql_where .= " OR dietary_id=10 "; } if ($_POST['dietary_11']<>""){ $sql_where .= " OR dietary_id=11 "; } if ($_POST['dietary_12']<>""){ $sql_where .= " OR dietary_id=12 "; } if ($_POST['dietary_13']<>""){ $sql_where .= " OR dietary_id=13 "; } if ($_POST['dietary_14']<>""){ $sql_where .= " OR dietary_id=14 "; } if ($_POST['dietary_15']<>""){ $sql_where .= " OR dietary_id=15 "; } if ($_POST['dietary_16']<>""){ $sql_where .= " OR dietary_id=16 "; } if ($_POST['dietary_17']<>""){ $sql_where .= " OR dietary_id=17 "; } if ($_POST['dietary_18']<>""){ $sql_where .= " OR dietary_id=18 "; } if ($_POST['dietary_19']<>""){ $sql_where .= " OR dietary_id=19 "; } if ($_POST['dietary_20']<>""){ $sql_where .= " OR dietary_id=20 "; } $sql_where .= ") ";if ($_POST['muscle']<>"" || $_POST['performance']<>"" || $_POST['diet']<>"" || $_POST['lean']<>"" || $_POST['energy']<>"" || $_POST['health']<>""){$sql_end .= " AND feeds.product_feed_id = product_categories_map.product_id "; } if ($_POST['type_2']<>"" || $_POST['type_3']<>"" || $_POST['type_4']<>"" || $_POST['type_5']<>"" || $_POST['type_6']<>"" || $_POST['type_7']<>"" || $_POST['type_8']<>"" || $_POST['type_9']<>"" || $_POST['type_10']<>"" || $_POST['type_11']<>"" || $_POST['type_12']<>"" || $_POST['type_13']<>"" || $_POST['type_14']<>"" || $_POST['type_15']<>"" || $_POST['type_16']<>"" || $_POST['type_17']<>"" || $_POST['type_18']<>"" || $_POST['type_19']<>"" || $_POST['type_20']<>""){$sql_end .= " AND feeds.product_feed_id = type.product_id "; } if ($_POST['source_1']<>"" || $_POST['source_2']<>"" || $_POST['source_3']<>"" || $_POST['source_4']<>"" || $_POST['source_5']<>"" || $_POST['source_6']<>"" || $_POST['source_7']<>"" || $_POST['source_8']<>"" || $_POST['source_9']<>"" || $_POST['source_10']<>"" || $_POST['source_11']<>"" || $_POST['source_12']<>"" || $_POST['source_13']<>"" || $_POST['source_14']<>"" || $_POST['source_15']<>"" || $_POST['source_16']<>"" || $_POST['source_17']<>"" || $_POST['source_18']<>"" || $_POST['source_19']<>"" || $_POST['source_20']<>""){ $sql_end .= " AND feeds.product_feed_id = source.product_id "; } if ($_POST['sweeteners_1']<>"" || $_POST['sweeteners_2']<>"" || $_POST['sweeteners_3']<>"" || $_POST['sweeteners_4']<>"" || $_POST['sweeteners_5']<>"" || $_POST['sweeteners_6']<>"" || $_POST['sweeteners_7']<>"" || $_POST['sweeteners_8']<>"" || $_POST['sweeteners_9']<>"" || $_POST['sweeteners_10']<>"" || $_POST['sweeteners_11']<>"" || $_POST['sweeteners_12']<>"" || $_POST['sweeteners_13']<>"" || $_POST['sweeteners_14']<>"" || $_POST['sweeteners_15']<>"" || $_POST['sweeteners_16']<>"" || $_POST['sweeteners_17']<>"" || $_POST['sweeteners_18']<>"" || $_POST['sweeteners_19']<>"" || $_POST['sweeteners_20']<>""){ $sql_end .= " AND feeds.product_feed_id = sweeteners.product_id "; } if ($_POST['flavour_1']<>"" || $_POST['flavour_2']<>"" || $_POST['flavour_3']<>"" || $_POST['flavour_4']<>"" || $_POST['flavour_5']<>"" || $_POST['flavour_6']<>"" || $_POST['flavour_7']<>"" || $_POST['flavour_8']<>"" || $_POST['flavour_9']<>"" || $_POST['flavour_10']<>"" || $_POST['flavour_11']<>"" || $_POST['flavour_12']<>"" || $_POST['flavour_13']<>"" || $_POST['flavour_14']<>"" || $_POST['flavour_15']<>"" || $_POST['flavour_16']<>"" || $_POST['flavour_17']<>"" || $_POST['flavour_18']<>"" || $_POST['flavour_19']<>"" || $_POST['flavour_20']<>""){ $sql_end .= " AND feeds.product_feed_id = flavour.product_id "; } if ($_POST['ingredients_1']<>"" || $_POST['ingredients_2']<>"" || $_POST['ingredients_3']<>"" || $_POST['ingredients_4']<>"" || $_POST['ingredients_5']<>"" || $_POST['ingredients_6']<>"" || $_POST['ingredients_7']<>"" || $_POST['ingredients_8']<>"" || $_POST['ingredients_9']<>"" || $_POST['ingredients_10']<>"" || $_POST['ingredients_11']<>"" || $_POST['ingredients_12']<>"" || $_POST['ingredients_13']<>"" || $_POST['ingredients_14']<>"" || $_POST['ingredients_15']<>"" || $_POST['ingredients_16']<>"" || $_POST['ingredients_17']<>"" || $_POST['ingredients_18']<>"" || $_POST['ingredients_19']<>"" || $_POST['ingredients_20']<>""){ $sql_end .= " AND feeds.product_feed_id = ingredients.product_id "; } if ($_POST['dietary_1']<>"" || $_POST['dietary_2']<>"" || $_POST['dietary_3']<>"" || $_POST['dietary_4']<>"" || $_POST['dietary_5']<>"" || $_POST['dietary_6']<>"" || $_POST['dietary_7']<>"" || $_POST['dietary_8']<>"" || $_POST['dietary_9']<>"" || $_POST['dietary_10']<>"" || $_POST['dietary_11']<>"" || $_POST['dietary_12']<>"" || $_POST['dietary_13']<>"" || $_POST['dietary_14']<>"" || $_POST['dietary_15']<>"" || $_POST['dietary_16']<>"" || $_POST['dietary_17']<>"" || $_POST['dietary_18']<>"" || $_POST['dietary_19']<>"" || $_POST['dietary_20']<>""){ $sql_end .= " AND feeds.product_feed_id = dietary.product_id ";}$query=$sql_select . $sql_from . $sql_where . $sql_end . $sql_group . $sql_orderby; $product_results=dbselect( $query,"dbLinkInt" );
  14. You're right I only want some values to be set sometimes but others always. The trouble is there are around 75 different values that can be set as well as different combinations of those. So am I right in thinking that if I want some values to be set all of the time I keep them out of the brackets but if they may be part of the query then I add them to the bracket? Like this: show = 1 AND deleted = 0 AND ( id = 1 OR id = 2 OR id = 3 ) AND name != ''
  15. I want it to always have WHERE (show=1 AND deleted=0) but have the 'OR's to so I want the results to be: show = 1, deleted = 0, id = 1 show = 1, deleted = 0, id = 1 or show = 1, deleted = 0, id = 2 show = 1, deleted = 0, id = 2 etc
×
×
  • Create New...