Jump to content

Archived

This topic is now archived and is closed to further replies.

stc7outlaw

limitations

Recommended Posts

I am making a program for my dad\'s company and I am using columns for each form field. And a new table for each record. There are a lot of form fields. Tell me if this is legal and why it wont work. What is supposed to happen is someone types all the form fields in and 2 tables are created for the project store and the project store prices. Then the values are filled in from the form fields to the table. Why wont this work? :

 

[php:1:20d5e57add]<?php

<?php

 

if ( !empty($_POST[\'storenumber\']) && !empty($_POST[\'storeaddress\']) && !empty($_POST[

 

\'storecity\']) && !empty($_POST[\'storezip\']) && !empty($_POST[\'storestate\']) && !empty($_POST

 

[\'storephone\']) && !empty($_POST[\'surveyor\']) && !empty($_POST[\'evaldate\']) && !empty($_POST

 

[\'requestor\']) && !empty($_POST[\'requestorphone\']) && !empty($_POST[\'manufacturer\']) && !

 

empty($_POST[\'modelnumber\']) && !empty($_POST[\'modelstyle\']) && !empty($_POST[\'companyname\'])

 

&& !empty($_POST[\'companyphone\']) && !empty($_POST[\'concerns\']) && !empty($_POST[

 

\'electricalpanel\']) && !empty($_POST[\'contactor\']) && !empty($_POST[\'elements\']) && !empty(

 

$_POST[\'steamtablewp\']) && !empty($_POST[\'steamcabd\']) && !empty($_POST[\'steamcabmod\']) && !

 

empty($_POST[\'steamcabhe\']) && !empty($_POST[\'producebin\']) && !empty($_POST[\'reachfridge\'])

 

&& !empty($_POST[\'panfillsys\']) && !empty($_POST[\'steamtablecont\']) && !empty($_POST[

 

\'tacowarmunit\']) && !empty($_POST[\'cheesemelter\']) && !empty($_POST[\'integrity\']) && !empty(

 

$_POST[\'misc\']) && !empty($_POST[\'summary\']) && !empty($_POST[\'price_electricalpanel\']) && !

 

empty($_POST[\'price_contactor\']) && !empty($_POST[\'price_elements\']) && !empty($_POST[

 

\'price_elements\']) && !empty($_POST[\'price_steamtablewp\']) && !empty($_POST[

 

\'price_steamcabwp\']) && !empty($_POST[\'price_steamcabd\']) && !empty($_POST[

 

\'price_steamcabmod\']) && !empty($_POST[\'price_steamcabhe\']) && !empty($_POST[

 

\'price_producebin\']) && !empty($_POST[\'price_reachfridge\']) && !empty($_POST[

 

\'price_panfillsys\']) && !empty($_POST[\'price_steamtablecont\']) && !empty($_POST[

 

\'price_tacowarmunit\']) && !empty($_POST[\'price_cheesemelter\']) && !empty($_POST[

 

\'price_integrity\']) && !empty($_POST[\'price_misc\']) && !empty($_POST[\'price_summary\'])) {

 

$user = \'oprods\';

$pass = \'breakin\';

$db = \'projectsdb\';

 

$storenumber = $_POST[\'storenumber\'];

$storeaddress = $_POST[\'storeaddress\'];

$storecity = $_POST[\'storecity\'];

$storezip = $_POST[\'storezip\'];

$storestate = $_POST[\'storestate\'];

$storephone = $_POST[\'storephone\'];

$surveyor = $_POST[\'surveyor\'];

$evaldate = $_POST[\'evaldate\'];

$requestor = $_POST[\'requestor\'];

$requestorphone = $_POST[\'requestorphone\'];

$manufacturer = $_POST[\'manufacturer\'];

$modelnumber = $_POST[\'modelnumber\'];

$modelstyle = $_POST[\'modelstyle\'];

$companyname = $_POST[\'companyname\'];

$companyphone = $_POST[\'companyphone\'];

$concerns = $_POST[\'concerns\'];

$electricalpanel = $_POST[\'electricalpanel\'];

$contactor = $_POST[\'contactor\'];

$elements = $_POST[\'elements\'];

$steamtablewp = $_POST[\'steamtablewp\'];

$steamcabwp = $_POST[\'steamcabwp\'];

$steamcabd = $_POST[\'steamcabd\'];

$steamcabmod = $_POST[\'steamcabmod\'];

$steamcabhe = $_POST[\'steamcabhe\'];

$producebin = $_POST[\'producebin\'];

$reachfridge = $_POST[\'reachfridge\'];

$panfillsys = $_POST[\'panfillsys\'];

$steamtablecont = $_POST[\'steamtablecont\'];

$tacowarmunit = $_POST[\'tacowarmunit\'];

$cheesemelter = $_POST[\'cheesemelter\'];

$integrity = $_POST[\'integrity\'];

$misc = $_POST[\'misc\'];

$summary = $_POST[\'summary\'];

 

$price_electricalpanel = $_POST[\'price_electricalpanel\'];

$price_contactor = $_POST[\'price_contactor\'];

$price_elements = $_POST[\'price_elements\'];

$price_steamtablewp = $_POST[\'price_steamtablewp\'];

$price_steamcabwp = $_POST[\'price_steamcabwp\'];

$price_steamcabd = $_POST[\'price_steamcabd\'];

$price_steamcabmod = $_POST[\'price_steamcabmod\'];

$price_steamcabhe = $_POST[\'price_steamcabhe\'];

$price_producebin = $_POST[\'price_producebin\'];

$price_reachfridge = $_POST[\'price_reachfridge\'];

$price_panfillsys = $_POST[\'price_panfillsys\'];

$price_steamtablecont = $_POST[\'price_steamtablecont\'];

$price_tacowarmunit = $_POST[\'price_tacowarmunit\'];

$price_cheesemelter = $_POST[\'price_cheesemelter\'];

$price_integrity = $_POST[\'price_integrity\'];

$price_misc = $_POST[\'price_misc\'];

$price_summary = $_POST[\'price_summary\'];

 

 

@$link = mysql_connect(\'localhost\', $user, $pass) or die(\'<p>Could not connect to MySQL

 

server.</p>\');

@mysql_select_db($db) or die(\'<p>Could not select \'.$db.\' database\');

 

$sql = \"SHOW TABLES LIKE \'project_$storenumber\'\";

@$tbl_exists = mysql_query($sql) or die(mysql_error().\'<p>\'.$sql.\'</p>\');

 

if (mysql_num_rows($tbl_exists) == 1) {

echo \'<p>Store database project_\'.$storenumber.\' and Prices database already exist.</

 

p>\';

 

} else {

 

$sql = \"CREATE TABLE `project_$storenumber` (storenumber CHAR(255), storeaddress CHAR(

 

255), storecity CHAR(255), storezip CHAR(255), storestate CHAR(255), storephone CHAR(255),

 

surveyor CHAR(255), evaldate CHAR(255), requestor CHAR(255), requestorphone CHAR(255),

 

manufacturer CHAR(255), modelnumber CHAR(255), modelstyle CHAR(255), companyname CHAR(255),

 

companyphone CHAR(255), concerns CHAR(255), electricalpanel TEXT, contactor TEXT, elements

 

TEXT, steamtablewp TEXT, steamcabwp TEXT, steamcabd TEXT, steamcabmod TEXT, steamcabhe TEXT,

 

producebin TEXT, reachfridge TEXT, panfillsys TEXT, steamtablecont TEXT, tacowarmunit TEXT,

 

cheesemelter TEXT, integrity TEXT, misc TEXT, summary TEXT)\";

@mysql_query($sql) or die(mysql_error().\'<p>\'.$sql.\'</p>\');

echo \'<p>Project database created.</p>\';

$sql = \"CREATE TABLE `projectprices_$storenumber` (price_electricalpanel CHAR(20),

 

price_contactor CHAR(20), price_elements CHAR(20), price_steamtablewp CHAR(20),

 

price_steamcabwp CHAR(20), price_steamcabd CHAR(20), price_steamcabmod CHAR(20),

 

price_steamcabhe CHAR(20), price_producebin CHAR(20), price_reachfridge CHAR(20),

 

price_panfillsys CHAR(20), price_steamtablecont CHAR(20), price_tacowarmunit CHAR(20),

 

price_cheesemelter CHAR(20), price_integrity CHAR(20), price_misc CHAR(20), price_summary

 

CHAR(20))\";

@mysql_query($sql) or die(mysql_error().\'<p>\'.$sql.\'</p>\');

echo \'<p>Price database created.</p>\';

}

 

 

 

 

$sql = \"REPLACE INTO `project_$storenumber` (storenumber, storeaddress, storecity,

 

storezip, storestate, storephone, surveyor, evaldate, requestor, requestorphone,

 

manufacturer, modelnumber, modelstyle, companyname, companyphone, concerns, electricalpanel,

 

contactor, elements, steamtablewp, steamcabwp, steamcabd, steamcabmod, steamcabhe,

 

producebin, reachfridge, panfillsys, steamtablecont, tacowarmunit, cheesemelter, integrity,

 

misc, summary

) VALUES(\'$storenumber\', \'$storeaddress\', \'$storecity\', \'$storezip\', \'$storestate\',

 

\'$storephone\', \'$surveyor\', \'$evaldate\', \'$requestor\', \'$requestorphone\', \'$manufacturer\',

 

\'$modelnumber\', \'$modelstyle\', \'$companyname\', \'$companyphone\', \'$concerns\',

 

\'$electricalpanel\', \'$contactor\', \'$elements\', \'$steamtablewp\', \'$steamcabwp\', \'$steamcabd\',

 

\'$steamcabmod\', \'$steamcabhe\', \'$producebin\', \'$reachfridge\', \'$panfillsys\',

 

\'$steamtablecont\', \'$tacowarmunit\', \'$cheesemelter\', \'$integrity\', \'$misc\', \'$summary\') \";

@mysql_query($sql) or die(mysql_error().\'<p>\'.$sql.\'</p>\');

echo \'<p>Project Database info complete.</p>\';

 

$sql = \"REPLACE INTO `projectprices_$storenumber` (price_electricalpanel,

 

price_contactor, price_elements, price_steamtablewp, price_steamcabwp, price_steamcabd,

 

price_steamcabmod,price_steamcabhe, price_producebin, price_reachfridge, price_panfillsys,

 

price_steamtablecont, price_tacowarmunit, price_cheesemelter, price_integrity, price_misc,

 

price_summary) VALUES(\'$price_electricalpanel\', \'$price_contactor\', \'$price_elements\',

 

\'$price_steamtablewp\', \'$price_steamcabwp\', \'$price_steamcabd\', \'$price_steamcabmod\',

 

\'$price_steamcabhe\', \'$price_producebin\', \'$price_reachfridge\', \'$price_panfillsys\',

 

\'$price_steamtablecont\', \'$price_tacowarmunit\', \'$price_cheesemelter\', \'$price_integrity\',

 

\'$price_misc\', \'$price_summary\') \";

@mysql_query($sql) or die(mysql_error().\'<p>\'.$sql.\'</p>\');

echo \'<p>Price Database info complete.</p>\';

} else {

echo \'<p>Please enter all data fields.</p>\';

}

 

?>

?>[/php:1:20d5e57add]

 

the php bbcode putts amp next to the amperstand for some reason, but you know what i mean. IS there some error or something that prevents it from actually doing anything?

Share this post


Link to post
Share on other sites

It\'s very difficult to look through a program that large and spot a problem. What I do is break the program down into various pages. That way you can confirm which bits of the program are working and those that aren\'t.

Share this post


Link to post
Share on other sites

×

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.