Jump to content

BCAV_WEB

Members
  • Posts

    77
  • Joined

  • Last visited

    Never

Everything posted by BCAV_WEB

  1. Hi, If anyone has any free time, could you please go to this site; www.bikescarsandvans.co.uk and give us a bit of feedback and/or input on how we can make the site better. At the moment we're developing a better search function for vehicles, which can be seen on www.bikescarsandvans.co.uk/test.php Any comments will be much appericated.
  2. well a user might search for a car in the following ways, I'll use a ford fiesta TDCi titanium 1.6 litre diesel as an example. Ford Fiesta Ford Fiesta Titanium Ford Fiesta Titanium Currently I have 4 fields make (ford) model (fiesta titanium) extras (1.6 diesel) and search (ford fiesta TDCi titanium 1.6 litre diesel) and I'm using the %LIKE% to search all 4 fields in this manner. In relation to the colours, I now have this working fine and comes back with the correct colours for each car, but I would like a more efficent search method or do you think this one would do? Also to add more control I have done the following code, which works fine on firefox but doesnt on IE any suggestions on how to fix the IE?? Go to www.bikescarsandvans.co.uk/test.php to see it for yourself / test it. Finally any suggestions on how to get it so I can limit the data to say 50 records and then the next 50 to go onto another page? I know I can limit the results with my query but cant figure out the best soultion of the top of my head. Cheers print " <form target='_self' method='POST'> <table class=''> <tr> <td> <input name='vehicle' type='text' id='search_name' size='16'> <input type='image' src='images/search.gif' alt='Search' name='submit' id='search' value='Search'/> </td> </tr> <tr> <td> <select name='filter' id='filter'> <option value='make' selected='selected'>Filter By</option> <option value='make'>Vehicle Manufacture</option> <option value='model'>Vehicle Model</option> <option value='our_price'>Price</option> <option value='delivery_time'>Delivery Time</option> </select> </td> </tr> <tr> <td> <input type='radio' name='direction' value='ASC' checked/>Ascending <input type='radio' name='direction' value='DESC' />Descending </td> </tr> </form> "; include "connections/dbconnect.php"; if(isset($_POST['submit'])) { $vehicle = $_POST['vehicle']; $filter = $_POST['filter']; $direction = $_POST['direction']; } else { $filter = "make"; $direction = "ASC"; } //$manfactures = "Ford"; $car_query = " SELECT * FROM cars WHERE model LIKE '%$vehicle%' OR make LIKE '%$vehicle%' OR model_details LIKE '%$vehicle%' OR search LIKE '%$vehicle%' ORDER BY $filter $direction ";
  3. You're my hero! :D :D :D :D :D :D :D First I forgot to put colour_id and car_id to have any data and secondly you've explained the logic and iv'e managed to get it to fit into my code and it works fine now!!
  4. I can't seem to figure it out :'( <?php include "sections/phparea.php";?> <?php include "sections/header.php";?> <?php include "sections/left.php";?> <!-- start content --> <div id="content"> <h2>Test Area</h2> <?php print " <form target='_self' method='POST'> <table class=''> <tr> <td> <input name='vehicle' type='text' id='search_name' size='16'> <input type='image' src='images/search.gif' alt='Search' name='submit' id='search' value='Search'/> </td> </tr> <tr> <td> <select name='filter' id='filter'> <option value='make' selected='selected'>Filter By</option> <option value='make'>Vehicle Manufacture</option> <option value='model'>Vehicle Model</option> <option value='our_price'>Price</option> <option value='delivery_time'>Delivery Time</option> </select> </td> </tr> <tr> <td> <input type='radio' name='direction' value='ASC' checked/>Ascending <input type='radio' name='direction' value='DESC' />Descending </td> </tr> </form> "; include "connections/dbconnect.php"; if(isset($_POST['submit'])) { $vehicle = $_POST['vehicle']; $filter = $_POST['filter']; $direction = $_POST['direction']; } else { $filter = "make"; $direction = "ASC"; } //$manfactures = "Ford"; $car_query = " SELECT * FROM cars WHERE model LIKE '%$vehicle%' OR make LIKE '%$vehicle%' OR model_details LIKE '%$vehicle%' OR search LIKE '%$vehicle%' ORDER BY $filter $direction "; $car_result = mysql_query($car_query) or die ("Error in query: $car_query. ".mysql_error()); setlocale(LC_MONETARY, 'en_GB'); $fmt = '%i'; if (mysql_num_rows($car_result) > 0) { while ($car_row = @ mysql_fetch_array($car_result)) { print " <table class='details'> <tr> <td rowspan='2'> <img src=\"". $car_row["image"] ."\" alt='" . $car_row["image_alt"] . "' /> </td> <td colspan='2'> <a href='" . $car_row["what_link"] . "'> " . $car_row["model"]." ".$car_row["model_details"] . " </a> </tr> <tr> <td> <p class='info'> RRP:<br/> What Price:<br/> Our Price:<br/> Savings of:<br/> Delivery Time: </p> </td> <td> <p class='info1'> "; echo money_format($fmt, $car_row["rrp"] ); print "<br/>"; echo money_format($fmt, $car_row["what_price"] ); print "<br/>"; echo money_format($fmt, $car_row["our_price"] ); $savings = $car_row["rrp"] - $car_row["our_price"]; print " <br/> <font color=\"red\">"; echo money_format($fmt, $savings ); print " </font><br/> " . $car_row["delivery_time"] . " </p> </td> </tr> <tr> <td> "; $query_cols = "SELECT * FROM colours JOIN car_to_color ON (colours.id = car_to_color.colour_id) WHERE car_id = 1"; //$query_cols = "SELECT DISTINCT colours.id, colours.colour_img, colours.colour, colours.colour_img_alt, colours.price, colours.colour_type FROM colours,cars WHERE colours.model LIKE '%$vehicle%' AND cars.model LIKE '%$vehicle%'"; //$query_cols = "SELECT DISTINCT model FROM colours"; $cols_result = mysql_query($query_cols) or die ("Error in query: $query_cols. ".mysql_error()); if (mysql_num_rows($cols_result) > 0) { while ($cols_row = @ mysql_fetch_array($cols_result)) { ?> <a href='#' onmouseout='hideTooltip()' onmouseover='showTooltip(event,"<?php print "" . $cols_row["colour"] . " " . $cols_row["colour_type"] . "<br/>(£" . $cols_row["price"] . ")"; ?>");return false'> <?php print " <img src=\"". $cols_row["colour_img"] ."\" alt='" . $cols_row["colour_img_alt"] . "' /></a> "; } } print " </td> <td colspan='2'> <div id='CollapsiblePanel" . $car_row["id"] . "' class='CollapsiblePanel'> <div class='CollapsiblePanelTab' tabindex='0'><img class='drop' src='images/drop_down.jpg' alt='Go' /></div> <div class='CollapsiblePanelContent'> " . $car_row["id"] . " </div> </div> <script type='text/javascript'> <!-- var CollapsiblePanel" . $car_row["id"] . " = new Spry.Widget.CollapsiblePanel('CollapsiblePanel" . $car_row["id"] . "', {contentIsOpen:false}); //--> </script> </td> </tr> "; } } else { print " <table class='details'> <tr> <td>Sorry, but we don't seem to have that vehicle available to us.</td> </tr> "; } print "</table>"; ?> </div> <!-- end content --> <?php include "sections/right.php";?> <?php include "sections/footer.php";?>
  5. I'm using MyISAM, so how do I go about it? If you go onto the link, you'll see what I'm trying to do. http://www.bikescarsandvans.co.uk/test.php Colours Table id model colour colour_type colour_img colour_img_alt price 1 KA Crystal White images/colours/white_28x28.jpg Crystal White 0.00 2 KA Midnight Black – Metallic images/colours/plain_black_28x28.jpg Midnight Black 425.00 3 KA Sunrise images/colours/rimini_red_28x28.jpg Sunrise 0.00 4 KA Blush – Pearlescent images/colours/red_28x28.jpg Blush 625.00 5 KA Moonlight – Metallic images/colours/star_silver_28x28.jpg Moonlight 425.00 6 KA Piste – Pearlescent images/colours/sparkling_silver_28x28.jpg Piste 625.00 7 KA Scuba – Metallic images/colours/sucba_28x28.jpg Scuba 425.00 8 KA Dive images/colours/dive_28x28.jpg Dive 0.00 9 KA Strobe – Metallic images/colours/iorn_grey_28x28.jpg Strobe 425.00 10 Fiesta test test images/colours/lime_green_28x28.jpg test 0.00 11 Focus ST Focus TDCi 136 Zetec Focus TDCi 136 Titan... Panther Black – Metallic images/colours/plain_black_28x28.jpg Panther Black 470.00 12 Focus ST Preformance Blue – Metallic images/colours/normal_blue_28x28.jpg Preformance Blue 470.00 13 Focus ST Electric White – Pearlescent images/colours/white_28x28.jpg Electric White 745.00 Cars Table id make model model_details search rrp what_price what_link our_price delivery_time image image_alt Audi A3 Sportback TDI Quattro 170 S–Line 5Dr 2.0 Litre Diesel Audi A3 Sportback TDI Quattro 170 S–Line 5Dr... 26450.00 23320.00 http://www.whatcar.com/car-reviews/audi/a3-sportba... 22745.00 12 &ndash 16 Weeks images/cars/audi/audi_a3_sportback_tdi_170_sline_5... A3 Sportback TDI Quattro 170 S-Line If thats any help to you
  6. I have an input box, where a user can type in anmy vehicle they want it checks it against one table called "cars" and brings back the relevent info, I also want it to bring back the colours for that car. I have got this working, but it is very specific using "Like", so if the user searchs KA it works fine, but if they search Ford KA then it won't bring it back. A soultion around this is using %LIKE%. The issue is say I have one colour perfromance blue that is available for the KA, Fiesta and Focus RS but not the Focus titanium how would I get it to search this without duplicated data. My first thought was having a field called "Model" with data in like KA Fiesta Focus RS and use the %LIKE%., but because the Focus titanium has the word focus the colour will still get pulled out. Any ideas?
  7. If you look at this bit, you have opened two if statements, but only closed one before opening up the else. [ if(isset($_POST["register"])) { $privatekey = "6Ldhhr4SAAAAAKFoL2INOZV0_VuF6_z3OwDjVFNn"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } else ]
  8. I think you are missing a {} off one of you if statements, go through them all and make sure they are all opening and closing. If one is missing you'll get a blank screen like that.
  9. Thinking about it, im not sure if that will work; as I'm doing this for a UK telephone number so it wuld be like 0161 666 6666 01706 666 6666 033 666 6666
  10. Can anyone tell me why this bit of coding isn't working. I want a a form to validate the telephone number for the UK and been having a bash around with various ways to code this, with no success so far. I started with FILTER_VALIDATE_INT, but found out that "0" wouldnt be taken so I added FILTER_FLAG_ALLOW_OCTAL. But then it seems that the spaces, dashes wouldn't be taken as well as a limit on 10 characters occured. So I tried to write myself a small function that used an array to validate the styles etc... But this seemed to allow any string character. So I moved on to preg_match, but I can't seem toget my coding to work. :'( It's driving me mad now, probably just need a break But any help will be much appericated! [ if (!empty($_SESSION['add_customer_form'] ["telephone_no"])) { //if (!is_numeric($number)) //if(!filter_var($int, )) $number = $_POST["telephone_no"]; if(!preg_match("/^(+)?(([0-9]+)-?s?)*([0-9]+-[0-9]+)*([0-9]+)*$/", trim($number))) { $_SESSION['add_customer_errors']["telephone_no"] = ("$number Sorry, but you′ve entered an incorrect fromat"); } //if( !preg_match("/^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$/i", $_SESSION['add_customer_errors']["telephone_no"]) ) //{ /// $number = $_POST["telephone_no"]; //$_SESSION['add_customer_errors']["telephone_no"] = ("$number Sorry, but you′ve entered an incorrect fromat"); //} } ]
  11. Sorted it, turns out I had to start the session on that page to close the session's I wanted to close. Thanks for the help [ <?php session_start(); session_unregister("add_customer_errors"); session_unregister("add_customer_form"); ?> <html> <body onload="javascript:window.close()"> </body> </html> ]
  12. But that destorys all my sessions, including the one that will keep the user logged in
  13. Currently I have a Javascript button to close a tab window which is great, but annoying problem is when the user opens up the section again all the previous session errors are there. I have tried the following, which didnt work; [ function destroy() { window.open('destroyCode.php'); } <a href='javascript:window.close()' onclick="destroy()" ><img class='close' src='images/close.jpg' alt='Close Window' /></a> ] [ <?php session_unregister("add_customer_errors"); session_unregister("add_customer_form"); session_destroy(); ?> <html> <body onload="javascript:window.close()"> </body> </html> ] Any ideas of how to do it? I have got the session being unregistered if the data is correct and saved to the database. But what is the user wants to start and then changes there mind.
  14. What are the coding tags, as I never seem to get them to wrok properly arent they [ ]?? Okay I have a website that has makes of cars such as ford, and they have models such as KA and Fiesta and then they have colours some which are unique to each car but some that are universal. So I have created two backend database one; car which holds all the car info, image, name, model etc.... and another called colours which has the car model, colour, colour type (metallic, solid etc...), colour image. The way I thought this coding should work is by selecting the colour for each model of car where the model of table colours equals that of cars. Eg. if Fiesta (In colours) = Fiesta (In cars) then show the colour Green with Green.jpg etc... But this isn't the case because the KA colours are also coming out on the Fiesta. Does that make sense??
  15. Hey, I'm wanting to have our site so cars and colours come from a backend database, so we have two tables one: cars, two: colours. My issue is that I have a two cars the Ford Ka and Ford Fiesta, but the KA colours are coming up on the fiesta and like wise. Can anyone see the problem in my coding?? <?php include "sections/phparea.php";?> <?php include "sections/header.php";?> <?php include "sections/left.php";?> <!-- start content --> <div id="content"> <h2>Test Area</h2> <?php include "connections/dbconnect.php"; $manfactures = "Ford"; $car_query = "SELECT * FROM cars WHERE make = '$manfactures'"; $car_result = mysql_query($car_query) or die ("Error in query: $car_query. ".mysql_error()); setlocale(LC_MONETARY, 'en_GB'); $fmt = '%i'; if (mysql_num_rows($car_result) > 0) { while ($car_row = @ mysql_fetch_array($car_result)) { print " <table class='details'> <tr> <td rowspan='2'> <img src=\"". $car_row["image"] ."\" alt='" . $car_row["image_alt"] . "' /> </td> <td colspan='2'> <a href='" . $car_row["what_link"] . "'> " . $car_row["model"]." ".$car_row["model_details"] . " </a> </tr> <tr> <td> <p class='info'> RRP:<br/> What Price:<br/> Our Price:<br/> Savings of:<br/> Delivery Time: </p> </td> <td> <p class='info1'> "; echo money_format($fmt, $car_row["rrp"] ); print "<br/>"; echo money_format($fmt, $car_row["what_price"] ); print "<br/>"; echo money_format($fmt, $car_row["our_price"] ); $savings = $car_row["rrp"] - $car_row["our_price"]; print " <br/> <font color=\"red\">"; echo money_format($fmt, $savings ); print " </font><br/> " . $car_row["delivery_time"] . " </p> </td> </tr> <tr> <td> "; $test = "KA"; $query_cols = "SELECT DISTINCT colours.id, colours.colour_img, colours.colour, colours.colour_img_alt, colours.price, colours.colour_type FROM colours,cars WHERE colours.model = cars.model "; //$query_cols = "SELECT DISTINCT model FROM colours"; $cols_result = mysql_query($query_cols) or die ("Error in query: $query_cols. ".mysql_error()); while ($cols_row = @ mysql_fetch_array($cols_result)) { ?> <a href='#' onmouseout='hideTooltip()' onmouseover='showTooltip(event,"<?php print "" . $cols_row["colour"] . " " . $cols_row["colour_type"] . "<br/>(£" . $cols_row["price"] . ")"; ?>");return false'> <?php print " <img src=\"". $cols_row["colour_img"] ."\" alt='" . $cols_row["colour_img_alt"] . "' /></a> "; } print " </td> <td colspan='2'> <div id='CollapsiblePanel" . $car_row["id"] . "' class='CollapsiblePanel'> <div class='CollapsiblePanelTab' tabindex='0'><img class='drop' src='images/drop_down.jpg' alt='Go' /></div> <div class='CollapsiblePanelContent'> " . $car_row["id"] . " </div> </div> <script type='text/javascript'> <!-- var CollapsiblePanel" . $car_row["id"] . " = new Spry.Widget.CollapsiblePanel('CollapsiblePanel" . $car_row["id"] . "', {contentIsOpen:false}); //--> </script> </td> </tr> "; } } else { echo "Aids!"; } print "</table>"; ?> </div> <!-- end content --> <?php include "sections/right.php";?> <?php include "sections/footer.php";?>
  16. Actually it would have to be, tinking about it. Just tested it and it seems to be working fine with no issues. Just a bit gutted that I can't get a address finder :'( no chance my boss will give me the funds to buy one, he only understands the end product and expects systems done in mear minutes lol [ if (!validatePostcode($_SESSION['add_customer_form'] ["post_code"])) { $_SESSION['add_customer_errors']["post_code"] = "Please enter an appropriate Post Code"; } ]
  17. i'm guessing $str would be the posted valued from the input form, correct? And in the return false, bit I could have something like $_SESSION['add_customer_errors']["post_code"] = "Please enter an appropriate Post Code"; right?
  18. I thought as much, oh well going to have to deal with manual input. Any ideas on post code validation via php
  19. Hey, I was thinking about starting my own business doing the same, but decided against it as it was too much hassle working out wage, and accounts side of things. But if you put that aside, probably the best way to start is to decide whether to use a programme such as joomla or do all the coding urself from scratch. Personally I like doing scratch takes longer, but worth it Try searching for free css templates there a loads of nicely pre-built sites out there, which you can develop further, thats wot I usually do. Also if you're not very good a photoshop / flash get some help as these can make or break most site. Typically a client wont give a fudge if the site can do the best thing ever if it doesnt look good. Finally, get everything written down in a contract from your client as they will try to get more functions etc... out of you without paying you and you'll probably do it as you want them as a client. Also take a deposit, you dont wanna start a site spend hours on it and them to turn around and say na we have changed out minds. Last bit honestly, clearly define who has copyrights of the site, ie you own the full coding but they have rights for the site. Thats probably the best advice I can give and good luck!!
  20. Hi, I've been developing my companies online site from scratch using XHTML, PHP, MySQL, Ajax etc... I decided to do this rather than a CMS system such as Joomla because I felt that they wouldn't be able to do the functions required by my boss. Anyways long story short, I would like an address finder, street, house no etc... from entering a post code UK mainly, but eventually for the world, if possible as my boss has big ambitions Does anyone have any ideas where I can find a script, coding, or a better yet a tutorial for this functionality. ps. We don't want to pay for any pre-built systems, not bothered ab out putting an advert on our site in return for the system etc... Cheers people
  21. Fixed it the probelm was I wasn't selecting the other table. $query_cols = "SELECT * FROM colours, cars WHERE colours.model = cars.model ";
  22. Hi, I'm trying to joing two tables together, in the resulting PHP coding (See below) the issue I'm having the coding saying select the colour from the colour table where the model of car is the same as the model in the cars table. For example, if the car model is KA and in the table it is KA show the colours. I know this manual fix does the trick. [ $test = "KA"; $query_cols = "SELECT * FROM colours WHERE colours.model = '$test' "; ] But not the soultion any help would be much appericated thank you. [ include "connections/dbconnect.php"; $manfactures = "Ford"; $car_query = "SELECT * FROM cars WHERE make = '$manfactures'"; $car_result = mysql_query($car_query) or die ("Error in query: $car_query. ".mysql_error()); setlocale(LC_MONETARY, 'en_GB'); $fmt = '%i'; if (mysql_num_rows($car_result) > 0) { while ($car_row = @ mysql_fetch_array($car_result)) { $test = "KA"; $query_cols = "SELECT * FROM colours WHERE colours.model = cars.model"; $cols_result = mysql_query($query_cols) or die ("Error in query: $query_cols. ".mysql_error()); print " <table class=details'> <tr> <td rowspan='2'> <img src=\"". $car_row["image] ."\" alt='" . $car_row["image_alt"] . "' /> </td> <td colspan='2'> <a href='" . $car_row["what_link"] . "'> " . $car_row["model"]." ".$car_row["model_details"] . " </a> </tr> <tr> <td> <p class='info'> RRP:<br/> What Price:<br/> Our Price:<br/> Savings of:<br/> Delivery Time: </p> </td> <td> <p class='info1'> "; echo money_format($fmt, $car_row["rrp"] ); print "<br/>"; echo money_format($fmt, $car_row["what_price"] ); print "<br/>"; echo money_format($fmt, $car_row["our_price"] ); $savings = $car_row["rrp"] - $car_row["our_price"]; print " <br/> <font color=\"red\">"; echo money_format($fmt, $savings ); print " </font><br/> " . $car_row["delivery_time"] . " </p> </td> </tr> <tr> <td> "; while ($cols_row = @ mysql_fetch_array($cols_result)) { ?> <a href='#' onmouseout='hideTooltip()' onmouseover='showTooltip(event,"<?php print "" . $cols_row["colour"] . ""; ?>");return false'> <?php print " <img src=\"". $cols_row["colour_img"] ."\" alt='" . $cols_row["colour_img_alt"] . "' /> "; } print " </td> </tr> "; } } else { echo "Aids!"; } print "</table>"; ?>]
×
×
  • 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.