Re: [PHP-DB] INSERT Question
You can't perform update like this. You should loop through rows you want to update if they have different key values. UPDATE tbl_ib_articles SET col_name=new_value WHERE key_column=key_value; You can change the condition part, which can include non-key columns, HTH, Mustafa - Original Message - From: Charles Kline [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 5:56 AM Subject: Re: [PHP-DB] INSERT Question Everything looks okay with this when I echo the sql string: INSERT INTO tbl_ib_articles (issue_brief,article) VALUES ('24','30'),('24','20'),('24','31') My question was, what do I need to change to make this an UPDATE? Thanks, Charles On Monday, March 31, 2003, at 08:30 PM, [EMAIL PROTECTED] wrote: In a message dated 3/31/2003 5:26:36 PM Pacific Standard Time, [EMAIL PROTECTED] writes: then I built the INSERT like so: foreach($article_keys as $articleid) { $insert[] = ('$v_ib_id','$articleid'); } $article_sql = INSERT INTO tbl_ib_articles (issue_brief,article) VALUES . implode(',',$insert); It's pretty much okay, except you don't have ( ) around the string that you create with the implode. You can echo $article_sql to see exactly what the SQL looks like and you can then modify your statement so you get the right SQL. Janet -- 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] Sharing variable values among PHP files
You can store the value in a session variable session_start(); if (isset($_HTTP_SESSION_VARS['your_variable_name'])) { $value=$_HTTP_SESSION_VARS['your_variable_name']; //get the value }else{ $_HTTP_SESSION_VARS['your_variable_name']=new value; } You can use this script to pass values between pages. HTH Mustafa - Original Message - From: Alexa Kirk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 5:35 AM Subject: [PHP-DB] Sharing variable values among PHP files Does anyone know how to take a variable containing POST data from a form and use this value in another PHP file? I need to take a username from one PHP file and use it in a couple of other PHP files later when adding to a database. Thank you, Alexa Kirk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MSSQL VIRTUAL TABLES
Hi I think the problem is in the where part of your SQL if AgentRef is a varchar column then you should rewrite the where part as WHERE Order_Details.Qref = Order_Header.Qref AND Order_Header.AgentRef like '48976' or WHERE Order_Details.Qref = Order_Header.Qref AND Order_Header.AgentRef ='48976' HTH Mustafa - Original Message - From: LOUD, Mark [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 26, 2003 10:29 AM Subject: [PHP-DB] MSSQL VIRTUAL TABLES Hi, I am trying to do the following query in a MSSQL 2000 database: SELECT Order_Details.Qref, Order_Header.AgentRef FROM Order_Details, Order_Header WHERE Order_Details.Qref = Order_Header.Qref AND Order_Header.AgentRef = 48976 I get the following error: Syntax error converting the varchar value 'I7502203' to a column of data type int. Now this value 'I7502203' is in the Order_Header table in the AgentRef column (which is a varchar column). Obviously when the query is run the results will be put in a virtual table but why is it creating the virtual field of Order_Header.AgentRef as an int when in the original table it is a varchar? Can this be pre-set in the query? Any ideas would be handy Mark Loud CONFIDENTIALITY NOTICE The information contained in this e-mail is intended only for the confidential use of the above named recipient. If you are not the intended recipient or person responsible for delivering it to the intended recipient, you have received this communication in error and must not distribute or copy it. Please accept the sender's apologies, notify the sender immediately by return e-mail and delete this communication. Thank you. -- 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] Query Case In-sensitive
Use LIKE clause instead of = SELECT item_number FROM item WHERE item_code LIKE 'M1234' ; This will perform case-insensitive matching on all databases I used before (Including Oracle, MySQL, SQL-Server) - Original Message - From: ramki [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 5:46 AM Subject: Re: [PHP-DB] Query Case In-sensitive Generally in DBs, data is case sensitive. Simply you can do an uppercase or lowercase conversion in both sides. Ex : Select item number from item where upper(item_code) = upper(m1234); -ramki - Original Message - From: Larry Sandwick [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 1:23 AM Subject: [PHP-DB] Query Case In-sensitive Is there a way to run a query so that it ignores the case, and the query is not case sensitive? The data being stored is m1234 Query Select item number from item where item_code = M1234 ; The query above should return the data above. TIA Larry Sandwick Sarreid, Ltd. Network/System Administrator phone: (252) 291-1414 x223 fax : (252) 237-1592 -- 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] works on production server but not on localhost
You are probably right, it looks like a permission problem. What is the OS (win, Linux) of your machine? It's not about PHP.INI, If your operating system is Windows give write permission to the directory these text files reside. You can do it by using Internet Services Manager If it is a unix box (linux included) you can use chmod a+rw filename or chmod 771 filename to give write permission on these files to everybody. Maybe you have to give write permission to the directory too, I'm not sure about it. HTH Mustafa - Original Message - From: Paul Ihrig [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:16 PM Subject: [PHP-DB] works on production server but not on localhost hey guys.. just getting back in to using a little php. have 2 simple hit counters that work fine on the production server. but on my localhost it throughs several errors. looks like a permissions thing? i am not sure if there is a setting in my php.ini file that needs to be tweaked. kind of blind to the errors. looks like a permissions thing? hit counter: Warning: fopen(counterlog.txt, w) - Permission denied in C:\Inetpub\wwwroot\WCBE\counter.php on line 4 Warning: fwrite(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 5 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 6 12 hit counter2: 1 Warning: fopen(FX_DataCounter/wcbecounter.txt, r+) - Permission denied in C:\Inetpub\wwwroot\WCBE\nav.php on line 19 Warning: fgets(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 20 Warning: Cannot send session cookie - headers already sent by (output started at C:\Inetpub\wwwroot\WCBE\nav.php:19) in C:\Inetpub\wwwroot\WCBE\nav.php on line 21 Warning: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\wwwroot\WCBE\nav.php:19) in C:\Inetpub\wwwroot\WCBE\nav.php on line 21 Warning: fseek(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 23 Warning: flock(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 24 Warning: fputs(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 25 Warning: flock(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 26 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 27 any help would be great. thanks -paul -- 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] works on production server but not on localhost
Settings - Control Panel - Administrative Tools -Internet Services Manager Click the Default Web Site on the list, directories will be shown Right click the directory the files reside and Select Properties You can give write permission to the directory here. HTH Mustafa - Original Message - From: Paul Ihrig [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:44 PM Subject: RE: [PHP-DB] works on production server but not on localhost ok... im on xp running iis win i tried to figure out how to change permissions on files did a few example but it never seemed to work. is there a free chmod tool? or a simple way to do it in windows? again, i am sure i sound noob, and am... thanks for the response. -paul -Original Message- From: mustafa ocak [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 7:32 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] works on production server but not on localhost You are probably right, it looks like a permission problem. What is the OS (win, Linux) of your machine? It's not about PHP.INI, If your operating system is Windows give write permission to the directory these text files reside. You can do it by using Internet Services Manager If it is a unix box (linux included) you can use chmod a+rw filename or chmod 771 filename to give write permission on these files to everybody. Maybe you have to give write permission to the directory too, I'm not sure about it. HTH Mustafa - Original Message - From: Paul Ihrig [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:16 PM Subject: [PHP-DB] works on production server but not on localhost hey guys.. just getting back in to using a little php. have 2 simple hit counters that work fine on the production server. but on my localhost it throughs several errors. looks like a permissions thing? i am not sure if there is a setting in my php.ini file that needs to be tweaked. kind of blind to the errors. looks like a permissions thing? hit counter: Warning: fopen(counterlog.txt, w) - Permission denied in C:\Inetpub\wwwroot\WCBE\counter.php on line 4 Warning: fwrite(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 5 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 6 12 hit counter2: 1 Warning: fopen(FX_DataCounter/wcbecounter.txt, r+) - Permission denied in C:\Inetpub\wwwroot\WCBE\nav.php on line 19 Warning: fgets(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 20 Warning: Cannot send session cookie - headers already sent by (output started at C:\Inetpub\wwwroot\WCBE\nav.php:19) in C:\Inetpub\wwwroot\WCBE\nav.php on line 21 Warning: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\wwwroot\WCBE\nav.php:19) in C:\Inetpub\wwwroot\WCBE\nav.php on line 21 Warning: fseek(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 23 Warning: flock(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 24 Warning: fputs(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 25 Warning: flock(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 26 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 27 any help would be great. thanks -paul -- 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 -- 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] Query Case In-sensitive
Yes you are right, I have tried the queries on Oracle and MySQL, it works right on MySQL (case insensitive) but not on Oracle. Thank you for the correction. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] ; [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:36 PM Subject: Re: [PHP-DB] Query Case In-sensitive As an Oracle DBA (9+ years, versions 7.x - 9.x) I just wanted to make a correction. The LIKE command uses wild card characters ( _ and % ) for substitutions. Oracle IS a case-sensitive RDBMS and the LIKE command will NOT do case-insensitive queries. Roy A. Jones -- US Pharma Database Administration GlaxoSmithKline Inc. US Pharma IT, Shared Services -- External: (919) 483-0266 Internal: 703-0266 Fax: (919) 315-6842 Office: RC2 - 2005 Email: [EMAIL PROTECTED] -- http://usphdba.gsk.com/ - USPHARMA Database Site mustafa ocak [EMAIL PROTECTED] 19-Nov-2003 07:11 To [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Query Case In-sensitive Use LIKE clause instead of = SELECT item_number FROM item WHERE item_code LIKE 'M1234' ; This will perform case-insensitive matching on all databases I used before (Including Oracle, MySQL, SQL-Server) - Original Message - From: ramki [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 5:46 AM Subject: Re: [PHP-DB] Query Case In-sensitive Generally in DBs, data is case sensitive. Simply you can do an uppercase or lowercase conversion in both sides. Ex : Select item number from item where upper(item_code) = upper(m1234); -ramki - Original Message - From: Larry Sandwick [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 1:23 AM Subject: [PHP-DB] Query Case In-sensitive Is there a way to run a query so that it ignores the case, and the query is not case sensitive? The data being stored is m1234 Query Select item number from item where item_code = M1234 ; The query above should return the data above. TIA Larry Sandwick Sarreid, Ltd. Network/System Administrator phone: (252) 291-1414 x223 fax : (252) 237-1592 -- 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] Multiple deletes and updates...
You can use checkboxes to do it : input type=checkbox name=delrec[] value=?=$recid? and in the code foreach($_POST[delrec] as $ccc) { $res=mysql_query(delete from table_name where id= $ccc); } HTH Mustafa - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 3:36 PM Subject: [PHP-DB] Multiple deletes and updates... I simply can't get my head round this today Probably easy, but I've been chocka, and brain is melting... Anyhoo... If I have a table, with say, id(unique, auto inc), name, email, membership_type I've listed them on a PHP page... I want to add a checkbox to each row, so that I can select 1 or all, and then perform an action on ALL selected (Either Delete, or change membership_type) I can do this with ease one by one, but I cant get my head round to more than one with one submit button...? Can anyone nudge me in the right direction? I've seen this on the list before, but couldn't find it in the archive (I may have imagined it?) cheers, Tris... * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- 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] Help please
Hi, You can use LEFT OUTER JOIN Table1 : software list Table2 : installed ones $res=mysql_query(select table1.software_name, table2.software_name from table1 left outer join table2 on table1.software_name=table2.software_name); Check if there is not a matching record on table 2 while($row=mysql_fetch_array($res)){ echo $row[0]; //print software name //check if there is a matching record in table 2 display tick if (!empty($row[1])) display_tick(); } Hope this helps Mustafa - Original Message - From: Benjamin Jeeves [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 05, 2004 1:07 PM Subject: [PHP-DB] Help please hi all, I my querying two tables in mysql the first table I query returns a list of software that I have. Then I query a second table that show me what is installed on a computer. I would then like to be able to display the first list but with a tick next to software installed on a computer. I have treid with making a function that reuten the full list of software but can not get it to to work function below. function software_list($software) # Software is a word or it can be empty. { $db_search = SELECT software_name FROM software_list WHERE software_name LIKE '.$software.%'; $db_result = mysql_query($db_search); $db_count = mysql_num_rows($db_result); while($sw_result = mysql_fetch_array($db_result)){ $temp = $sw_result[software_name]; for($i=0;$icount($temp); $i++){ $sw_list = $temp; } return $sw_list; } } But when I go to print the return values in $sw_list all I get is my first value so can I get a full list to be return. I have been trying to print it by using the following for($i=0; $icount(software_list($sw_list));$i++){ print software_list($sw_list); } If any one can help with the comparing of the two list and then display a tick next too any match that would be a great help too. Thank you Ben -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php