Eay mensen,
ik krijg de volgende error:
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\wamp\www\Kopie van index.php on line 19
En dit is het script:
<html>
<?php
//connect met database eerst server, gebruiker, wachtwoord
$con = mysql_connect("localhost", "root", "");
$db = producten;
mysql_select_db("$db", $con);
if ($_POST["naam"]=="")
{ ?>
<form method="post" action="#">
Echo "productgroep Toevoegen";
Productgroep naam:<input name="naam" type="text" /> <br />
<input type="submit" value="verzenden"/>
</form>
<a href="uitvoer.php"><br>ga naar productoverzicht</a>
<?php }
else {
$naam=$_POST["naam"];
echo "productgroep toegevoegd met naam:<br>$naam;
$tabel = "CREATE TABLE $naam (id INT( 8 ) NOT NULL AUTO_INCREMENT,Product VARCHAR(250) default NULL,Aantal INT( 100 ) default NULL)";
echo "<a href='uitvoer.php'> <br> Ga naar productoverzicht </a><br><a href='index.php'>voeg nog een product toe</a>";
}
?>

</html>
Ik kan er maar niet achter komen wat de fout is.. Alvast bedankt ;) Btw.. is nog niet af die $tabel..word in een query gezet
Hier een normalisatie:


producten
id | naam
1 | The Godfather
2 | San Andreas
3 | The Sims 2


subproducten
id | product | vooraad | prijs | console | type
1 | 1 | 100 | 17.50 | 1 | 2
2 | 1 | 50 | 50.00 | 2 | 1

-product verwijst naar producten.id
-console verwijst naar consoles.id
-type verwijst naar types.id

consoles
id | naam
1 | xBox 360
2 | Nintendo wii
3 | Sony Playstation Portable


types
id | naam
1 | hardware
2 | software



dan neem je zo'n query:


SELECT subproducten.id, subproducten.vooraad, subproducten.prijs, producten.naam, consoles.naam as console, types.naam as type WHERE subproducten.product = producten.id AND subproducten.console = consoles.id AND subproducten.type = types.id

en heb je alle games met alle info.


voor één bepaalt product deze query:


SELECT subproducten.vooraad, subproducten.prijs, producten.naam, consoles.naam as console, types.naam as type WHERE subproducten.product = producten.id AND subproducten.console = consoles.id AND subproducten.type = types.id AND subproducten.id = ID

en bij ID het id van de game.


SUCCES!!!



[edit]voorbeeldjes[/edit]

Reageren