Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
I wonder what the best way would be to store all this fields;
Should I make a huge table with a lot of columns and store it all on 1 row? This seems very unlogic to me.
Should I make a table containing a 'field' and a 'value' column and store all fields as seperate rows? This is what I've done now.
@ feyd:
I want to store the form submissions. This isn't really a problem, the problem is that I want to check if some forms are filled in, so I can show that on the index page. I do it like this:
// prspec.php check
$prspec_done=1;
$check=mysql_query("
SELECT *
FROM prinfo_data
WHERE
prnr='$_SESSION[prnr]' AND
field='nieuwbouw' OR
field='vervanging' OR
field='onderhoud' OR
field='utiliteit' AND
value!=''
")or die("".mysql_error());
if(mysql_num_rows($check)==0)
{
$prspec_done=0;
}
$check=mysql_query("
SELECT *
FROM prinfo_data
WHERE
prnr='$_SESSION[prnr]' AND
field='hrketel' OR
field='warmtepomp' OR
field='stadsverwarming' OR
field='wtw' OR
field='optifor' OR
field='mv_mechanische_afvoer' OR
field='meer_minderwerk' OR
field='adviescentrum' OR
field='zonneenergie' OR
field='wpboiler' AND
value!=''
")or die("".mysql_error());
if(mysql_num_rows($check)==0)
{
$prspec_done=0;
}
$check=mysql_query("
SELECT *
FROM prinfo_data
WHERE
prnr='$_SESSION[prnr]' AND
field='aantal_woningen' OR
field='opdrachtgever' AND
value!=''
")or die("".mysql_error());
if(mysql_num_rows($check)==0)
{
$prspec_done=0;
}
if($prspec_done==1)
{
echo"Filled in!";
}
else
{
echo"Not filled in!";
}
But this is not handy and I'm sure it is possible to do it much easier...
@patrikG:
I have printed the book and will read it tonight... thanks!