[PHP] delete query doesnt work
i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] delete query doesnt work
Maybe you have to use wildcards like: mysql_query(delete from members where company like '%$delete%');?? Daniel E Massón. Ingeniero de desarrollo [EMAIL PROTECTED] Imagine S.A. Su Aliado Efectivo en Internet www.imagine.com.co (57 1)2182064 - (57 1)6163218 Bogotá - Colombia - Soluciones web para Internet e Intranet - Soluciones para redes - Licenciamiento de Software - Asesoría y Soporte Técnico -Mensaje original- De: Sunfire [mailto:[EMAIL PROTECTED]] Enviado el: viernes, 07 de febrero de 2003 17:06 Para: [EMAIL PROTECTED] Asunto: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete query doesnt work
You have a syntax error. Look at your quotes. -Kevin - Original Message - From: Sunfire [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 07, 2003 3:05 PM Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] delete query doesnt work
First two things I'd check: (1) Make sure the user you're connecting as has permission to delete rows, and (2) Make sure that your $delete variable has the value you were expecting. --- Mark Roedel | Blessed is he who has learned to laugh Systems Programmer| at himself, for he shall never cease LeTourneau University | to be entertained. Longview, Texas, USA | -- John Powell -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 4:06 PM To: [EMAIL PROTECTED] Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] delete query doesnt work
What is the error message you get if you put this in if(!mysql_query(delete from members where company='$delete')) die (mysql_error()); This would be the first step. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:06 PM To: [EMAIL PROTECTED] Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete query doesnt work
it doesnt say anything query returns 1 and there are 0 errors and 0 warnings but when i echo the query string: echo delete from members where company= '$delete'; it will show on the web page: delete from members where company = so the $delete is blank for some reason... is it possible that submitting a variable from 1 form to another that some wont get carried over? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:05 PM Subject: RE: [PHP] delete query doesnt work What is the error message you get if you put this in if(!mysql_query(delete from members where company='$delete')) die (mysql_error()); This would be the first step. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:06 PM To: [EMAIL PROTECTED] Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] delete query doesnt work
I've never heard of a variable not getting passed. Make sure that your form element is actually called delete and that it's part of the submitted form. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work it doesnt say anything query returns 1 and there are 0 errors and 0 warnings but when i echo the query string: echo delete from members where company= '$delete'; it will show on the web page: delete from members where company = so the $delete is blank for some reason... is it possible that submitting a variable from 1 form to another that some wont get carried over? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:05 PM Subject: RE: [PHP] delete query doesnt work What is the error message you get if you put this in if(!mysql_query(delete from members where company='$delete')) die (mysql_error()); This would be the first step. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:06 PM To: [EMAIL PROTECTED] Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete query doesnt work
--- Sunfire [EMAIL PROTECTED] wrote: so the $delete is blank for some reason... is it possible that submitting a variable from 1 form to another that some wont get carried over? No. It might help to read this: http://www.php.net/manual/en/security.registerglobals.php Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete query doesnt work
Then you just answered your own question. -Kevin - Original Message - From: Sunfire [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED] Sent: Friday, February 07, 2003 3:37 PM Subject: Re: [PHP] delete query doesnt work ok so i mistyped it the real one is mysql_query(delete from members where company='$delete'); and checking errors doesnt work because for some reason the $delete is empty - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:05 PM Subject: Re: [PHP] delete query doesnt work You have a syntax error. Look at your quotes. -Kevin - Original Message - From: Sunfire [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 07, 2003 3:05 PM Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete query doesnt work
here is the forms that delete uses: //the first one is the combo box to select a member to //delete form action=delete.php method=post select name=delete option value=select a member to deletebr ?php $query=mysql_query(select company from members); while($DeleteMember=mysql_fetch_array($query)){ echo option value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; ? /select /form the second form now is a check box with a submit button to confirm they want it deleted: form action=delete2.php method=post are you really sure you want to delete the member below? input type=checkbox name=deleteMemberif you want to delete ?php echo $delete ? input type=submit value=yes a href=main.phpcancel/a /form //now the code to actually use $delete in a query run: ?php if($DeleteMember==on){ mysql_query(delete from members where company='$delete'); } else { echo cant delete member the check box wasnt checked; } ? dont know why it doesnt work...any ideas? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:30 PM Subject: RE: [PHP] delete query doesnt work I've never heard of a variable not getting passed. Make sure that your form element is actually called delete and that it's part of the submitted form. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work it doesnt say anything query returns 1 and there are 0 errors and 0 warnings but when i echo the query string: echo delete from members where company= '$delete'; it will show on the web page: delete from members where company = so the $delete is blank for some reason... is it possible that submitting a variable from 1 form to another that some wont get carried over? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:05 PM Subject: RE: [PHP] delete query doesnt work What is the error message you get if you put this in if(!mysql_query(delete from members where company='$delete')) die (mysql_error()); This would be the first step. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:06 PM To: [EMAIL PROTECTED] Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] delete query doesnt work
You're form code is incorrect. option value=select a member to deletebr should read option value=select a member to delete/option The line: value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; should read value=\$DeleteMember[Company]\\$DeleteMember[Company]\/option; Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:56 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work here is the forms that delete uses: //the first one is the combo box to select a member to //delete form action=delete.php method=post select name=delete option value=select a member to deletebr ?php $query=mysql_query(select company from members); while($DeleteMember=mysql_fetch_array($query)){ echo option value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; ? /select /form the second form now is a check box with a submit button to confirm they want it deleted: form action=delete2.php method=post are you really sure you want to delete the member below? input type=checkbox name=deleteMemberif you want to delete ?php echo $delete ? input type=submit value=yes a href=main.phpcancel/a /form //now the code to actually use $delete in a query run: ?php if($DeleteMember==on){ mysql_query(delete from members where company='$delete'); } else { echo cant delete member the check box wasnt checked; } ? dont know why it doesnt work...any ideas? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:30 PM Subject: RE: [PHP] delete query doesnt work I've never heard of a variable not getting passed. Make sure that your form element is actually called delete and that it's part of the submitted form. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work it doesnt say anything query returns 1 and there are 0 errors and 0 warnings but when i echo the query string: echo delete from members where company= '$delete'; it will show on the web page: delete from members where company = so the $delete is blank for some reason... is it possible that submitting a variable from 1 form to another that some wont get carried over? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:05 PM Subject: RE: [PHP] delete query doesnt work What is the error message you get if you put this in if(!mysql_query(delete from members where company='$delete')) die (mysql_error()); This would be the first step. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:06 PM To: [EMAIL PROTECTED] Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete query doesnt work
ok i changed the endings to those to /option but still keep getting blank variable in the end for $delete in the delete query - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:51 PM Subject: RE: [PHP] delete query doesnt work You're form code is incorrect. option value=select a member to deletebr should read option value=select a member to delete/option The line: value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; should read value=\$DeleteMember[Company]\\$DeleteMember[Company]\/option; Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:56 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work here is the forms that delete uses: //the first one is the combo box to select a member to //delete form action=delete.php method=post select name=delete option value=select a member to deletebr ?php $query=mysql_query(select company from members); while($DeleteMember=mysql_fetch_array($query)){ echo option value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; ? /select /form the second form now is a check box with a submit button to confirm they want it deleted: form action=delete2.php method=post are you really sure you want to delete the member below? input type=checkbox name=deleteMemberif you want to delete ?php echo $delete ? input type=submit value=yes a href=main.phpcancel/a /form //now the code to actually use $delete in a query run: ?php if($DeleteMember==on){ mysql_query(delete from members where company='$delete'); } else { echo cant delete member the check box wasnt checked; } ? dont know why it doesnt work...any ideas? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:30 PM Subject: RE: [PHP] delete query doesnt work I've never heard of a variable not getting passed. Make sure that your form element is actually called delete and that it's part of the submitted form. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work it doesnt say anything query returns 1 and there are 0 errors and 0 warnings but when i echo the query string: echo delete from members where company= '$delete'; it will show on the web page: delete from members where company = so the $delete is blank for some reason... is it possible that submitting a variable from 1 form to another that some wont get carried over? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:05 PM Subject: RE: [PHP] delete query doesnt work What is the error message you get if you put this in if(!mysql_query(delete from members where company='$delete')) die (mysql_error()); This would be the first step. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:06 PM To: [EMAIL PROTECTED] Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete query doesnt work
In fact option does not require the closing tag. br will be ignored. Make sure you have Registered Globals ON. Or change $delete to $_POST['delete']; -Kevin - Original Message - From: Sunfire [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 07, 2003 4:16 PM Subject: Re: [PHP] delete query doesnt work ok i changed the endings to those to /option but still keep getting blank variable in the end for $delete in the delete query - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:51 PM Subject: RE: [PHP] delete query doesnt work You're form code is incorrect. option value=select a member to deletebr should read option value=select a member to delete/option The line: value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; should read value=\$DeleteMember[Company]\\$DeleteMember[Company]\/option; Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:56 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work here is the forms that delete uses: //the first one is the combo box to select a member to //delete form action=delete.php method=post select name=delete option value=select a member to deletebr ?php $query=mysql_query(select company from members); while($DeleteMember=mysql_fetch_array($query)){ echo option value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; ? /select /form the second form now is a check box with a submit button to confirm they want it deleted: form action=delete2.php method=post are you really sure you want to delete the member below? input type=checkbox name=deleteMemberif you want to delete ?php echo $delete ? input type=submit value=yes a href=main.phpcancel/a /form //now the code to actually use $delete in a query run: ?php if($DeleteMember==on){ mysql_query(delete from members where company='$delete'); } else { echo cant delete member the check box wasnt checked; } ? dont know why it doesnt work...any ideas? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:30 PM Subject: RE: [PHP] delete query doesnt work I've never heard of a variable not getting passed. Make sure that your form element is actually called delete and that it's part of the submitted form. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work it doesnt say anything query returns 1 and there are 0 errors and 0 warnings but when i echo the query string: echo delete from members where company= '$delete'; it will show on the web page: delete from members where company = so the $delete is blank for some reason... is it possible that submitting a variable from 1 form to another that some wont get carried over? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:05 PM Subject: RE: [PHP] delete query doesnt work What is the error message you get if you put this in if(!mysql_query(delete from members where company='$delete')) die (mysql_error()); This would be the first step. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:06 PM To: [EMAIL PROTECTED] Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] delete query doesnt work
Your problem is that form variables only exist on the page you POST your data to (or GET). You have a confirmation as that page. After your confirmation, $delete is empty on any other pages! If you want to pass it, then add it to a link or put it into another form as a hidden element or add it to a session or something. _YOU_ have to pass the $delete variable around to each page if you want it to exist! ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 6:16 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work ok i changed the endings to those to /option but still keep getting blank variable in the end for $delete in the delete query - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:51 PM Subject: RE: [PHP] delete query doesnt work You're form code is incorrect. option value=select a member to deletebr should read option value=select a member to delete/option The line: value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; should read value=\$DeleteMember[Company]\\$DeleteMember[Company]\/option; Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:56 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work here is the forms that delete uses: //the first one is the combo box to select a member to //delete form action=delete.php method=post select name=delete option value=select a member to deletebr ?php $query=mysql_query(select company from members); while($DeleteMember=mysql_fetch_array($query)){ echo option value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; ? /select /form the second form now is a check box with a submit button to confirm they want it deleted: form action=delete2.php method=post are you really sure you want to delete the member below? input type=checkbox name=deleteMemberif you want to delete ?php echo $delete ? input type=submit value=yes a href=main.phpcancel/a /form //now the code to actually use $delete in a query run: ?php if($DeleteMember==on){ mysql_query(delete from members where company='$delete'); } else { echo cant delete member the check box wasnt checked; } ? dont know why it doesnt work...any ideas? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:30 PM Subject: RE: [PHP] delete query doesnt work I've never heard of a variable not getting passed. Make sure that your form element is actually called delete and that it's part of the submitted form. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work it doesnt say anything query returns 1 and there are 0 errors and 0 warnings but when i echo the query string: echo delete from members where company= '$delete'; it will show on the web page: delete from members where company = so the $delete is blank for some reason... is it possible that submitting a variable from 1 form to another that some wont get carried over? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:05 PM Subject: RE: [PHP] delete query doesnt work What is the error message you get if you put this in if(!mysql_query(delete from members where company='$delete')) die (mysql_error()); This would be the first step. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:06 PM To: [EMAIL PROTECTED] Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] delete query doesnt work
Okay. Next step would be to check the select option values in the resulting webpage and make sure that the values are actually there. I think the fact that delete is coming up blank is the key. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 3:16 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work ok i changed the endings to those to /option but still keep getting blank variable in the end for $delete in the delete query - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:51 PM Subject: RE: [PHP] delete query doesnt work You're form code is incorrect. option value=select a member to deletebr should read option value=select a member to delete/option The line: value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; should read value=\$DeleteMember[Company]\\$DeleteMember[Company]\/option; Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:56 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work here is the forms that delete uses: //the first one is the combo box to select a member to //delete form action=delete.php method=post select name=delete option value=select a member to deletebr ?php $query=mysql_query(select company from members); while($DeleteMember=mysql_fetch_array($query)){ echo option value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; ? /select /form the second form now is a check box with a submit button to confirm they want it deleted: form action=delete2.php method=post are you really sure you want to delete the member below? input type=checkbox name=deleteMemberif you want to delete ?php echo $delete ? input type=submit value=yes a href=main.phpcancel/a /form //now the code to actually use $delete in a query run: ?php if($DeleteMember==on){ mysql_query(delete from members where company='$delete'); } else { echo cant delete member the check box wasnt checked; } ? dont know why it doesnt work...any ideas? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:30 PM Subject: RE: [PHP] delete query doesnt work I've never heard of a variable not getting passed. Make sure that your form element is actually called delete and that it's part of the submitted form. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work it doesnt say anything query returns 1 and there are 0 errors and 0 warnings but when i echo the query string: echo delete from members where company= '$delete'; it will show on the web page: delete from members where company = so the $delete is blank for some reason... is it possible that submitting a variable from 1 form to another that some wont get carried over? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:05 PM Subject: RE: [PHP] delete query doesnt work What is the error message you get if you put this in if(!mysql_query(delete from members where company='$delete')) die (mysql_error()); This would be the first step. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:06 PM To: [EMAIL PROTECTED] Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete query doesnt work
yes all of the select option values are coming up as true values just like i wanted and even when i shift $delete from the combobox ($delete is the name of the combobox) to the form with the check box i have printed on the screen check the box to aprove the deletion of $delete and in that line next to the check box $delete shows as whatever value was selected in the combo box on the page before... now i check the checkbox and hit yes button and $delete goes poof!! out the window for some reason its string(0)/null what happened to it?? so im loosing it going from the checkbox to the query string it gets lost... - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 6:14 PM Subject: RE: [PHP] delete query doesnt work Okay. Next step would be to check the select option values in the resulting webpage and make sure that the values are actually there. I think the fact that delete is coming up blank is the key. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 3:16 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work ok i changed the endings to those to /option but still keep getting blank variable in the end for $delete in the delete query - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:51 PM Subject: RE: [PHP] delete query doesnt work You're form code is incorrect. option value=select a member to deletebr should read option value=select a member to delete/option The line: value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; should read value=\$DeleteMember[Company]\\$DeleteMember[Company]\/option; Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:56 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work here is the forms that delete uses: //the first one is the combo box to select a member to //delete form action=delete.php method=post select name=delete option value=select a member to deletebr ?php $query=mysql_query(select company from members); while($DeleteMember=mysql_fetch_array($query)){ echo option value=\$DeleteMember[Company]\\$DeleteMember[Company]\br; ? /select /form the second form now is a check box with a submit button to confirm they want it deleted: form action=delete2.php method=post are you really sure you want to delete the member below? input type=checkbox name=deleteMemberif you want to delete ?php echo $delete ? input type=submit value=yes a href=main.phpcancel/a /form //now the code to actually use $delete in a query run: ?php if($DeleteMember==on){ mysql_query(delete from members where company='$delete'); } else { echo cant delete member the check box wasnt checked; } ? dont know why it doesnt work...any ideas? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:30 PM Subject: RE: [PHP] delete query doesnt work I've never heard of a variable not getting passed. Make sure that your form element is actually called delete and that it's part of the submitted form. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] delete query doesnt work it doesnt say anything query returns 1 and there are 0 errors and 0 warnings but when i echo the query string: echo delete from members where company= '$delete'; it will show on the web page: delete from members where company = so the $delete is blank for some reason... is it possible that submitting a variable from 1 form to another that some wont get carried over? - Original Message - From: Van Andel, Robbert [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 07, 2003 5:05 PM Subject: RE: [PHP] delete query doesnt work What is the error message you get if you put this in if(!mysql_query(delete from members where company='$delete')) die (mysql_error()); This would be the first step. Robbert van Andel -Original Message- From: Sunfire [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 2:06 PM To: [EMAIL PROTECTED] Subject: [PHP] delete query doesnt work i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free
[PHP] delete query doesnt work (fixed)
hi... my delete query : mysql_query(delete from members where company like '$delete'); now works..this is how i fixed it... in the form that submits the $delete var add this: input type=hidden name=flag_delete value=$delete now in query change $delete to $flag_delete... and poof it magically works still need to debug the edit system since all the records tend to get changed if someone submits the same data in the fields for that record... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete query doesnt work
Hi, I think you are facing problem with variable delete. Make sure your Php.ini settings for global off. Check value of variable is coming on the form or not. In case of your update, i think you forget to put where part. For example: mysql_query(update table_name set varible_name='$variable_name' WHERE key_name = '$key_variable') or die(mysql_error()); May be it will help u Hardik --- Sunfire [EMAIL PROTECTED] wrote: i have a delete query: mysql_query(delete from members where company='$delete'); it doesnt work should i change it to : mysql_query(delete from members where company like '$delete');?? the first one worked in mysql client but it doesnt work in php script for some reason... also having problems with update... if nothing on the form changes and it gets submitted anyways all the records in the db gets changed to the same thing that one record has in it... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete query doesnt work (fixed)
--- Sunfire [EMAIL PROTECTED] wrote: in the form that submits the $delete var add this: input type=hidden name=flag_delete value=$delete now in query change $delete to $flag_delete... and poof it magically works It's not magic, and John Holmes already explained it to you. If you do not pass a variable via GET, POST, or as a cookie, and you also do not store it as a session variable, why would you expect it to exist on another page? This demonstrates a very fundamental misunderstanding. You might want to start with the basics and learn a bit about how the Web works - how data is passed, etc. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php