Jump to content

jahicki

New Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by jahicki

  1. Hi Guys & Girls I have this table: $sql = "CREATE TABLE " . $Name . "( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, ItemName VARCHAR(30) NOT NULL, ItemWeight VARCHAR(30) NOT NULL, ItemPrice VARCHAR(5), ItemDate DATE )"; & This Query: $sql = "INSERT INTO Pantry (ItemName, ItemWeight, ItemPrice, ItemDate) VALUES (" . $Name . ", " . $Weight . ", " . $Price . ", " . $Date . ")"; & the response I get is: Error Updating table: Unknown column 'Bacon' in 'field list'. I believe this to be an SQL issue but I don't know what or why. the HTML and PHP is below relating to this: if (isset($_POST["Item"])){ Add_Item($_POST["Item"], $_POST["Weight"], $_POST["Price"], $_POST["Date"]); }else{ echo "Nothing To do"; } <body> <form action="ActionPage.php" method="POST"> <input type="button" value="Create Pantry" onclick="CreatePantry()" /> <label for="PantryID">Create Pantry: </label> <input type="text" id="PantryID" name="PantryID" disabled="true" /> <input type="button" value="Add Item" onclick="AddItem()" /> <label for="ItemName">Item Name: </label> <input type="text" id="Name" name="Item" /> <label for="ItemWeight">Item Weight: </label> <input type="text" id="Weight" name="Weight" /> <label for="ItemPrice">Item Price: </label> <input type="text" id="Price" name="Price" /> <label for="ItemDate">Item BBE: </label> <input type="text" id="Date" name="Date"/> <input type="Submit" Value="Submit" /> </form> </body> Any help would be appreciated.
  2. Actually, I'll make a new topic in an SQL Forum... as I don't think this is a PHP issue any more. Thanks guys
  3. I won't be once I get it updating. its a basic SQL database table. the table was created with this code: $sql = "CREATE TABLE " . $Name . "( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, ItemName VARCHAR(30) NOT NULL, ItemWeight VARCHAR(30) NOT NULL, ItemPrice VARCHAR(5), ItemDate DATE )";
  4. Hi guys, thanks for the responses. I removed the JS completely for now, as it isn't required. I changed the Curley Brackets for Square. (Can't remember where I saw the Curley Brackets.) Now I get this: array(4) { ["Item"]=> string(5) "Bacon" ["Weight"]=> string(3) "500" ["Price"]=> string(4) "3.25" ["Date"]=> string(10) "12/12/2020" } ArrayCollecting Data -- Establishing Connection To Database -- Building Query -- Bacon5003.2512/12/2020 -- Inserting Data -- Error creating table: Unknown column 'Bacon' in 'field list $sql = "INSERT INTO Pantry (ItemName, ItemWeight, ItemPrice, ItemDate) VALUES (" . $Name . ", " . $Weight . ", " . $Price . ", " . $Date . ")";
  5. I am new to PHP and Debugging I got this from the Var_Dump: array(1) { ["Submit"]=> string(6) "Submit" } Array Any Help Would Be appreciated.
  6. Hi guys, I have this code: <?php // This Code Works if (isset($_POST{"PantryID"})) { Create_Pantry($_POST{"PantryID"}); } // This Code Isn't Working, Keeps Going To 'Else'. if (isset($_POST{"ItemName"})){ Add_Item($_POST{"ItemName"}, $_POST{"ItemWeight"}, $_POST{"ItemPrice"}, $_POST{"ItemDate"}); }else{ echo "Nothing To do"; } ?> here is the html <label for="PantryID">Create Pantry: </label> <input type="text" id="PantryID" name="PantryID" disabled="true" /> <label for="ItemName">Item Name: </label> <input type="text" id="ItemName" name="ItemName" disabled="true" /> Please help, I can't find any syntax errors. - At the point the PHP is activated it is no longer disabled. the PantryID is set up the same way.
  7. Thankyou for this bit of code. It has done exactly what I needed. though I have not seen it before, Where could I find information on it?
  8. a. Yes the code is posted and the output are correct to my results. maybe the server I am using is having problems. (It is a free server) b. I will have a look at the Flush() statement now, thankyou c. You make a valid point, I will look into this on both sides of my code! Thanks Again.
  9. I have this code: <html> <body> <?php echo date('h:i:s'), "<br>"; sleep(5); echo date('h:i:s'), "<br>"; echo "Your Pizza: ", $_POST["Pizza"]; echo " Has Been Sent To The Counter"; ?> </body> </html> which gives me this result: 07:41:06 07:41:06 Your Pizza: Thin & Crispy, , Garlic, Sweetcorn, Chicken, Bacon, Spicy Beef, Cooked, Has Been Sent To The Counter I can't seem to get the page to sleep at all. My intention is to achieve this a page that will display the message above for 5 seconds then run a relocation to the main page. but for now just making the page sleep would be of benefit. any help would be appreciated. I am a beginner so I am expecting this to be something simple i have missed.
×
×
  • 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.