Jump to content

scottybwoy

Members
  • Posts

    532
  • Joined

  • Last visited

    Never

Everything posted by scottybwoy

  1. Thanks for your help. Yeah trim() isn't quite what I was looking for. I had done debugging first which is why I couldn't find the error. My problem was that I was using someone else's script and it was working on the wrong data. lol. Is sorted now, thanks
  2. Hi I want to check if a specific character is at the begginign and end of some string data, then if it exists, chop it off. This is what I have, but it doesn't work. P.S. is there a simpler way to do it : $f_char = substr($products_description, 0, 1); $l_char = substr($products_description, -1); if (($f_char == '"') && ($l_char == '"')) { echo "cleaning description"; $len = strlen($products_description); $products_description = substr($products_description, 1, $len -1); }
  3. Underneath $headers = "From: $from\r\n"; add : $headers .= "Reply-To: " . HtmlSpecialChars( $HTTP_POST_VARS[ "Reply_name" ]. " <" . HtmlSpecialChars( $HTTP_POST_VARS[ "Reply_addres" ] ) . ">\r\n"; Change your POST_VARS to the correct $vars_names your using
  4. Hello you helpful lot, I saw this framework tutorial a while back but never gave it time. It looks like a really good place to start, but I wanted this to be my second php5 project, possibly first php6. Firstly does anybody know a similar tutorial using php5/6. Secondly I didn't want to use PEAR but make my own slimline database abstraction layer. I don't mind using this one as a tutorial but I'm having trouble converting PEAR::DB into mysqli::db. I have created a file mysqli.php with a class named db that has a constructor that connects to the database and looks like this : class db extends SystemBase { function db() { $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT); return $mysqli; } } I have edited the general function &db_connect() to look like this: function &db_connect() { require_once 'mysqli.php'; new db; return $db; } I think it is working as it poses no errors, and I just wanted to know if I'm going the right way about it? Any ideas/views from someone a bit more experienced?
  5. Thanks, I solved it. There was an unsuspecting table that was getting in the way. Don't know how I missed it. Thanks for your time.
  6. What do you mean coding in IE2 and 3? I have amended the screen shot. I highlighted the Div in Red. Where I have drawn the pinkish line is where the div should go. It works fine in IE6 & 7, but not in FF3. As you can see from the source code the div does indeed contain the other elements, so why does it present it different on the screen? Is this a FF Bug?
  7. Ok if this still doesn't make sense (cos it doesn't to me) Here is the source for this specific part <form name="filter" action="http://www.localhost.com/klickshopping/express-512mb-c-43_44_49.html?sort=4a&search_in_description=1&max_pages=20&filter_id=35&keywords=Redifine%20your%20results&pto=Price%20To&pfrom=Price%20From" method="get"> <div class="filterlist"> <label for="pfrom" class="fieldKey">Price Range :</label> <input id="pfQry" name="pfrom" value="Price From:" class="fieldValue" style="width:5em" /> - <input id="ptQry" name="pto" value="Price To:" class="fieldValue" style="width:5em" /> <input id="subQuery" type='text' name='keywords' value="Redifine your results" class='fieldValue' style='width:42%; border:1px solid #3f547f;'> <input type="image" src="includes/languages/english/images/buttons/button_search.gif" alt="Search" title=" Search " name="subsearch" /><input type="hidden" name="search_in_description" value="1" /><input type="hidden" name="cPath" value="43_44_49" /><input type="hidden" name="sort" value="4a" /><select name="filter_id" onchange="this.form.submit()"><option value="">All Manufacturers</option><option value="31">Asus</option><option value="27">ATi</option><option value="44">BFG Tech</option><option value="32">Club-3D</option><option value="33">Gigabyte</option><option value="37">Inno 3D</option><option value="34">MSI</option><option value="35" SELECTED>NVidia</option><option value="28">PNY Technologies</option><option value="45">Point Of View</option><option value="39">Sapphire Technologies</option><option value="41">XFX Graphics</option></select> <input type="text" size="2" name="max_pages" value="20"> <input class="submit" type="submit" value="GO"> </div> </form> Here's the link to the screen shot
  8. Thats great, cheers for that. I got the latest from the jQuery site, and will look into other fancy things it can do.
  9. Yo, I have found some strange behaviour in FF3 with a div that contains some input fields (I replaced it with a fieldset and it made no difference), it breaks after a few fields without any irregular code beforehand, so some input fields fall outside the div in FF3, but in IE2 & 3 it works as it should. Strange thing is in Firebug source code it does close the div prematurely but in all other source code in IE or even generated source code in firebug it shows the close div element in the correct position. Any ideas why this happens? Here's some code : // The css .filterlist { display: inline-block; margin: 4px 0; padding: 4px; border: 1px solid #d5d5d5; font-family: Tahoma, Helvetica, Arial, sans-serif; font-size: 0.9em; } // the php / html <form name="filter" action="<?php echo tep_href_link(basename($PHP_SELF),tep_get_all_get_params(array('page', 'info', 'x', 'y', 'manufacturers_id'))); ?>" method="get"> <div class="filterlist"> <label for="pfrom" class="fieldKey"><?php echo PRICE_RANGE; ?></label> <?php echo tep_draw_input_field('pfrom', ENTRY_PRICE_FROM, 'class="fieldValue" style="width:5em"') . ' - ' . tep_draw_input_field('pto', ENTRY_PRICE_TO, 'class="fieldValue" style="width:5em"') ?> <input id="subQuery" type='text' name='keywords' value="<?php echo REDIFINE_RESULTS; ?>" class='fieldValue' style='width:42%; border:1px solid #3f547f;'> <?php echo tep_image_submit('button_search.gif', IMAGE_BUTTON_SEARCH, 'name="subsearch"') . tep_draw_hidden_field('search_in_description', '1'); // optional Product List Filter if (PRODUCT_LIST_FILTER > 0) { if (isset($HTTP_GET_VARS['manufacturers_id'])) { $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name"; } else { $filterlist_sql = "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name"; } $filterlist_query = tep_db_query($filterlist_sql); if (tep_db_num_rows($filterlist_query) > 1) { if (isset($HTTP_GET_VARS['manufacturers_id'])) { echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']); $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)); } else { echo tep_draw_hidden_field('cPath', $cPath); $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS)); } echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']); while ($filterlist = tep_db_fetch_array($filterlist_query)) { $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']); } echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"'); } } ?> <input type="text" size="2" name="max_pages" value="<?php echo $hold_max_pages; ?>"> <?php echo tep_hide_session_id(); ?> <input class="submit" type="submit" value="GO"> </div> </form>
  10. OK, just sometimes it is hard to tell when you have an issue that may be down to either how a browser presents html elements or how it processes css. For instance my problem was I have a div that contains some input fields, and it breaks in half and some input fields fall outside the div in FF3, but in IE it works as it should. Strange thing is in Firebug source code it does close the div prematurely but in all other source code in IE or even generated source code in firebug it shows it in the correct position. So I'd suppose I'd put that in the html one, thinking about it now. Sorry for wasting your time on such a trivial issue.
  11. OK Thanks, I have copied their code, made a few ammendments and stuck it in my script. But IE7 gives an object expected error on the $ character on the line pointed out in the code below : <<!-- This line here //--> $(document).ready( function() { searchBox(); } ); function searchBox() { $("#subQuery").focus( function() { if(this.value=='<?php echo REDIFINE_RESULTS; ?>') { this.value=''; } } ); $("#subQueryButton").click( function() { if($("#subQuery").val()=='<?php echo REDIFINE_RESULTS; ?>') { $("#subQuery").val(''); } } ); $("#subQuery").blur( function() { if(this.value=='') { this.value='<?php echo REDIFINE_RESULTS; ?>'; }; } ); } // Here is the HTML <input id="subQuery" type='text' name='keywords' value="<?php echo REDIFINE_RESULTS; ?>" class='fieldValue' style='width:42%; border:1px solid #3f547f;'> <?php echo tep_image_submit('button_search.gif', IMAGE_BUTTON_SEARCH, 'name="subsearch"') . tep_draw_hidden_field('search_in_description', '1'); Sorry my javascript expertise is very basic, I don't even know why there is a $ character or what it means? So can anyone point me out in the right direction? Thanks
  12. Hi peeps, I'd like to create an input field that has some text in that dissapears on click and re-appears if no text was added and also go blank if the form is sent. Like this example where it says "refine your search" Does anyone know what the initial input text label is called, or have a tutorial I can follow to do it. Or just show me Thanks for your help
  13. Hi phpfreaks, just had an idea for a forum. Web Browser Compatibility Issues. Here programmers and web designers can work out what works where and also act as an information point for web browser designers. Unless there is already one out there. Let me know, it would save hours of headaches. Cheers, scotty b
  14. Sorry, I'm editing some code thats in my OsCommerce site, and it uses its own templating engine that uses arrays to lay sections out. What it is doing is choosing one part of data or another to go in the array cell. Thats why I want the If statements in there. Sorry I meant If statements not functions. But it doesn't seem to like it. Any ideas of ways around it?
  15. Is it possible to put functions in an array? i.e. if (tep_db_num_rows($filterlist_query) > 1) { $info_box_contents[] = array( array('text' => tep_draw_form('filter', FILENAME_DEFAULT, 'get') if (isset($HTTP_GET_VARS['manufacturers_id'])) { echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']); $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)); } else { echo tep_draw_hidden_field('cPath', $cPath); $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS)); } echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']); while ($filterlist = tep_db_fetch_array($filterlist_query)) { $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']); } echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"'); echo '</form>'; }, array('text' => "<label for='pfrom' class='fieldKey'>" . Cost . "</label>" . echo tep_draw_input_field('pfrom', ENTRY_PRICE_FROM, 'class="fieldValue"') . echo tep_draw_input_field('pto', ENTRY_PRICE_TO, 'class="fieldValue"'))), }; }
  16. Hi I have two tables, one called products, the other availability. I want to extract the availability_id_out_of_stock value and use it to get availability_name out of the availability table using the products_id in the products table. But this statement doesn't work : SELECT a.availability_name, p.products_quantity FROM availability a INNER JOIN products p ON p.availability_id_out_of_stock = a.availability_id WHERE p.products_id = 51 AND a.language_id = 1 So to clarify the tables, I'll draw them out here: Products... products_id | availability_id_out_of_stock ------------------------------------------- 51 | 2 52 | 3 Availability... availability_id | language_id | availability_name -------------------------------------------------- 2 | 1 | Temporarily out of stock 3 | 1 | 2 - 3 Days Sorry just trying to get my head round Joins, not sure if it the correct one or what way the fields should go. I'd be greatfull if someone could point me in the right direction. Thanks.
  17. Hi, I'm getting this error : Warning: readdir(): 58 is not a valid Directory resource in /home/html/klickshopping.co.uk/admin/csv_import.php on line 722 Echoing out CSV_IMPORT_UPLOAD_FOLDER gives me this : csv_import/csv/ which is correct directory with all the write settings etc. Echoing out $handle = Resource id #58 True to the error. What could be wrong with that resource? Here's the basic code : echo CSV_IMPORT_UPLOAD_FOLDER; if ($handle = opendir(CSV_IMPORT_UPLOAD_FOLDER)) { echo $handle; while (false !== ($file = readdir($handle))) { }
  18. Sorry my mistake. It did miss one $var that messed it up. Cheers for your help
  19. No it doesn't I echoed out the statement and the variables are correct, I ran it through phpMyAdmin, and it didn't like it there either.
  20. Like : SELECT p.products_id, p.products_model, p.products_image, p.products_price, pd.products_name FROM products p INNER JOIN products_to_categories ptc ON ptc.products_id = p.products_id INNER JOIN products_description pd ON pd.products_id = p.products_id WHERE ptc.categories_id = " . $n_cat_row['categories_id'] . " AND p.products_status = 1 AND pd.language_id = " . (int)$languages_id . " ORDER BY p.products_ordered DESC LIMIT 1 ?
  21. I have a query : SELECT p.products_id, p.products_model, p.products_image, p.products_price FROM products p INNER JOIN products_to_categories ptc ON ptc.products_id = p.products_id WHERE ptc.categories_id = " . $n_cat_row['categories_id'] . " AND p.products_status = 1 ORDER BY p.products_ordered DESC LIMIT 1 Can I also get data from another table `products_description`. In this table it has the columns `product_id`, `products_name` and `language_id`. So I want to pull `products_name` ON `products_id` WHERE `language_id` = LANGUAGE_ID. How do I go about integrating that into my original query? Thanks
  22. OK so there is no fandagaley recursive MySQL functions that could do it?
  23. Yes, that is what I have set up so far, but as it gets bigger there would be calls to the database and I thought it would be much quicker if it could be done in a single MySQL query. Thanks for the reply tho.
  24. Bump, is it too complex? Not possible? How do I go about finding out, any good resources?
  25. Firstly you need to convert your Get Data to a $var called $postcode so in your postcodes.php page put : $postcode = $_GET['p']; At the top of your page. Then you will need to actually connect to your database via mysql_connect()... Look it up on the php.net manual. In fact look up how to do basic queries in mysql, there are a couple more functions you will need to use to make your statement work (mysql_query() & mysql_result()). And you statement is written wrong. Change : "SELECT * FROM tblhwz_postcodes WHERE fldPostCode = '$postcode_first' LIMIT 1"; to $qry = mysql_query("SELECT * FROM tblhwz_postcodes WHERE fldPostCode = '" . $postcode_first . "' LIMIT 1"); Finally right at the bottom before ?> add something like : echo $distance; To present something to your page, otherwise it will remain blank as you say. The problem with your database is that your not actually connecting to it at all! I suggest going to the w3schools website to look up about GET and POST data, and see the php manual on mysql functions. Good Luck.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.