e1seix Posted January 17, 2009 Share Posted January 17, 2009 I think this is a pretty stupid question, but I have tried to search online for an answer and I'm not quite sure what I'm asking for. I'm talking about the premise of including a sort of configuration page so I can use the same basic template of a product page but change the actual query itself by defining it as a variable. Something along the lines of: $qqq='SELECT * FROM products WHERE forSale='yes' AND inStock='yes' AND sub LIKE '%$sub%' ORDER BY brand,name LIMIT $startrow, $limit'; // START OF RESULTS QUERY $qryResults=mysql_query( $qqq )or die(mysql_error()); while($row = mysql_fetch_array( $qryResults )) { You see? Any help appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/141156-manage-query-externally-by-way-of-a-variable/ Share on other sites More sharing options...
RussellReal Posted January 17, 2009 Share Posted January 17, 2009 I'm assuming you HAVE this template available, your sort of "Product" template.. in which case, you could just do something like <?php // do your mysql query w\e here... if ($row = mysql_fetch_assoc($query)) { // dw about this.. put all the $row['field_names'] where they belong in the template } else { include("error.php"); die(); } ?> <div><?php echo $row['product_name']; ?></div> Quote Link to comment https://forums.phpfreaks.com/topic/141156-manage-query-externally-by-way-of-a-variable/#findComment-738904 Share on other sites More sharing options...
dawsba Posted January 17, 2009 Share Posted January 17, 2009 can you be a bit more detail?? Quote Link to comment https://forums.phpfreaks.com/topic/141156-manage-query-externally-by-way-of-a-variable/#findComment-738917 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.