Im wanting to add the following infomation from my site into a MySQL database.
I've been trying to figure out a way on how to layout the info into mysql, im a complete noob at this and its giving me a headache to remember lol
i've asked on some site and got a little bit of help but im still thiking whats the best way for me to arage this info.
okay this is what information i would like to store into mysql. This is just one car and we have hundreds so i need to be able to do this on a big scale.
ACURA:
ACURA RL (2000-2004)
Acura RL 3.5
(2000-2004)
FUEL TYPE: petrol (gasoline)
ENGINE CAPACITY: 3474cc
CYLINDERS: V6
VALVES: 24
POWER: 225bhp
TORQUE: 231 lb-ft
DRIVEN WHEELS: front (FWD)
STANDARD TRANSMISSION: 4-speed automatic
OPTIONAL TRANSMISSION: none
BODY STYLES: saloon (sedan)
SEATING CAPACITY: 5
MAXIMUM SPEED: 133mph
0-60: 8.1 seconds
AVERAGE FUEL ECONOMY: 24mpg
LENGTH: 4956mm [195.1 in]
WIDTH: 1811mm [71.3 in]
HEIGHT: 1438mm [56.6 in]
WHEELBASE: 2911mm [114.6 in]
KERB WEIGHT: 1662kg [3660lbs]
CO2 EMISSIONS: not known
UK INSURANCE GROUP: not specified
NCAP CRASH TEST RATING: not applicable
US NCAP (NHTSA) CRASH TEST RATING: front: 4, side: 4
So basically i would like to have the info aranged by having a main list of car manufactors then a a list of the car models in there and then once you select the car it will show the above info.
I've been trying to to create a script where it will create a database in mysql from a webform, basically you enter the name of the table you want to create and it will connect to mysql create the table with all the colombs (fields) in the script and then you just need to submit infomation into those colombs (at least i think thats what i need to do lol)
This is the code (Does not workπ)
html Form:
<html>
<body><form action="create table.php" method="POST">
Table Name: <input type="text" name="ntable" />
<input type="submit" />
</form></body>
</html>
php code
<?php
// Set Mysql Variables
$host = 'localhost';
$user = 'user';
$pass = 'pass';
$db = 'db';
if ($HTTP_POST_VARS['submit']) {
$con = mysql_connect("$host","$user","$pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$ntable=$HTTP_POST_VARS['ntable'];
$sql = "CREATE TABLE '$ntable'
(
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
model VARCHAR(30),
date VARCHAR(30),
fuel VARCHAR(60),
enginecap VARCHAR(30),
cylinders VARCHAR(30),
valves VARCHAR(30),
power VARCHAR(30),
torque VARCHAR(30),
drivenwheels VARCHAR(30),
stdtransmission VARCHAR(60),
optstdtransmission VARCHAR(60),
bodystyle VARCHAR(30),
seatingcap VARCHAR(30),
maxspeed VARCHAR(30),
0-60 VARCHAR(30),
mpg VARCHAR(30),
lenth VARCHAR(30),
width VARCHAR(30),
height VARCHAR(30),
wheelbase VARCHAR(30),
kerbweight VARCHAR(30),
co2 VARCHAR(30),
ukins VARCHAR(30),
ncp VARCHAR(30),
usncap VARCHAR(30)
PRIMARY KEY(id))";
$do = mysql_query($sql,$con) or die(mysql_error());
if($do)
{
echo "Table Created!";
}
or die(mysql_error());
mysql_close();
?>
Cheers for taking the time to read all this guys.
Thanks
Mike!