Jump to content

BCAV_WEB

Members
  • Posts

    77
  • Joined

  • Last visited

    Never

Everything posted by BCAV_WEB

  1. Yes that sounds about rite, but in TBCarStats you have linked the tables together how do you actually do this in PHPmyAdmin, as I've never actually had to do it If you go to www.bcav.org.uk and then select any car you'll see what I want to do, currently it is all manual coding, which is massive. The idea is to reduce this and to have a system where a non technical person can add new cars / edit, hence the back-end database. Doing this would also allow me to work on other systems.
  2. mmm... I did think about putting the figures in the number format rather than money and then simply put the html coding £ but I was hoping for a proper soultion rather than a work around I know that you can have the $ sign, but why not £ or even the euro symbol (I forgot the keyboard shortcut )
  3. Hello, I'm currently working on a website that has various different makes of cars, what I would like is to have all the information to come from a back-end database (PHPmyAdmin). This is a list of the following info that would have to go on: 1. Car Make, Model, RRP, Our Price, Savings 2. Colours - Orange, blue (along with the image and alt tag) 3. Car Extras - Prices, image etc... My issue is I can't seem to figure / get my head around the structure of the database, I know that I would require a many to many relationship table because one car can have many different colours. However, the colour names, variation change depending on the car specification. Any ideas? And how would I go about having it structured and linked in PHPMyAdmin? Any help would be greatly appreciated, this system would save time and recuding coding on the site dramatically. Thank you
  4. Hi anyone have any idea how to get the money_format to show the pound symbol rather than the letters GBP. This is the coding I have so far. [ setlocale(LC_MONETARY, 'en_GB'); $fmt = '%i'; echo money_format($fmt, 1000 ); ] This displays GBP 1,000.00 What am I missing or are you not capable of making the £ symbol appear. Thoughts please
  5. Okay, do you know anyway to formatt the outputted data?
  6. My bad, I forgot to change the if statement from "land-rover" which was my temp fix and it works fine now. Thank you very much people :D :D Once again someone else on this forum has come to my rescue :D:D:D
  7. Yes the coding doesnt have that, I only put in the space for you guys to see and it still isn't working
  8. So should it be: [<option value= '.$row["make].' ">'.$row["make"].'</option>]
  9. what you mean here : <option value='.$row["make"].'>'.$row["make"].'</option> it has single quotation marks, and why would it work for "Ford" for example??
  10. Okay, but how do you get the commas added in so "3000" would become "3,000" and maths would still be possible??
  11. Yes that is correct and it works like for most cases however, when it submits "Land Rover" and retrives the word "Land Rover" from the database it doesn't seem to work for some reason. Resulting in the final else statement, any ideas?
  12. Both how do you set the demical points in phpMyAdmin? And link two tables together?
  13. I have manually enetered the data into the database, so the select is coming as the word "Land Rover" and the value should also be "Land Rover" and this information is then posted in the form under the id "manufactures". I have over makes working such as Ford and have recently changed the land rover to "Land-Rover" both on the if statement and in the database, which works fine. The issue is to do with the space, I have also tried using " " which also hasn't worked Any Ideas?? Database Structure [ id int(10) make varchar(40) make_link varchar(25) rrp varchar(10) what_price int( what_link varchar(1000) our_price varchar( image varchar(100) ] Data [ 6 Land Rover ]
  14. I have a form which has a drop down menu select box, which retrives the makes of cars from a database, which once clicked submit will go to another page post that info. Then a if statment says if the variable that has been posted == a certain word that matches the one in the database then display content. However, my issue is when I have a car make such as "Land Rover" saved in the database as typed it just comes back with the final else statement. In the 1st section I have included the form which is posting the information across and in the second I have the if statement. Any ideas of how to get around / make this work? [ <form method=post" action="details.php" enctype="multipart/form-data"> <table class="search_nav"> <tr> <td> <select name="manufacture" id="manufacture"> <option value=" " selected="selected">Car Manufactures </option> '; $query = "SELECT DISTINCT make FROM cars ORDER BY make ASC"; $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); while ($row = @ mysql_fetch_array($result)) { print ' <option value='.$row["make].'>'.$row["make"].'</option> '; } print ' </select> </td> </tr> <tr> <td colspan="2"> <input type="image" src="images/go.gif" alt="Go" name="submit" id="submit" value="Submit"/> </td> </tr> </table> </form> ] [ if ($manufactures == "Land Rover") { echo "test"; } ]
  15. Hi, I have a two parter question completely different. 1. I need to have two money figures saved to my database "RRP" and "our price" and with this I would like to work out the savings. Easy enough to do, however how do I get the int number to display as £4,567.00 for example? [ $savings = $row["rrp"] - $row["our_price"]; ] 2. Part two of my question I have a database that stores cars, so models makes etc... but I also need to store colours for each car, so the colour name and the colour colour. What would be the best way of doing this? Remembering that a single car can have many many colours. Any ideas and thought would be much appericated. Thank you
  16. Resolved, as soon as I got this output I figured out what was happening via a bit ot trial and error. On the "dbconnect.php" I had both <?php and ?> when removing both I was unable to connect to the database at all, but when removing the end ?> on the "dbconnect.php" file the coding worked fine and that has allowed me to implement the more complex coding. Thank you for all your help! That little bit of coding you gave me saved me from more stress, as I have been looking / dealing with this error for a couple of days now. I'm in a good mood now, with 15 minutes until my weekend offically starts!! :D :D :D
  17. This is the error I got Warning: Cannot modify header information - headers already sent by (output started at /services3/webpages/b/i/bikescarsandvans.co.uk/public/dbconnect.php:10) in /services3/webpages/b/i/bikescarsandvans.co.uk/public/loginaction.php on line 14
  18. Hello, I'm having some major major issues, with a web hosting / PHP / MySQL database issue and if anyone can help that would be amazing! Okay first I have a MySQL database setup, with a table called "staff", within that there is a "username" and "password" field pretty self explanatory. I have a login in page (login.php) see first set of coding and a loginaction (loginaction.php) and what is suppose to happen is the loginaction checks the posted data against the database and if correct relocate to another page. I have had this coding and much more complex coding working on various other servers, but this is the first time I've ever dealt with BT Business webhosting, which is pretty useless right now and poor help to date from technicians who say it is a purely a coding issue. From what I have established I believe that the issue is occuring because BT don't have the apache server setup correctly for what I'm trying to do or that the browser is seeing the "$result" on "loginaction.php" and data, resulting in a white page of certain doom! Please help!! login.php [<?php include "sections/phparea.php";?> <?php include "sections/header.php";?> <?php include "sections/left.php";?> <!-- start content --> <div id=content"> <?php // Include the formatted error message if (isset($_SESSION['message])) echo "<h4>".$_SESSION['message']."</h4>"; // Generate the login <form> layout ?> <form action="loginaction.php" method="post" enctype="multipart/form-data"> <table class="tablelogin" > <tr> <td> <label for="email">E-mail Address</label> </td> <td> <input type="text" name="email" id="email" /> </td> </tr> <tr> <td> <label for="password">Password</label> </td> <td> <input type="password" name="password" id="password" /> </td> </tr> <tr> <td> </td> <td> <a href="../ambustar/accountrecovery.php">Forgotten Password?</a> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> <input type="hidden" name="count" id="count" value="1" /> <input type="reset" name="reset" id="reset" value="Clear" /> <input type="submit" name="submit" id="submit" value="Log in" /> </td> </tr> </table> </form> </div> <!-- end content --> <?php include "sections/right.php";?> <?php include "sections/footer.php";?> ] loginaction.php [<?php session_start(); include "dbconnect.php"; $email =$_POST["email"]; $password =$_POST["password"]; $query = "SELECT * FROM staff WHERE username = '$email' AND password = '$password'"; $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); // see if any rows were returned if (mysql_num_rows($result) > 0) { header("Location: test.php"); } else { header("Location: login.php"); } ?> ] dbconnect.php [<?php $hostname = "sql5c30a.carrierzone.com"; $username = "user"; $password = "password"; $databaseName = "main_bikescarsandvans_co_uk"; $connection = mysql_connect($hostname, $username, $password); // or die ("Unable to connect!") mysql_select_db($databaseName) or die ("Unable to select database!"); ?> ]
  19. I have simplified the coding: Can you see anything wrong with this at all?? This should be re-directing but it isn't I belive the issue is now with the dbconnect page (See second lots of coding) but I have no idea why it won't work [<?php session_start( ); //Create arrays as session variables to hold form variables and errors $_SESSION['track_errors'] = array(); $_SESSION['track_form_vars'] = array(); //Clear each of the form variables posted and assign to $_SESSION['formVars'] foreach($_POST as $varname => $value) { $_SESSION['track_form_vars'][$varname] = trim($value, 50); } // Validate the First Name if (empty($_SESSION['track_form_vars'] ["invoice_number"])) // First name cannot be a null string $_SESSION['track_errors']["invoice_number"] = "You must provide us your Invoice Number"; // Validate the First Name if (empty($_SESSION['track_form_vars'] ["track_order"])) // First name cannot be a null string $_SESSION['track_errors']["track_order"] = "You must provide us your Tracking Number"; if (count($_SESSION['track_errors'])) { // There are errors. Relocate back to the client form header("Location: track_order.php"); exit; } else { include "dbconnect.php"; // see if any rows were returned header("Location: track_order.php"); exit; } ?> ] [ <?php $hostname = "sql5c30a.carrierzone.com"; $username = "user"; $password = "password"; $databaseName = "main_bikescarsandvans_co_uk"; $connection = mysql_connect($hostname, $username, $password); // or die ("Unable to connect!") mysql_select_db($databaseName) or die ("Unable to select database!"); ?> ]
  20. This is the new amended coding, but unfortnately it still doesn't work :-[ :-[ :-[ [ <?php session_start( ); //Create arrays as session variables to hold form variables and errors $_SESSION['track_errors] = array(); $_SESSION['track_form_vars'] = array(); //Clear each of the form variables posted and assign to $_SESSION['formVars'] foreach($_POST as $varname => $value) { $_SESSION['track_form_vars'][$varname] = trim($value, 50); } // Validate the First Name if (empty($_SESSION['track_form_vars'] ["invoice_number"])) // First name cannot be a null string $_SESSION['track_errors']["invoice_number"] = "You must provide us your Invoice Number"; // Validate the First Name if (empty($_SESSION['track_form_vars'] ["track_order"])) // First name cannot be a null string $_SESSION['track_errors']["track_order"] = "You must provide us your Tracking Number"; if (count($_SESSION['track_errors'])) { // There are errors. Relocate back to the client form header("Location: track_order.php"); exit; } else { } include "connections/dbconnect.php"; $invoice_number =$_POST["invoice_number"]; $track_order =$_POST["track_order"]; $query = "SELECT * FROM customers_orders WHERE invoice_no = '$invoice_number' AND tracking_no = '$track_order'"; $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); // see if any rows were returned if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); include "sections/header.php"; include "sections/left.php"; print " <div id='content'> <h2>Track Order</h2> <table class='tracking_table'> <tr> <td id='name' colspan='11'> Hello ".$row['fname']." ".$row['sname']." <p></p> </td> </tr> <tr> <td colspan='11'> Please find your personal tracking information below. <p></p> </td> </tr> <tr> <th class='text'> Invoice Number </th> <th class='dots'> : </th> <td colspan='9'> ".$row['invoice_no']." </td> </tr> <tr> <th class='text'> Date Ordered <th class='dots'> : </th> <td colspan='9'> ".$row['date_of_order']." </td> </tr> <tr> <th class='text'> Status <th class='dots'> : </th> <td colspan='9'> ".$row['status']." </td> </tr> <tr> <th class='text'> Date Expected <th class='dots'> : </th> <td colspan='9'> ".$row['expected_delivery_date']." </td> </tr> <tr> <th class='text'> Vehicle Make <th class='dots'> : </th> <td colspan='9'> ".$row['vehicle_make']." </td> </tr> <tr> <th class='text'> Vehicle Model <th class='dots'> : </th> <td colspan='9'> ".$row['vehicle_ordered']." </td> </tr> <tr> <th class='text'> Vehicle Colour <th class='dots'> : </th> <td colspan='9'> ".$row['vehicle_colour']." </td> </tr> <tr> <th class='text'> Vehicle Extras <th class='dots'> : </th> <td colspan='9'> ".$row['vehicle_extras']." </td> </tr> <tr> <td colspan='11'> Please use this to track your order for speed as it will be updated as and when it comes forward or moves out immediateley. <p></p> </td> </tr> </table> </div> "; include "sections/right.php"; include "sections/footer.php;" } else { header("Location: track_order.php"); exit; } ?> ]
  21. I've tried it, but I it doesn't work, is that because the coding in include section/left.php; are normal coding and would need to be put into "print" or is there a way around this??
  22. so something more like this?? The coding in the include header, left etc... is just normal HTML what would the best way around this be? [ <?php session_start( ); //Create arrays as session variables to hold form variables and errors $_SESSION['track_errors'] = array(); $_SESSION['track_form_vars'] = array(); //Clear each of the form variables posted and assign to $_SESSION['formVars'] foreach($_POST as $varname => $value) { $_SESSION['track_form_vars'][$varname] = trim($value, 50); } // Validate the First Name if (empty($_SESSION['track_form_vars'] ["invoice_number"])) // First name cannot be a null string $_SESSION['track_errors']["invoice_number"] = "You must provide us your Invoice Number"; // Validate the First Name if (empty($_SESSION['track_form_vars'] ["track_order"])) // First name cannot be a null string $_SESSION['track_errors']["track_order"] = "You must provide us your Tracking Number"; if (count($_SESSION['track_errors'])) { // There are errors. Relocate back to the client form header("Location: track_order.php"); exit; } else { } ?> <!-- start content --> <?php include "connections/dbconnect.php"; $invoice_number =$_POST["invoice_number"]; $track_order =$_POST["track_order"]; $query = "SELECT * FROM customers_orders WHERE invoice_no = '$invoice_number' AND tracking_no = '$track_order'"; $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); // see if any rows were returned if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); include "sections/header.php"; include "sections/left.php"; print " <div id='content'> <h2>Track Order</h2> <table class='tracking_table'> <tr> <td id='name' colspan='11'> Hello ".$row['fname']." ".$row['sname']." <p></p> </td> </tr> <tr> <td colspan='11'> Please find your personal tracking information below. <p></p> </td> </tr> <tr> <th class='text'> Invoice Number </th> <th class='dots'> : </th> <td colspan='9'> ".$row['invoice_no']." </td> </tr> <tr> <th class='text'> Date Ordered <th class='dots'> : </th> <td colspan='9'> ".$row['date_of_order']." </td> </tr> <tr> <th class='text'> Status <th class='dots'> : </th> <td colspan='9'> ".$row['status']." </td> </tr> <tr> <th class='text'> Date Expected <th class='dots'> : </th> <td colspan='9'> ".$row['expected_delivery_date']." </td> </tr> <tr> <th class='text'> Vehicle Make <th class='dots'> : </th> <td colspan='9'> ".$row['vehicle_make']." </td> </tr> <tr> <th class='text'> Vehicle Model <th class='dots'> : </th> <td colspan='9'> ".$row['vehicle_ordered']." </td> </tr> <tr> <th class='text'> Vehicle Colour <th class='dots'> : </th> <td colspan='9'> ".$row['vehicle_colour']." </td> </tr> <tr> <th class='text'> Vehicle Extras <th class='dots'> : </th> <td colspan='9'> ".$row['vehicle_extras']." </td> </tr> <tr> <td colspan='11'> Please use this to track your order for speed as it will be updated as and when it comes forward or moves out immediateley. <p></p> </td> </tr> </table> </div> "; include "sections/right.php"; include "sections/footer.php;" } else { header("Location: track_order.php"); exit; } ?> ]
×
×
  • 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.