473,788 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need help with my delete form

38 New Member
im using php and mysql

and everything is ok until it drive me crazy and im not able to delete a record from the database

i have a list box using a recordset from the database the display the item in it

so i wrote this code when click on submit
<?php
$modeldel= $_POST['model'];
$result = mysql_query("DE LETE FROM car_table where car_ID LIKE '%$modeldel%' ")or die(mysql_error ());
?>

it doesnt delete ...what is the right code ...plz help ,,i tried everything
Nov 25 '07 #1
1 1066
Markus
6,050 Recognized Expert Expert
im using php and mysql

and everything is ok until it drive me crazy and im not able to delete a record from the database

i have a list box using a recordset from the database the display the item in it

so i wrote this code when click on submit
<?php
$modeldel= $_POST['model'];
$result = mysql_query("DE LETE FROM car_table where car_ID LIKE '%$modeldel%' ")or die(mysql_error ());
?>

it doesnt delete ...what is the right code ...plz help ,,i tried everything
You're not actually running anything to delete it! You just save the query in a variable.


If you were to do just:
[php]
$modeldel= $_POST['model'];
mysql_query("DE LETE FROM car_table where car_ID LIKE '%$modeldel%' ")or die(mysql_error ());
[/php]
it would work :)
Or to work on the code you wrote, you could put it in an 'if' statement;
[php]
$modeldel= $_POST['model'];
$result = mysql_query("DE LETE FROM car_table where car_ID LIKE '%$modeldel%' ")or die(mysql_error ());
if(!$result){
// if it isn't successfully deleted; run this code
} else {
// successful delete; run code.
}
[/php]
Nov 25 '07 #2

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

Similar topics

3
4538
by: I Are Confused | last post by:
I am trying to open Database #2 while in Database #1 and delete a table that is in #2 so that I can copy a table from #1 into #2 - all through a function. My Database #2, as part of the start up, opens a form for user sign in. It is not starting up with autoexec. I do not want the function to open the window and subsequently open the form in Database #2. Is there anyway to get around this? If I put the open form in the autoexec and...
3
1914
by: Joe | last post by:
Hi, I have written a webpage that allows a user to delete files in asp.net with I am having a small problem. To access this page a user has to login via login.aspx page. After successful login, user is directed to a page called view.aspx which shows the user the files in a directory and allows them to delete the files. This page has a data grid having 4 columns - delete button, File Name, Last Write Time and File Size. When a user...
1
1446
by: skootr | last post by:
Has anyone seen any COMPLETE bound form examples? By complete, I mean a form that has Add/Edit/Delete capabilities. Every example I've seen on the 'net, in books, and in the VB.Net Resource Kit discusses basic record navigation only. If there are no examples on the internet, maybe someone could recommend a good book that covers this subject in detail .... maybe Microsoft is hinting that we should not use bound controls ???? They were...
3
1274
by: manmit.walia | last post by:
Hello All, I am stuck on a problem with updating an XML file. Here is what my final solution suppose to do. I have a web form which displays all users that are authorized for recieving a particular application. To display the users, a manager will select the product from a drop down menu and then the form (FORM 1) will use the selecteditem.value to query the xml file to find all users and then display the users in a datagrid. This is...
15
4644
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never before needed to do this HTTP/XML/MySQL type functions.
9
3946
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result - I have read every post out there and spent hours trying to figure out the problem with no success whatsoever - I have constrained the problem to one form however, and I think it's hiding somewhere in my code associated with this form, which is...
4
2354
imrosie
by: imrosie | last post by:
Hello All, (newbie)...I'm working on an Ordering app using the typical tables (customers, orders). I have a Search form to find existing customers prior to entering a new order. On the search form there's a combo control called 'custname' so that when a customer is located, the existing customer name is filled in and the account number goes into the Account control (from an autonumber field called CustomerID from Customer table). The rest of...
1
2106
by: javabeginner123 | last post by:
i have a java prob, and i have to solve it fast, but i'm just getting to know it, so plz help me solve it with full code completed, thanks so much. the prob is to create a monter fight and there is the description: The monsters are of a very strange kind, called "Bigmon". They have some basic characteristics, like attack and defense power, life points, a name, and a bonus factor that is used in special occasions. In this initial phase of the...
6
1870
by: smk17 | last post by:
I've spent the last few minutes searching for this question and I found an answer, but it wasn't quite what the client wanted. I have a simple online form where the user needs to fill out five fields out of nine. The other four are already there and filled out for the user. When they hit submit, all data is sent to us. But, if they desire (for whatever reason) the user can possibly delete what is already there and fill in something...
31
6683
by: matthewslyman | last post by:
I have an unusual design and some very unusual issues with my code... I have forced Access to cooperate on everything except one issue - record deletion. My form design involves a recursively nested form. In other words, the form, m_settings_menueditor_recursive has a single subform; m_settings_menueditor_recursive (both are viewed as datasheets - so the form is its own subdatasheet.) The Form_Open event modifies the form's recordset so...
0
9499
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10374
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10121
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6750
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5404
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2898
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.