473,499 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to find if the query was successful

11 New Member
I have a insert query which is fired when the form is submitted sometimes users enters illegal characters or for some reason query is not executed properly
how to find if the query has run successfully or not
Dec 10 '09 #1
3 6908
code green
1,726 Recognized Expert Top Contributor
Very bad practice. Always cleanse form data BEFORE inserting into a database.
By cleanse I mean protect from SQL injection and validate the data.
As for checking if queries work, php query execution functions do return error codes.
And there are rows affected functions.
I cannot be more helpful because you omitted your DB engine
Dec 10 '09 #2
carmarri
5 New Member
It's true, you should ensure that the data is correct before launch the query, otherwise you can have even security problems on your Database system.

Anyway you can check a response:

Expand|Select|Wrap|Line Numbers
  1. $result = mysql_query("SELECT....",$db);
  2. if ($result===false)
  3. {
  4.  echo "error!"
  5. } else {
  6.  //actions....
  7. }
Regards,


-------------------------------------
xatcom.net, diseño web
Dec 15 '09 #3
kovik
1,044 Recognized Expert Top Contributor
~carmarri, the OP stated that they were using an INSERT query. INSERT and UPDATE queries do not create result resources, as they have no results.
Dec 15 '09 #4

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

Similar topics

2
14881
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
2
1797
by: KnightWolfJK | last post by:
I'm working with a form and need some help customizing the results of a find query. I dug thru the archives and used this post...
2
1595
by: Kozzen | last post by:
Hi, can somebody briefly explain me how and where to build the expression to run a query that does the following: I have a " find duplicates query " on a table build on email adresses. In...
0
5958
by: XML newbie: Urgent pls help! | last post by:
I am using VB.Net. My program is to connect to a remote IPAddress. Once, it verifies the login information it should display the SessionID and enable some button . I appreciate your help and thanku...
5
3497
by: Wired Hosting News | last post by:
I tried to be breif and give a scenario so as not to be overlooked because it was soooo long. Let me give you real world. I am a manufacturer of goods and produce 11 items that are distributed...
3
6859
by: comp_databases_ms-sqlserver | last post by:
This post is related to SQL server 2000 and SQL Server 2005 all editions. Many of my stored procedures create temporary tables in the code. I want to find a way to find the query plan for these...
1
3640
by: gmccammon | last post by:
I'm having problems with my Prepare and Execute statements. I get a syntax error onmy prepare and of course the execute won't run on an undefined value. I don't know what I am overlooking. ...
2
2498
by: x taol | last post by:
i want to find query indentation tool. for example, select * from tbl where fld="anonym" this query statement To select * from tbl where fld="anonym"
3
1040
Chrisjc
by: Chrisjc | last post by:
I have a database full of information And I use part numbers to find / query the results on the page I have made now.. However I am in need of a new type of query and I am not 100% sure how to come...
2
1081
by: vaneetnagpal | last post by:
I have a develop a mini program, when i save the data in msaccess databace, i give the find query code, this didn't work , how can i solve the proble, give me sample code of ind query Vaneet...
0
7132
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
7009
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
7223
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
5475
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,...
1
4919
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...
0
4602
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
302
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.