[PHP-DB] :-)
Argh, i don't like the plaintext :) ..btw, 05473 is a password for archive -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: delete a record not working
hi, if the column type of id is varchar or char, u need to put '' around id. ur query should look like mysql_query(DELETE FROM open_trades WHERE id= '.$id.'); Note that your can leave any space between and ' if u do have a space between them, ur query will look like mysql_query(DELETE FROM open_trades WHERE id= ' valueofID'); instead of mysql_query(DELETE FROM open_trades WHERE id= 'valueofID'); and the first query will not return any result becuase of that space Justin wrote: Hello, I have a simple script to retrieve and then delete a selected script, but it does not work. When I hit the button I get: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'id' at line 11064 Any help would be appreciated. Thanks form action=? echo $PHP_SELF ? method=post ?php mysql_pconnect(localhost,root,password); mysql_select_db(options); $result = mysql_query(select * from open_trades); while ($row = mysql_fetch_array($result)) { print trtd; print INPUT TYPE='RADIO' NAME='id' VALUE='id'; print /tdtd; print $row[id]; print /tdtd; print $row[open_date]; print /tdtd; print $row[short_long_trade]; print /tdtd; print $row[expiry]; print /td/tr\n; } print /table\n; ? input type=submit name=submit value=close/form ?php if($submit) { mysql_query(DELETE FROM open_trades WHERE id=$id); echo Thank you! Information updated.; echo mysql_error(); echo mysql_errno(); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: delete a record not working
hi, if the column type of id is varchar or char, u need to put '' around id. ur query should look like mysql_query(DELETE FROM open_trades WHERE id= '.$id.'); Note that your can leave any space between and ' if u do have a space between them, ur query will look like mysql_query(DELETE FROM open_trades WHERE id= ' valueofID'); instead of mysql_query(DELETE FROM open_trades WHERE id= 'valueofID'); and the first query will not return any result becuase of that space Justin wrote: Hello, I have a simple script to retrieve and then delete a selected script, but it does not work. When I hit the button I get: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'id' at line 11064 Any help would be appreciated. Thanks form action=? echo $PHP_SELF ? method=post ?php mysql_pconnect(localhost,root,password); mysql_select_db(options); $result = mysql_query(select * from open_trades); while ($row = mysql_fetch_array($result)) { print trtd; print INPUT TYPE='RADIO' NAME='id' VALUE='id'; print /tdtd; print $row[id]; print /tdtd; print $row[open_date]; print /tdtd; print $row[short_long_trade]; print /tdtd; print $row[expiry]; print /td/tr\n; } print /table\n; ? input type=submit name=submit value=close/form ?php if($submit) { mysql_query(DELETE FROM open_trades WHERE id=$id); echo Thank you! Information updated.; echo mysql_error(); echo mysql_errno(); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Fetch two mysql resource in while loop
Hello sam, Did you try: while($row1=mysql_fetch_row($result1) AND $row2=mysql_fetch_row($result2)) ? or this: while(($row1=mysql_fetch_row($result1)) ($row2=mysql_fetch_row($result2))) ? good luck! P.S. These two actually work... i'm trying to figure out why this is so... Perhaps operator precedence?... don't know for sure. -- Best regards, Pablomailto:[EMAIL PROTECTED] Thursday, June 17, 2004, 12:26:29 AM, you wrote: s Hi all: s i worte a piece of code like this s $result1 = mysql_query(query1); s$result2 = mysql_query(query2); swhile($row1=mysql_fetch_row($result1) s $row2=mysql_fetch_row($result2)){ s .} s only $row2 is initazlied. row1 is always empty. s if i change it like this s while($row1=mysql_fetch_row($result1)){ s $row2=mysql_fetch_row($result2) s } s there will be no problem and both $row1 and $row2 contain values. s can anyone tell me why? is it i worte something wrong? s sam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php+antiword
I have to find a way to extract the text from a word doc. I came across antiword, which is what most people seem to suggest, but i cant get it to run on the documents correctly. I have $path and $file variables, i just don't know how to get antiword to run on the document. shell_exec? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Dropdown menus from DB query
How would you create a drop down menu from a database query? I have figured how to do it with one field, but how could it be done with a system where the value is different than the displayed value (ie. numerical code as the value, name displayed)? Thanks, Cole -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Dropdown menus from DB query
hmm... what about something like this?? echo select name=\dropdown\; $query = select code, name from table; $result = mysql_query($query); while($array = mysql_fetch_array($result)) { echo option value=\.$array[code].\.$array[name]./option; } echo /select; hth - Original Message - From: Cole Ashcraft [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 18, 2004 7:50 AM Subject: [PHP-DB] Dropdown menus from DB query How would you create a drop down menu from a database query? I have figured how to do it with one field, but how could it be done with a system where the value is different than the displayed value (ie. numerical code as the value, name displayed)? Thanks, Cole -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Dropdown menus from DB query
Thanks. I think I can work from this. Just to let you know, it generates a parse error ( I think its because of the quotes). Cole On Thu, 2004-06-17 at 18:09, Ng Hwee Hwee wrote: hmm... what about something like this?? echo select name=\dropdown\; $query = select code, name from table; $result = mysql_query($query); while($array = mysql_fetch_array($result)) { echo option value=\.$array[code].\.$array[name]./option; } echo /select; hth - Original Message - From: Cole Ashcraft [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 18, 2004 7:50 AM Subject: [PHP-DB] Dropdown menus from DB query How would you create a drop down menu from a database query? I have figured how to do it with one field, but how could it be done with a system where the value is different than the displayed value (ie. numerical code as the value, name displayed)? Thanks, Cole -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Dropdown menus from DB query
sorry, these codes are not tested... yes, i missed a quotation mark on the first echo statement. it should read: echo select name=\dropdown\; but i guess you can figure it out from these.. good luck! :o) - Original Message - From: Cole Ashcraft [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 18, 2004 9:23 AM Subject: Re: [PHP-DB] Dropdown menus from DB query Thanks. I think I can work from this. Just to let you know, it generates a parse error ( I think its because of the quotes). Cole On Thu, 2004-06-17 at 18:09, Ng Hwee Hwee wrote: hmm... what about something like this?? echo select name=\dropdown\; $query = select code, name from table; $result = mysql_query($query); while($array = mysql_fetch_array($result)) { echo option value=\.$array[code].\.$array[name]./option; } echo /select; hth - Original Message - From: Cole Ashcraft [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 18, 2004 7:50 AM Subject: [PHP-DB] Dropdown menus from DB query How would you create a drop down menu from a database query? I have figured how to do it with one field, but how could it be done with a system where the value is different than the displayed value (ie. numerical code as the value, name displayed)? Thanks, Cole -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Dropdown menus from DB query
I think this is the line which is the cause of your coding woes... The quote () doesn't have any matching pair. There's one quote in front, but there's none at the back. echo select name=\dropdown\; * * - Original Message - From: Cole Ashcraft [EMAIL PROTECTED] Date: Friday, June 18, 2004 9:23 am Subject: Re: [PHP-DB] Dropdown menus from DB query Thanks. I think I can work from this. Just to let you know, it generatesa parse error ( I think its because of the quotes). Cole On Thu, 2004-06-17 at 18:09, Ng Hwee Hwee wrote: hmm... what about something like this?? echo select name=\dropdown\; $query = select code, name from table; $result = mysql_query($query); while($array = mysql_fetch_array($result)) { echo option value=\.$array[code].\.$array[name]./option; } echo /select; hth - Original Message - From: Cole Ashcraft [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 18, 2004 7:50 AM Subject: [PHP-DB] Dropdown menus from DB query How would you create a drop down menu from a database query? I have figured how to do it with one field, but how could it be done with a system where the value is different than the displayed value (ie. numerical code as the value, name displayed)? Thanks, Cole -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php