Jump to content

laanes

Members
  • Posts

    70
  • Joined

  • Last visited

    Never

Everything posted by laanes

  1. Hello, Could anyone explain what this query is doing? And why the use of the sprintf function? $query = sprintf("SELECT B.*, T.option_name, T.option_type, M.value_name FROM %1\$s_options_bot AS B LEFT JOIN %1\$s_options_mid AS M ON B.value_id = M.value_id, %1\$s_options_top AS T WHERE B.option_id = T.option_id AND B.product = %2\$d ORDER BY T.option_name, M.value_name ASC", $glob['dbprefix'], $_GET['productId']); Kind regards, laanes
  2. Hi everyone, I get this error: Catchable fatal error: Object of class Category could not be converted to string The code: public static function list_all_cat_names() { $result_array = self::find_by_sql("SELECT name FROM ".self::$table_name); return !empty($result_array) ? array_shift($result_array) : false; } $categories = Category::find_all(); foreach ($categories as $cats): echo $cats; endforeach; Where could be the problem?
  3. That was the trick indeed. margin did help to push subCats down but did not allow me to move it further to the right. Cheers nano and skrappy1979 for helping me out ! laanes
  4. Hello to everyone, I am facing a CSS layout problem which I find is best explained by looking at the problem itself: http://www.swanseatimber.co.uk/shop/hardware/cat_100.html I am floating the subCats element to left but it will not appear beneath the baseline of boxContent - the previously aligned element. I would rather make proper use of the CSS float property than the br clear left if possible? Kind regards, laanes
  5. Search for an open source content management system. Will save you years of work.
  6. $query = "SELECT * FROM news ORDER BY content"; foreach ($news as mysql_fetch_array($query) { $noDuplicateValues = array_unique($news); }
  7. I can't figure out why my button looks different in internet explorer than it looks in mozilla. It is a form button with the type of image. I think internet explorer displays missing image with a little alt image icon while mozilla doesn't show anything if you don't specify the path to image. How can i make the button look the same in internet explorer as it looks in mozilla? To illustrate my problem: http://www.swanseatimber.co.uk/shop/ The button is under every product on the index page and is called "add to basket". regards, laanes
  8. Some changes have been on the website according to the feedback from ignace. Would be great to get some more opinions regards, laanes
  9. Just thought I should highlight this point as I am seeing this becoming more and more popular as a coding error (fails when people upgrade to V5) Cheers, Rw Changed those variable names around as you recommended, might be useful, you never know.
  10. This has been the most helpful feedback mate. I will make a to do list of those things and start working to make the website better. Please let me know if there is anything else you think could be better. Kind regards, laanes
  11. Hi Guys, This website has been under development for 7-8 weeks now. Any kind of opinions and feedback would be really awesome. Strong critique always helps to make a website more usable and look better. Waiting forward to your feedback. Link to the site: http://www.swanseatimber.co.uk/shop/ Kind regards, laanes
  12. It is not for one specific image, none of them are showing up. I checked the folder permissions because you mentioned it earlier, the pictures folder is readable.
  13. Ok, added the !, now it doesn't display the no image available alt image either. In case i have added the ! in a wrong place maybe, the line looks like this now: <td colspan="2"><?php if(!file_exists("../pics_p/".$_GET["PCode"].".jpg")){?><img src="../pics_p/<?php echo $_GET["PCode"] ?>.jpg" alt="Product Picture" galleryimg="no"><?php }else{?><img src="../imgz/nopic.jpg" alt="No Picture Available" width="306" height="200" galleryimg="no"><?php }?></td>
  14. Hi, On a website, there are products nicely listed with name, description, product code, price and a thumbnail etc. Now, if you click on a picture thumbnail, a new page called prodwin.php in a new window opens with the product code and for some reason, there is a "no picture available" alt image for every product. The line of code in it: <td colspan="2"><?php if(file_exists("../pics_p/".$HTTP_GET_VARS["PCode"].".jpg")){?><img src="../pics_p/<?php echo $HTTP_GET_VARS["PCode"] ?>.jpg" alt="Product Picture" galleryimg="no"><?php }else{?><img src="../imgz/nopic.jpg" alt="No Picture Available" width="306" height="200" galleryimg="no"><?php }?></td> The URL of that page looks like this: http://www.lock-tech.co.uk/scrptz/prodwin.php?SCode=CHL8K119S&PCode=CHL8K119S&PDescription=+DOOR%20PATIO%20LOCK&KEY%20SATIN&thePrice=%A328.52%20/%20EA On the other hand, when you click on the product name, it loads a different page called g_browse.php and the product image is nicely there. The line of code in it: <td height="366" colspan="2" valign="top"><?php if(file_exists("pics_p/".$array[$getVars["index"]]["PCode"].".jpg")){?><img src="pics_p/<?php echo $array[$getVars["index"]]["PCode"] ?>.jpg" alt="Product Picture" galleryimg="no"><?php }else{?><img src="imgz/nopic.jpg" alt="No Picture Available" width="306" height="200" galleryimg="no"><?php }?></td> $HTTP_GET_VARS["PCode"].".jpg" - Product code + .jpg will give the image name in pics_p folder. a JavaScript block which might also be relavant: function prodWindow(SCode, PCode, PDescription, thePrice) { var xPos=(screen.availWidth/2)-490; var yPos=(screen.availHeight/2)-116; var s=",top="+yPos+",left="+xPos; var win=open("scrptz/prodwin.php?SCode="+SCode+"&PCode="+PCode+"&PDescription="+PDescription+"&thePrice="+thePrice,'product', "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=no,height=414,width=316"+s); win.focus(); } Hope someone spots the problem. Regards, laanes
  15. I don't know if this is any helpful but I would start by reading about what you can do with jquery.
  16. What are the @'s standing for in your code? @$dh = opendir($img_dir); while (false !== (@$filename = readdir($dh)))
  17. Maybe an image name/size messes up the loop and makes it run over and over again until it fills up the memory?
  18. When I enter the URL straight into the browser then the new generated URL displays rootURL + rootURL/filename.php like so: http://www.lock-tech.co.uk/index.php?myURL=http://www.lock-tech.co.uk/groups.php and outputs these errors: Notice: Undefined variable: getVars in /home/swansea3/public_html/lock-tech.co.uk/scrptz/sessions.php on line 15 Notice: Undefined index: vat in /home/swansea3/public_html/lock-tech.co.uk/scrptz/sessions.php on line 39 Notice: Undefined index: action in /home/swansea3/public_html/lock-tech.co.uk/scrptz/sessions.php on line 62 Notice: Undefined index: UPDATE_x in /home/swansea3/public_html/lock-tech.co.uk/scrptz/sessions.php on line 62 Notice: Undefined index: DELETE_x in /home/swansea3/public_html/lock-tech.co.uk/scrptz/sessions.php on line 62 Notice: Undefined index: page in /home/swansea3/public_html/lock-tech.co.uk/groups.php on line 6 Notice: Undefined index: prodg in /home/swansea3/public_html/lock-tech.co.uk/groups.php on line 11 Notice: Undefined index: prodg in /home/swansea3/public_html/lock-tech.co.uk/groups.php on line 16
  19. The hosting changed. Old server: MySQL - 5.0.45 MySQL client version: 5.0.22 New server: Server version: 5.0.91-community MySQL client version: 5.0.91 The code attempts to generate the URL links by using the filename of the currently executing script, relative to the document root: www.myroot.co.uk/filename.php The errors I get: Notice: Undefined index: vat in /home/swansea3/public_html/lock-tech.co.uk/home/scrptz/sessions.php on line 39 Notice: Undefined index: action in /home/swansea3/public_html/lock-tech.co.uk/home/scrptz/sessions.php on line 62 Notice: Undefined index: UPDATE_x in /home/swansea3/public_html/lock-tech.co.uk/home/scrptz/sessions.php on line 62 Notice: Undefined index: DELETE_x in /home/swansea3/public_html/lock-tech.co.uk/home/scrptz/sessions.php on line 62 Notice: Undefined index: page in /home/swansea3/public_html/lock-tech.co.uk/home/groups.php on line 6 The code: <?php $GLOBALS['now']=gmdate('D, d M Y H:i:s').' GMT'; header('Expires: '.$GLOBALS['now']); // rfc2616 - Section 14.21 header('Last-Modified: '.$GLOBALS['now']); header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 header('Pragma: no-cache'); // HTTP/1.0 // Clean all GET vars and stick them into an array foreach($_GET as $varName=>$value)$getVars[$varName]=trim(clean($value, 60)); // Clean all POST vars and stick them into an array foreach($_GET as $varName=>$value)$postVars[$varName]=trim(clean($value, 60)); // Start session if none active if(!$getVars["uid"])startSession(); // Read session vars readSessionVars($getVars["uid"]); // Start a new session if the previous one has timed out if((time()-$sessions["theTime"])>1800) { // destroySession($sessions["ID"]); $notify=" onload=\"alert('Your session has timed out!');\""; startSession(); readSessionVars($getVars["uid"]); } else { unset($notify); // Update session time updateSession($sessions["ID"], "theTime", time()); } // Get discount level from session $discLevel=$discArray[$sessions["discount"]]; // Update VAT session var if necessary if($getVars["vat"])updateSession($sessions["ID"], "vat", $getVars["vat"]); // Generate links for navigation, VAT and bookmarking $URLvars=substr($_SERVER["PHP_SELF"], strrpos($_SERVER["PHP_SELF"],"/")+1); $vatLink=$URLvars; $thisPageURL=$_SERVER["PHP_SELF"]; if(strpos($thisPageURL, "secure/locktech/")!==false)$thisPageURL=substr($_SERVER["PHP_SELF"], 16); $prodLink="http://www.lock-tech.co.uk/home/".$thisPageURL; // Put all GET vars into vars for navigation, VAT and direct link $varDiv="?"; foreach($getVars as $varName=>$value) { if($varName!="vat" && $varName!="SCode" && $varName!="qty" && $varName!="price" && $varName!="action" && $varName!="UPDATE_x" && $varName!="UPDATE_y" && $varName!="DELETE_x" && $varName!="DELETE_y") { if($varName!="uid" && $varName!="goto")$prodLink.=$varDiv.$varName."=".$value; // Direct link if($varName!="logError")$vatLink.=$varDiv.$varName."=".$value; // VAT if($varName!="page" && $varName!="index")$URLvars.=$varDiv.$varName."=".$value; // NAV $varDiv="&"; } } // If any action is performed if($getVars["action"] || $getVars["UPDATE_x"] || $getVars["DELETE_x"]) { if($getVars["UPDATE_x"] && !$getVars["action"])$getVars["action"]="UPDATE"; if($getVars["DELETE_x"] && !$getVars["action"])$getVars["action"]="DELETE"; switch($getVars["action"]) { case "ADD": if($getVars["qty"]>0)addtoBasket($getVars["SCode"], $getVars["qty"], $getVars["price"]); break; case "UPDATE": updateProd(0, $getVars["SCode"], $getVars["qty"], false); break; case "DELETE": delProd($getVars["SCode"]); break; case "KILL": killBasket(); } } updateShipping($sessions["shippingID"]); ?>
  20. That's a good point. I will try this out and let you know about the result.
  21. On a website currently under development the URL does not change when navigating around on the page. It always displays the root URL. This is the script that should generate the links: $URLvars=substr($_SERVER["PHP_SELF"], strrpos($_SERVER["PHP_SELF"],"/")+1); $vatLink=$URLvars; $thisPageURL=$_SERVER["PHP_SELF"]; if(strpos($thisPageURL, "secure/locktech/")!==false)$thisPageURL=substr($_SERVER["PHP_SELF"], 16); $prodLink="http://www.lock-tech.co.uk".$thisPageURL; It used to. However, the server has changed and it does not any more. Is it maybe because the 2 paths (http://www.lock-tech.co.uk and secure/locktech/) must be changed according to the new server? Does anyone know what exactly do these paths stand for? I understand that one of them is the root path but what does the path in the line if(strpos($thisPageURL, "secure/locktech/")!==false)$thisPageURL=substr($_SERVER["PHP_SELF"], 16); stand for?
  22. In sessions.php there is a block of code: $URLvars=substr($_SERVER["PHP_SELF"], strrpos($_SERVER["PHP_SELF"],"/")+1); $vatLink=$URLvars; $thisPageURL=$_SERVER["PHP_SELF"]; if(strpos($thisPageURL, "secure/locktech/")!==false)$thisPageURL=substr($_SERVER["PHP_SELF"], 16); $prodLink="http://www.lock-tech.co.uk/".$thisPageURL; Maybe the new server does not provide the necessary information that the old server did? Reading from php.net: $_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here. That said, a large number of these variables are accounted for in the » CGI 1.1 specification, so you should be able to expect those. Any opinions about this?
  23. Thank you for your replies! I have managed to display all the errors with this method: ini_set('error_reporting', E_ALL); I guess I now have what I was after. Errors that I don't know how to fix: Notice: Undefined index: vat in /home/swansea3/public_html/lock-tech.co.uk/home/scrptz/sessions.php on line 39 Notice: Undefined index: action in /home/swansea3/public_html/lock-tech.co.uk/home/scrptz/sessions.php on line 62 Notice: Undefined index: UPDATE_x in /home/swansea3/public_html/lock-tech.co.uk/home/scrptz/sessions.php on line 62 Notice: Undefined index: DELETE_x in /home/swansea3/public_html/lock-tech.co.uk/home/scrptz/sessions.php on line 62 Notice: Undefined index: page in /home/swansea3/public_html/lock-tech.co.uk/home/groups.php on line 6 As these errors were not there before moving the website to the new host, could it be that it fails to connect to the database somewhere and these errors are being output because of that? I know the errors tell exactly where the problem is but those files have not been changed for a long period of time and the website has been running without problems in the old server.
  24. I think it already is after every query in the code i posted, or not? It still does not give me any errors.
  25. When clicking on the link "groups", there is no problem printing out the first level subgroups. But when clicking on any of the subgroup, the second level subgroups are not being displayed. I have or die(mysql_error()); after some queries but I can not see what is the error. It always gives the same message: How would I find out which part of the code fails? The code: <?php include 'scrptz/functions.php'; // Page vars $thisPage=$getVars["page"]; if($thisPage<1)$thisPage=1; $firstGroup=($thisPage*16)-16; // Get group details and stick them into an array $qMain="SELECT * FROM PGroups WHERE PG = '".$getVars["prodg"]."'"; $result=mysql_query($qMain) or die(mysql_error()); $groupDetails=mysql_fetch_array($result); // Get all sub groups in current product group $qMain="SELECT * FROM SubG WHERE ProdG = '".$getVars["prodg"]."'"; $result=mysql_query($qMain) or die(mysql_error()); // Stick sub groups in a 2D associative array $j=0; while ($row=mysql_fetch_array($result)) { foreach($row as $i=>$data)$array[$j][$i]=$data; $j++; } // Calculate vars for navigation $totalGroups=$j; $totalPages=ceil($totalGroups/16); // Set page title (for bookmark) $pageTitle=$groupDetails["GPname"]; // Set top title if($totalGroups>0){$topTitle="VIEW PRODUCTS";}else{$topTitle="ERROR";} ?> <html> <head> <title>Lock-Tech® Hi-Specification Architectural Hardware</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="scrptz/styles.css" rel="stylesheet" type="text/css"> <script language="JavaScript" type="text/javascript">var theID="<?php echo $getVars['uid']; ?>";</script> <script language="JavaScript" src="scrptz/content.js" type="text/javascript"></script> <script language="JavaScript" src="scrptz/menu.js" type="text/javascript"></script> <script language="JavaScript" src="scrptz/scripts.js" type="text/javascript"></script> </head> <body background="imgz/bg.gif" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0"<?php echo $notify ?>> <?php include("top.php"); ?> <table width="952" height="509" border="0" cellpadding="0" cellspacing="0" class="maintext"> <?php if($sessions['accCode']){?><form action="http://www.lock-tech.co.uk/index.php" method="post" name="logout" target="_parent"><input name="account" type="hidden" value="<?php echo $sessions['accCode']; ?>"><input name="killSession" type="hidden" value="<?php echo $getVars['uid']; ?>"></form><?php }?> <tr> <td width="1" rowspan="5" bgcolor="#000000"></td> <td height="21" background="imgz/topbar.gif" bgcolor="#14359E"> </td> <td height="21" colspan="5" valign="middle" background="imgz/topbar.gif" bgcolor="#14359E" class="mainyellow"><?php include("scrptz/dd_menu.php"); ?></td> <td height="21" background="imgz/topbar.gif" bgcolor="#14359E"> </td> <td width="1" rowspan="5" bgcolor="#000000"></td> </tr> <tr> <td width="5" rowspan="3"> </td> <td width="306" height="30" valign="bottom" class="title2"><?php echo $groupDetails["GPname"] ?></td> <td width="11" rowspan="3"><img src="imgz/maindiv.gif" width="11" height="466"></td> <td width="306" height="30" align="center" valign="bottom" class="title2"><?php if($totalGroups>0){?><a href="g_view.php?pgroup=<?php echo $groupDetails["PG"] ?>&uid=<?php echo $getVars['uid']; ?>" class="link4" onmouseover="window.status='View List of all Products in <?php echo $groupDetails["GPname"] ?>'; return true">VIEW ALL</a> | <a href="g_browse.php?pgroup=<?php echo $groupDetails["PG"] ?>&uid=<?php echo $getVars['uid']; ?>" class="link4" onmouseover="window.status='Browse all Products in <?php echo $groupDetails["GPname"] ?>'; return true">BROWSE ALL</a><?php }?></td> <td width="11" rowspan="3"><img src="imgz/maindiv.gif" width="11" height="466"></td> <td width="306" height="30" align="center" valign="bottom"> </td> <td width="5" rowspan="3"> </td> </tr> <tr> <td height="20" valign="top" class="mainbold"></td> <td width="306" rowspan="2" valign="top" class="maintext"> <?php for($i=$firstGroup; $i<($firstGroup+ && $i<$totalGroups; $i++){?> <a href="sub.php?PSubG=<?php echo $array[$i]["SPG"] ?>&uid=<?php echo $getVars['uid']; ?>" class="link1" onmouseover="window.status='View Products in <?php echo $array[$i]["SPGname"] ?>'; return true"><?php echo $array[$i]["SPGname"] ?></a><br> <?php // Get all subsubs in current sub group $qMain="SELECT * FROM SubSubG WHERE SPG = '".$array[$i]["SPG"]."'"; $result=mysql_query($qMain) or die(mysql_error()); // Print subsubs while ($row=mysql_fetch_array($result)) { ?> [<a href="subsub.php?PSubSubG=<?php echo $row["SSPG"]?>&uid=<?php echo $getVars['uid']; ?>" class="link3" onmouseover="window.status='View Products in <?php echo $row["SSPGName"]?>'; return true"><?php echo $row["SSPGName"]?></a>] <?php } ?> <br><br> <?php }?></td> <td width="306" rowspan="2" valign="top" class="maintext"> <?php for($i=$firstGroup+8; $i<($firstGroup+16) && $i<$totalGroups; $i++){ ?> <a href="sub.php?PSubG=<?php echo $array[$i]["SPG"] ?>&uid=<?php echo $getVars['uid']; ?>" class="link1" onmouseover="window.status='View Products in <?php echo $array[$i]["SPGname"] ?>'; return true"><?php echo $array[$i]["SPGname"] ?></a><br> <?php // Get all subsubs in current sub group $qMain="SELECT * FROM SubSubG WHERE SPG = '".$array[$i]["SPG"]."'"; $result=mysql_query($qMain) or die("<font color=\"#FF0000\">ERROR {9.4}! Please navigate to a <a href=\"main.php?uid=".$getVars['uid']."\">different page</a> and then try this page again.</font>"); // Print subsubs while ($row=mysql_fetch_array($result)) { ?> [<a href="subsub.php?PSubSubG=<?php echo $row["SSPG"]?>&uid=<?php echo $getVars['uid']; ?>" class="link3" onmouseover="window.status='View Products in <?php echo $row["SSPGName"]?>'; return true"><?php echo $row["SSPGName"]?></a>] <?php } ?> <br><br> <?php }?></td> </tr> <tr> <td height="416" valign="top" class="mainbold"> <?php if($totalGroups>0) { ?> <img src="grp_pics/<?php echo $groupDetails["PG"] ?>.jpg" alt="Group Picture" galleryimg="no"><br><img src="imgz/pixel.gif" width="306" height="5"><br> <?php echo $groupDetails["GPText"] ?><?php } else { ?> or die(mysql_error()); <p class="noresult">No Products Found.</p><p class="mainbold">Sorry, but there are no products in this section at the moment. The products are constantly being updated, however. Please try again later or <a href="mailto:sales@lock-tech.co.uk" class="link1" onmouseover="window.status='Send us an Email.'; return true">contact us</a>.</p><?php }?></td> </tr> <tr> <td width="5" height="22" background="imgz/btmbar.gif" bgcolor="#14359E"> </td> <td width="306" height="22" align="center" valign="top" background="imgz/btmbar.gif" bgcolor="#14359E"><a href="javascript:history.back()" onmouseover="prev_btn.src='imgz/prev2.gif';window.status='Previous Page'; return true" onmouseout="prev_btn.src='imgz/prev.gif'"><img name="prev_btn" src="imgz/prev.gif" width="124" height="16" border="0"></a></td> <td width="11" height="22" bgcolor="#14359E"><img src="imgz/btmdiv.gif" width="11" height="22"></td> <td width="306" height="22" align="center" background="imgz/btmbar.gif" bgcolor="#14359E" class="nav"><? include 'scrptz/nav.php' ?></td> <td width="11" height="22" bgcolor="#14359E"><img src="imgz/btmdiv.gif" width="11" height="22"></td> <td width="306" height="22" align="center" valign="top" background="imgz/btmbar.gif" bgcolor="#14359E"><a href="javascript:directLink('<?php echo $prodLink; ?>','<? echo $pageTitle ?>')" onmouseover="link_btn.src='imgz/link2.gif'; window.status='Direct Link to This Page'; return true" onmouseout="link_btn.src='imgz/link.gif'"><img name="link_btn" src="imgz/link.gif" alt="" width="182" height="16" border="0"></a></td> <td width="5" height="22" background="imgz/btmbar.gif" bgcolor="#14359E"> </td> </tr> </table> </body> </html>
×
×
  • 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.