Jump to content

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?

Link to comment
https://forums.phpfreaks.com/topic/580-limitations/
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.