stuck on stupid...can't find the bloody error...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



okay, please help the newbie idiot.  Forgive me, for I cannot code my way out of a paper bag.  

What, O great Oracle of PHP Goodness is wrong with this picture?  When I punch in a work order, it spits back a blank page and does nothing whatsoever with the db.  Even if I deliberately enter a work order number that already exists.  Help this feeble-minded programmer wannabe?

Oh, as to the \' madness down yonder: should I or shouldn't I backslash the single quotes?

TIA
Dan



<html>

<head><title>The Board Lady - Work Order Database 0.1a</title></head>

<body>

<?php

define ('DB_USER', '********');

define ('DB_PASSWORD', '*********');

define ('DB_HOST', 'localhost');

define ('DB_NAME', 'boards');

$dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to database: ' . mysql_error());

@mysql_select_db (DB_NAME) OR die ('Could not connect to database: ' . mysql_error());

$page_req=$HTTP_GET_VARS['action'];

if ($page_req == "") {$page_req="0";}

if ($page_req == "0") {

echo "SWORD data entry<br>\n";

echo "<form action=\"add.php\" method=\"get\">";

echo "Work Order #: <input type=\"text\" name=\"wo_num\"><br>\n";

echo "Customer Name: <input type=\"text\" name=\"name\"> Phone: <input type=\"text\" name=\"phone\"><br>\n";

echo "Email Addy: <input type=\"text\" name=\"email\"> Date In: <input type=\"text\" name=\"date\"><br>\n";

echo "Board Type and SN: <input type=\"text\" name=\"board_type\"> Last 3 of SN: <input type=\"text\" name=\"last_three\"><br>\n";

echo "Weight In: <input type=\"text\" name=\"weight_in\"> Weight Out: <input type=\"text\" name=\"weight_out\"><br>\n";

echo "<input type=\"hidden\" name=\"action\" value=\"1\">\n";

echo "<INPUT type=\"submit\" value=\"Add Work Order\"> <INPUT type=\"reset\"><br>\n";

} 

if ($page_req == "1") {

$wo_num=$HTTP_GET_VARS['wo_num'];

$name=$HTTP_GET_VARS['name'];

$phone=$HTTP_GET_VARS['phone'];

$email=$HTTP_GET_VARS['email'];

$date=$HTTP_GET_VARS['date'];

$board_type=$HTTP_GET_VARS['board_type'];

$last_three=$HTTP_GET_VARS['last_three'];

$weight_in=$HTTP_GET_VARS['weight_in'];

$weight_out=$HTTP_GET_VARS['weight_out'];

$query_testingforadupe = "SELECT job_no FROM boards WHERE job_no == $job_no ORDER BY job_no ASC";

$result_testingforadupe = @mysql_query ($query_testingforadupe);

if ($result_testingforadupe) {

echo "That's a duplicate work order number, you ditz. Try again, this time without screwing it all up.<br><br>\n";

echo "<form action=\"add.php\" method=\"get\">";

echo "Work Order #: <input type=\"text\" name=\"wo_num\"><br>\n";

echo "Customer Name: <input type=\"text\" name=\"name\"> Phone: <input type=\"text\" name=\"phone\"><br>\n";

echo "Email Addy: <input type=\"text\" name=\"email\"> Date In: <input type=\"text\" name=\"date\"><br>\n";

echo "Board Type and SN: <input type=\"text\" name=\"board_type\"> Last 3 of SN: <input type=\"text\" name=\"last_three\"><br>\n";

echo "Weight In: <input type=\"text\" name=\"weight_in\"> Weight Out: <input type=\"text\" name=\"weight_out\"><br>\n";

echo "<input type=\"hidden\" name=\"action\" value=\"1\">\n";

echo "<INPUT type=\"submit\" value=\"Add Work Order\"> <INPUT type=\"reset\"><br>\n";

}

else {

$query_insert = "INSERT INTO boards (wo_num, name, phone, email, date, board_type, last_three, weight_in, weight_out) VALUES (\'$wo_num\', \'$name\', \'$phone\', \'$email\', \'$date\', \'$board_type\', \'$last_three\', \'$weight_in\', \'$weight_out\')";

$result_insert = @mysql_query ($query_insert);

if ($result_insert == "") {

echo "<input type=\"hidden\" name=\"action\" value=\"0\"\n";

echo "<INPUT type=\"submit\" value=\"Continue\">\n";

}

else {echo "OOPS! Your programmer is an idiot!\n";}

}}

mysql_close();

?>

</body>

</html>



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux