[PHP-DB] Multiple query execution
Hi guys: I need to execute two insert/update queries within a single statement string from a PHP application, but it keeps giving me an error. For example, I have a listbox which has to insert or update two tables whithin the same submit action: INSERT INTO tbl_ISperson(NamePerson, Country) VALUES('John Smith', '{var_country}'); INSERT INTO tbl_pais_src(name_country) VALUES('{var_country}'); /*Where {var_country}is a variable which stores the value of a country*/ I have found this page (http://dev.mysql.com/doc/mysql/en/c-api-multiple-queries.html), but I donĀ“t know how to implement it: From version 4.1, MySQL supports the execution of multiple statements specified in a single query string. To use this capability with a given connection, you must specify the CLIENT_MULTI_STATEMENTS option in the flags parameter of mysql_real_connect() when opening the connection. You can also set this for an existing connection by calling MySQL Reference Manual :: 23.2.9 C API Handling of Multiple Query Execution mysql_set_server_option MYSQL_OPTION_MULTI_STATEMENTS_ON) By default, mysql_query() and mysql_real_query() return only the first query status and the subsequent queries status can be processed using mysql_more_results() and mysql_next_result() Does anybody has tried it in php?. Does anyone could share an example? Thanks in advance and best regards. Alvaro. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] begginer question
Hi everyone I just need something that I believe is very simple only I can't find an answer for it anywhere I have a database that each row has a machine, its serial, the customer and other details. The problem is that I have customers with more than one machine and I need to query for all the rows, but I don't want the rows that contain duplicate customers. The problem is that the only way for me to know the right row from let's say 3 rows that contain the same customer name is the serial number which needs to be the higher. So all I need a query to do that. Thanks in advanced Ziv -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] begginer question
First, you need to normalize your DB, maybe going up to the Third Normal Form will give you a good DB design. Second, there is a SQL parameter that let's you display only one record from many duplicated records, equal records, I guess it is UNIQUE. -Original Message- From: ziv gabel [mailto:[EMAIL PROTECTED] Sent: Sabado, 03 de Septiembre de 2005 02:35 p.m. To: php-db@lists.php.net Subject: [PHP-DB] begginer question Hi everyone I just need something that I believe is very simple only I can't find an answer for it anywhere I have a database that each row has a machine, its serial, the customer and other details. The problem is that I have customers with more than one machine and I need to query for all the rows, but I don't want the rows that contain duplicate customers. The problem is that the only way for me to know the right row from let's say 3 rows that contain the same customer name is the serial number which needs to be the higher. So all I need a query to do that. Thanks in advanced Ziv -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] begginer question
Select * from tablename group by customername order by serialnum DESC; or select distinct * from tablename order by serialnum DESC; On Saturday 03 September 2005 12:34 pm, ziv gabel wrote: Hi everyone I just need something that I believe is very simple only I can't find an answer for it anywhere I have a database that each row has a machine, its serial, the customer and other details. The problem is that I have customers with more than one machine and I need to query for all the rows, but I don't want the rows that contain duplicate customers. The problem is that the only way for me to know the right row from let's say 3 rows that contain the same customer name is the serial number which needs to be the higher. So all I need a query to do that. Thanks in advanced Ziv -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] begginer question
select max(serial_Num) from table where... bastien From: ziv gabel [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] begginer question Date: Sat, 03 Sep 2005 21:34:31 +0200 Hi everyone I just need something that I believe is very simple only I can't find an answer for it anywhere I have a database that each row has a machine, its serial, the customer and other details. The problem is that I have customers with more than one machine and I need to query for all the rows, but I don't want the rows that contain duplicate customers. The problem is that the only way for me to know the right row from let's say 3 rows that contain the same customer name is the serial number which needs to be the higher. So all I need a query to do that. Thanks in advanced Ziv -- 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] begginer question
whoops forget the group by clause select max(serial) from table where clause group by customer_id order by... bastien From: ziv gabel [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] begginer question Date: Sat, 03 Sep 2005 21:34:31 +0200 Hi everyone I just need something that I believe is very simple only I can't find an answer for it anywhere I have a database that each row has a machine, its serial, the customer and other details. The problem is that I have customers with more than one machine and I need to query for all the rows, but I don't want the rows that contain duplicate customers. The problem is that the only way for me to know the right row from let's say 3 rows that contain the same customer name is the serial number which needs to be the higher. So all I need a query to do that. Thanks in advanced Ziv -- 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-DB] RE: Really dumb Question - Select Many Display Records
Hi All Hoping somebody can help me out here, fairly new to PHP and MYSQL, I won't waffle on but, but here is my problem! I have a database with four tables in it, I would like to call the information from the table into a select menu, once the user has clicked on an item in the select menu, it will go to a new page where that tables (all of the columns) information will be displayed Example: User selects an account number, (select Box), user is then redirected to a new page andon that page user will see information related to that account number... eg name, and other details! I hope there is somebody that can help me, and do forgive me if this seems to be a really noob question, but im pulling my hair out here! Regards Peter -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] RE: Really dumb Question - Select Many Display Records
If you just need to know how to make the page refresh when you select an item then on the select tab you add (if I remember right) onchange:document.submit; (you can check www.w3schools.com if that's not working) And if you just want to make the select from the db then its Select distinct column from table_name order by column; Then you can run through the option tags with something like $x=0; While ($line=mysql_fetch_array($result)) { Echo option$line[$x]/option $x++; } -Original Message- From: Peter Justus [mailto:[EMAIL PROTECTED] Sent: Saturday, September 03, 2005 9:26 PM To: php-db@lists.php.net Subject: [PHP-DB] RE: Really dumb Question - Select Many Display Records Hi All Hoping somebody can help me out here, fairly new to PHP and MYSQL, I won't waffle on but, but here is my problem! I have a database with four tables in it, I would like to call the information from the table into a select menu, once the user has clicked on an item in the select menu, it will go to a new page where that tables (all of the columns) information will be displayed Example: User selects an account number, (select Box), user is then redirected to a new page andon that page user will see information related to that account number... eg name, and other details! I hope there is somebody that can help me, and do forgive me if this seems to be a really noob question, but im pulling my hair out here! Regards Peter -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals computer viruses. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php