473,399 Members | 3,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Query was empty

Hi i am trying to execute the following query and is coming up with the above error:

the specific code of the query is in bold text. i have put the rest of the code just in case there is something wrong in there instead of the specific code.

Code:

[PHP]<?php
if ($_POST[op] != "add") {
$display_block = "<h1><img src=\"Web Images/Banners/SuitFormTitle1.jpg\"></img></h1>
<div style='margin:0 auto;width:600px;'>
<form action=\"$_SERVER[PHP_SELF]\" method=\"post\">
<div class=\"row\">
<span class=\"item\"><h2>Suit ID</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Suit_ID\" size=5 /></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Smart ID</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Smart_ID\" value=1 size=5 /></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Suit Brand</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Suit_Brand\" size=20/></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Suit Type</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Suit_Type\" size=20/></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Suit Colour</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Suit_Colour\" size=20/></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Suit Price</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Suit_Price\" size=10/></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Suit Image</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Suit_image\" size=30 value=\"web images\Items\Suits\" /></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Suit Description</h2></span>
<span class=\"formw\"><textarea name=\"Suit_Description\" rows=5 cols=20></textarea></span>
</div>
<div class=\"row\">
<span class=\"item\"></span>
<span class=\"formw\"><input type=\"image\" name=\"submit\" src=\"Web Images/Buttons/Submit.jpg\" value=\"Add Entry\" /></span>
<div class=\"row\">
<span class=\"item\"></span>
<span class=\"formw\"><input type=\"hidden\" name=\"op\" value=\"add\"/></span>
</form>
</div>";
}
else if ($_POST[op] == "add") {
if (($_POST[Suit_Brand] == "") || ($_POST[Suit_Type] == "")) {
header ("location:add_suit.php");
exit;
}
$conn = mysql_connect("localhost","root","")
or die (mysql_error());
mysql_select_db("noble",$conn);

$add_Suit = "INSERT INTO Suits
VALUES('$_POST[Suit_ID]','$_POST[Smart_ID]','$_POST[Suit_Brand]','$_POST[Suit_Type]',
'$_POST[Suit_Colour]','$_POST[Suit_Price]','$_POST[Suit_image]',
'$_POST[Suit_Description]')";

if (mysql_query($insert,$conn)) {
echo "Record Added";
} else {
echo mysql_error();
}


$display_block = "<h2>Entry Added</h2>
<p>Add Another Entry?<a href\"add_suit.php\"></a></p>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="Insert_Forms/NobleForms.css"/>
<title>Suit Form</title>
</head>
<body>
<?php echo $display_block; ?>
</body>
</html>[/PHP]

thanks in advance for ur time and effort.
Mar 26 '08 #1
5 3095
Markus
6,050 Expert 4TB
The query isnt called $insert, but $add_Suit

Regards
Mar 26 '08 #2
OH!!! thanks sorry bout that
Mar 26 '08 #3
Markus
6,050 Expert 4TB
OH!!! thanks sorry bout that
No probs!

Regards.
Mar 26 '08 #4
TheServant
1,168 Expert 1GB
OH!!! thanks sorry bout that
So is that the problem solved?
Mar 26 '08 #5
Markus
6,050 Expert 4TB
So is that the problem solved?
Well "Query was empty" relates to a mistyped query, so i guess so.

Regards
Mar 26 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jim Hatfield | last post by:
I'm using: "select min(objid) from table_name where objid > $objid" to select the next row in a sequence where there may be gaps. It works fine unless the where clause results in an empty set. ...
9
by: Aaron Whiffin | last post by:
Hi, I've set up the following table in MySQL 3.23.58 and all seemed to be working fine: CREATE TABLE advert ( id INT NOT NULL AUTO_INCREMENT, userid INT NOT NULL, make VARCHAR(25) NOT NULL,...
4
by: jimh | last post by:
I'm not a SQL expert. I want to be able to write a stored procedure that will return 'people who bought this product also bought this...'. I have a user table that links to a transaction table...
14
by: Dave Thomas | last post by:
If I have a table set up like this: Name | VARCHAR Email | VARCHAR Age | TINYINT | NULL (Default: NULL) And I want the user to enter his or her name, email, and age - but AGE is optional. ...
6
by: Martin Lacoste | last post by:
Ok, before I headbutt the computer... don't know why when I add criteria in a query, I get an 'invalid procedure call'. I also don't know why after searching the help in access, the various access...
2
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
How can I run this query against a table in my Access database? I don't know hwo to use it in C#. In VB I would use .Recordset = "some sql statement". How do I do this in C#? //I get a vlaue...
30
by: Vadim Tropashko | last post by:
Reposting with more clarification (as Jan asked). Suppose I have a BNFgrammar and a source text parsed into a tree. How would I query an identifier declaration? All the XQuery tutorials...
3
by: techmistress | last post by:
Hello, I have a search function, that seems to return all of the records, rather than the ones I query (based on a form). I could use help to find out where I am wrong! $sql = "select * from...
4
kcdoell
by: kcdoell | last post by:
Hello: What is the best way to stop a report from running if the query is empty? Currently, I have a form that has a command button on it. The user has to make selections from 3 combo boxes on...
3
by: bob laughland | last post by:
Hi All, I have a SQL query like this (I have tried to break the problem down to simplify it), select rowid from table where name in ('a', 'b', 'd') group by rowid Here is an example of data...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.