Re: [PHP-DB] PHP Update query
Hi Ron, Have a look at http://www.php.net/manual/en/function.mysql-info.php - Original Message - From: "Ron Piggott" To: "PHP DB" Sent: Monday, November 02, 2009 11:59 PM Subject: [PHP-DB] PHP Update query How do I test if an UPDATE query worked $query = "UPDATE `clients` SET `company` = '$company', `contact` = '$contact', `phone` = '$phone', `city` = '$city' WHERE `clients`.`reference` =$client LIMIT 1"; $client_result=mysql_query($query); ??? Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] WHILE
Why don't you use mysql_fetch_assoc() instead? You can address your fields directly, as in: while($row_FOTOS=mysql_fetch_assoc($result)) { echo "height='384' />"; echo "height='384' />"; } Alternatively, you can specify which fields you want in your SQL statement: $sql = "SELECT picture1, picture2 FROM picture WHERE id = '$ID'"; $result =mysql_query($sql,$conn); while($row_FOTOS=mysql_fetch_array($result)) { echo ""; // picture1 echo ""; // picture2 } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] finder (I AM REALLY SORRY)
Hi List, Am I the only one who's getting the feeling that we're doing Emiliano's JOB here? Maybe he should try posting a job opening at his company to this list, instead of letting us solve all his problems and write his entire application for him. I'm all for helping each other out, but this has just been a stepwise build-up of how to write his real-estate application. Just my two cents, - Original Message - From: "Emiliano Boragina" To: Sent: Friday, July 17, 2009 12:16 AM Subject: [PHP-DB] finder (I AM REALLY SORRY) Sorry a lot of times!!! Please... tell me (and help me) to know if this is right: = $row['precio'] <= $f_hasta; if($f_codigo == "") { $sql_BUSQUEDA = "SELECT * FROM principal FULL JOIN detalles WHERE '"; if ($f_inmueble > 0) { $sql_BUSQUEDA .= " inmueble LIKE '%$f_inmueble%' "; } if ($f_operacion > 0) { $sql_BUSQUEDA .= "AND operacion LIKE '%$f_operacion%' "; } if ($f_precio) { $sql_BUSQUEDA .= "AND precio = '$f_precio' "; } if ($f_moneda == 1) { $sql_BUSQUEDA .= "AND moneda = '$f_moneda' "; } if ($f_moneda == 2) { $sql_BUSQUEDA .= "AND moneda = '$f_moneda' "; } if ($f_region > 0) { $sql_BUSQUEDA .= "AND region LIKE '%$f_region%' "; } if ($f_barrio > 0) { $sql_BUSQUEDA .= "AND barrio LIKE '%$f_barrio%' "; } if ($f_ambientes > 0) { $sql_BUSQUEDA .= "AND ambientes LIKE '%$f_ambientes%' "; } if ($f_dependencia > 0) { $sql_BUSQUEDA .= "AND dependencia LIKE '%$f_dependencia%' "; } if ($f_cochera > 0) { $sql_BUSQUEDA .= "AND cochera LIKE '%$f_cochera%' "; } if ($f_ubicacion > 0) { $sql_BUSQUEDA .= "AND ubicacion LIKE '%$f_ubicacion%' "; } if ($f_apto > 0) { $sql_BUSQUEDA .= "AND apto LIKE '%$f_apto%' "; } $sql_BUSQUEDA .= " ORDER BY principal.id DESC"; $result = mysql_query($sql_BUSQUEDA,$conn); } else { $sql_BUSQUEDA = "SELECT * FROM principal FULL JOIN detalles WHERE codigo = '$f_codigo'"; $result=mysql_query($sql_BUSQUEDA,$conn); $row=mysql_fetch_row($result); } ?> Thanks a lot! + _ // Emiliano Boragina _ // Diseño & Comunicación // + _ // emiliano.borag...@gmail.com / // 15 40 58 60 02 /// + _ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] resize 10 upload image
I agree with using ImageMagick. It works much faster than GD and you'll be able to manipulate much larger images. - Original Message - From: "Phpster" To: "Emiliano Boragina" Cc: Sent: Saturday, July 11, 2009 9:13 AM Subject: Re: [PHP-DB] resize 10 upload image On Jul 10, 2009, at 10:18 PM, "Emiliano Boragina" > wrote: Hi again… How do I do to resize more than one image when I upload using php and not any library like the “gd” I have this: $folder="../products"; copy($_FILES['5']['tmp_name'],$folder.'/'.$_FILES['5']['name']); $picture5=$_FILES['5']['name']; copy($_FILES['6']['tmp_name'],$folder.'/'.$_FILES['6']['name']); $picture5=$_FILES['6']['name']; . . . thanks + _ // Emiliano Boragina _ // Diseño & Comunicación // + _ // emiliano.borag...@gmail.com / // 15 40 58 60 02 /// + _ How do you expect to resize an image without using gd, do you have imagemagik installed? Bastien Sent from my iPod -- 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] How to access MySQL through PHP in windows 2K.
Should be simple enough... Do you have the mysqli driver enabled in your php.ini file? ;extension=php_mysqli.dll should become extension=php_mysqli.dll hth, Yves -- Original Message -- Received: Tue, 28 Apr 2009 06:55:37 PM CDT From: "Katiyar \(GMail\)" To: Cc: Subject: [PHP-DB] How to access MySQL through PHP in windows 2K. Praveen's MailHi List, I am new to PHP and as well as with MySQL, a.. I have installed PHP 5.28, on win 2K (with IIS) and it is installed properly I suppose, as when I call phpinfo (), through a script, it shows the PHP Information. b.. then I installed MySQL 5.1.30, and through MySQL command prompt I am able to do things (creating tables, making queries etc). c.. Now I want to use MySQL with PHP, but seems that MySQLI is not installed properly. as when I write a following script in a php page I get the error, that 'MySQLi' is not installed properly,. does not appears to be installed. ' ; } ?> I understand that it is a configuration error somewhere, as I am new here in this world I am unable to figure out what ? I am attaching the php.ini for the reference. Praveen K. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- =-=-=-=-=-=-= Praveen Katiyar Site : http://praveenkatiyar.co.cc =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- =-=-=-=-=-=-= -- 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] Re: PHP and table/view names with '$'
Switch back to double quotes? :-) $stmt = OCIParse($conn, "SELECT * FROM v\$sql WHERE INSTR(SQL_TEXT,'something')>0"); - Original Message - From: "Mark Casson" To: Sent: Thursday, April 23, 2009 6:10 AM Subject: [PHP-DB] Re: PHP and table/view names with '$' Hi, Of course, the next problem is that i want to specify a line to find: $stmt = OCIParse($conn, 'SELECT * FROM v$sql WHERE INSTR(SQL_TEXT,'something')>0'); and i seem to have to use single quotes in the INSTR function. Is there an alternative way to deal with that? Thanks again Mark ""Mark Casson"" wrote in message news:89.4e.33545.c2d30...@pb1.pair.com... Hi, I am trying to access some of the v$ views using php on iis, with admin privileges. However, using: $stmt = OCIParse($conn, "SELECT * FROM v$sql"); gives me this error: PHP Notice: undefined variable: sql . . . Is there a way around this? Thanks Mark -- 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] PHP and table/view names with '$'
Sorry Mark, It's early in the morning... Neil is right. It's a PHP error you're getting after all, not a SQL Server error. And yes, this is by design: double quotes allow for variable insertion/substitution " ". Single quotes don't ' '. However, if you don't want the $ to be interpreted within the double quotes, you should be able to prevent this by using the backslash \ character. So, we get: $name = "Yves"; $name2 = "$name Sucaet";// "Yves Sucaet" $name3 = '$name Sucaet';// "$name Sucaet" $name4 = "\$name Sucaet";// "$name Sucaet" hth, Yves - Original Message - From: To: "Mark Casson" ; Sent: Thursday, April 23, 2009 5:25 AM Subject: RE: [PHP-DB] PHP and table/view names with '$' I find that using single quotes rather than double quotes prevents variable substitution. I don't know if this is an undocumented feature, as the documentation says that both have the same functionality. Regards, Neil -Original Message- From: Mark Casson [mailto:confu...@icube.co.uk] Sent: 23 April 2009 11:04 To: php-db@lists.php.net Subject: [PHP-DB] PHP and table/view names with '$' Hi, I am trying to access some of the v$ views using php on iis, with admin privileges. However, using: $stmt = OCIParse($conn, "SELECT * FROM v$sql"); gives me this error: PHP Notice: undefined variable: sql . . . Is there a way around this? Thanks Mark -- 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] PHP and table/view names with '$'
What if you use back-quotes `` around the table/view name? $stmt = OCIParse($conn, "SELECT * FROM `v$sql`"); - Original Message - From: To: "Mark Casson" ; Sent: Thursday, April 23, 2009 5:25 AM Subject: RE: [PHP-DB] PHP and table/view names with '$' I find that using single quotes rather than double quotes prevents variable substitution. I don't know if this is an undocumented feature, as the documentation says that both have the same functionality. Regards, Neil -Original Message- From: Mark Casson [mailto:confu...@icube.co.uk] Sent: 23 April 2009 11:04 To: php-db@lists.php.net Subject: [PHP-DB] PHP and table/view names with '$' Hi, I am trying to access some of the v$ views using php on iis, with admin privileges. However, using: $stmt = OCIParse($conn, "SELECT * FROM v$sql"); gives me this error: PHP Notice: undefined variable: sql . . . Is there a way around this? Thanks Mark -- 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] MySQL + PHP on WinXP x64 = ?? - clarification
Hi Chris, I don't need 120 concurrent connections. The problem arises from subsequently opening connections and the script is a way to simulate the problem: the first 100 connections e.g. open up fine; then the next 5 mess up; then the next 7 are good to go again etc... I'm using the basic PHP php_mysql.dll driver. I've used MDB2 from PEAR as well: same result. I think both of these use the C API, and not the ODBC-driver. Yves -- Original Message -- Received: Thu, 12 Mar 2009 04:30:33 PM CDT From: Chris To: YVES SUCAET Cc: php-db@lists.php.net Subject: Re: [PHP-DB] MySQL + PHP on WinXP x64 = ?? YVES SUCAET wrote: > Hi List, > > I'm experiencing the problem as described at > http://forums.mysql.com/read.php?37,39779,136287#msg-136287 > > I'm using the following script to test: > > $p = 0; > $n = 0; > for ($i = 0; $i < 120; $i++) { > $conn = mysql_connect("www.myserver.org", "user", "secret"); > if ($conn) { > echo "Success!\n"; > mysql_close($conn); > $p++; > } else { > echo "Failed test $i\n"; > $n++; > } > sleep(1); > } > echo "\n$p successes, $n failures\n"; > ?> > > Results are very unpredictable. E.g. out of 120 connection attempts, I'll have > 114 successes and 6 failures. Well to be honest my question would be why do you need 120 connections in one script? > The solution that's mentioned is to enable connection pooling, yet since I'm > using the x64 edition, that doesn't work for me. Why doesn't it work for you? What package were you going to use for connection pooling? Is there an alternative package to try? -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL + PHP on WinXP x64 = ??
Hi List, I'm experiencing the problem as described at http://forums.mysql.com/read.php?37,39779,136287#msg-136287 I'm using the following script to test: Results are very unpredictable. E.g. out of 120 connection attempts, I'll have 114 successes and 6 failures. The solution that's mentioned is to enable connection pooling, yet since I'm using the x64 edition, that doesn't work for me. Has anybody else run into this problem? And how did you solve it? Thanks in advance, Yves -- Original Message -- Received: Mon, 09 Mar 2009 05:55:55 AM CDT From: Daniel Carrera To: php-db@lists.php.net Subject: Re: [PHP-DB] Re : Problem with PDO exceptions Neil Smith [MVP, Digital media] wrote: > When you create your DB connection $db, follow the connection line > directly after with this : > $db->setAttribute(PDO::ATTR_ERRMODE , PDO::ERRMODE_EXCEPTION); > > The default is I believe PDO::ERRMODE_SILENT which is confusing to most > people the first time. Thanks! It works now. Cheers, Daniel. -- 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] re:looking for SQL documentation tool
The professional version of SQLyog (http://www.sqlyog.com) has this capability. It's not free though. If you're looking for a free tool, I think the standard out there is DBDesigner: http://www.fabforce.net/dbdesigner4/ Alternatively, I once wrote a tool that automatically converted a SQL create table script to a GraphViz .dot file (http://www.graphviz.org). Depending on how fluent you are with parsers and SQL DDL, that's an option as well. An added plus is that you can completely customize your output and choose different layout-algorithms (dot, twopi, ...) hth, Yves - Original Message - From: "mrfroasty" To: "PHP DB" Sent: Wednesday, March 04, 2009 4:45 AM Subject: [PHP-DB] re:looking for SQL documentation tool Hello guysis there any tool that can create data relation from sql document?I have seen phpmyadmin, but still I am looking for other software to see what they have to offer... Thanks -- Extra details: OSS:Gentoo Linux-2.6.25-r8 profile:x86 Hardware:msi geforce 8600GT asus p5k-se location:/home/muhsin language(s):C/C++,VB,VHDL,bash Typo:40WPM url:http://mambo-tech.net -- 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] DAL in Java, now what?
Hi list, After writing an OO-based set of database-interaction routines in PHP, I recently rewrote this preliminary API in Java to satisfy our desktop-developers. So now I have a DAL (Data Abstraction Layer) in Java and in PHP. I'd rather get rid of one of these, since maintenance on two API causes some serious overhead. I'm inclined to retaining only the Java-version, but I can't seem to find any good documentation on best practices on how to call Java from within PHP. The examples provided at http://us.php.net/manual/en/java.examples-basic.php seem elegant enough, except that I can't find the PECL php_java.dll anywhere. Another project http://php-java-bridge.sourceforge.net/pjb/ seems to rely on Apache and LAMP installations all-together, and is therefore not an option for my Windows/IIS setup. Has anybody tried something similar and been succesful? Thanks in advance, Yves Sucaet Iowa State University http://metnet3.vrac.iastate.edu -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: TAKE A LOOK AT THIS (SQL)
Your problem is in "SELECT e1.*, l1.*": the selected fields have to match the ones in the GROUP BY clause, so something like: SELECT a, b, c, SUM(d) ... GROUP BY a, b, c hth, Yves -- Original Message -- Received: Tue, 13 Jan 2009 09:24:48 AM CST From: Abah Joseph To: Yves Sucaet Subject: TAKE A LOOK AT THIS (SQL) SELECT e1.*, l1.*, SUM(a1.adp_amount) as amount FROM e1, l1, a1 WHERE (e1.entre_active = 'Y') AND (l1.entreID = e1.entre_id) AND (l1.loanId = a1.adp_loanID) GROUP BY e1.entre_fname, a1.adp_amount This is a very poor query to me, but so far, it works, but i am still testing different thing, what you gave to me would have been the best and professional but it keep returning error. check the email i sent before this one On Tue, Jan 13, 2009 at 5:55 AM, Yves Sucaet wrote: > Oops, actually forgot my GROUP BY clause. The full query is: > > SELECT e1.field1, e1.field2, l1.field3, SUM(a1.adp_amount) as amount > FROM a1 > inner join e1 on (e1.loanID = a1.adp_loanID) > inner join l1 on (l1.entreID = e1.entre_ID) > WHERE e1.entre_active = 'Y' > GROUP BY e1.field1, e1.field2, l1.field3 > > hth, > > Yves > > - Original Message - From: "Yves Sucaet" > To: > Sent: Tuesday, January 13, 2009 7:49 AM > Subject: Re: [PHP-DB] help me JOIN 3 tables. > > > Hi Joseph, >> >> With the sum() aggregate function you'll need to use a GROUP BY clause and >> specify which fields you want from e1 and l1. Something like this: >> >> SELECT e1.field1, e1.field2, l1.field3, SUM(a1.adp_amount) as amount >> FROM a1 inner join e1 on (e1.loanID = a1.adp_loanID) inner join l1 on >> (l1.entreID = e1.entre_ID) >> WHERE e1.entre_active = 'Y' >> >> hth, >> >> Yves >> >> - Original Message - From: "Abah Joseph" >> To: >> Sent: Tuesday, January 13, 2009 6:46 AM >> Subject: [PHP-DB] help me JOIN 3 tables. >> >> >> I have this SQL >>> >>> SELECT e1.*, l1.* FROM e1 >>> INNER JOIN l1 WHERE e1.entre_active = 'Y' AND l1.entreID = e1.entre_id >>> >>> The above query works but i want to add the one below >>> >>> SELECT SUM(a1.adp_amount) as amount FROM a1 WHERE a1.adp_loanID = >>> e1.loanID; >>> >>> the last part of the query is to SUM the part payment made on table 'l1' >>> and >>> return total raised with the first query. >>> >>> the whole idea is three tables, (business, loan, raised), loan referenced >>> ID >>> from business, raised referenced ID from loan. >>> >>> loan maybe $300 and it can be raised over time till completed, so all the >>> amount raised + the loanId will be stored inside the raised table. >>> >>> 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 > > -- I develop dynamic website with PHP & MySql, Let me know about your site -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help me JOIN 3 tables. - fixed query
Oops, actually forgot my GROUP BY clause. The full query is: SELECT e1.field1, e1.field2, l1.field3, SUM(a1.adp_amount) as amount FROM a1 inner join e1 on (e1.loanID = a1.adp_loanID) inner join l1 on (l1.entreID = e1.entre_ID) WHERE e1.entre_active = 'Y' GROUP BY e1.field1, e1.field2, l1.field3 hth, Yves - Original Message - From: "Yves Sucaet" To: Sent: Tuesday, January 13, 2009 7:49 AM Subject: Re: [PHP-DB] help me JOIN 3 tables. Hi Joseph, With the sum() aggregate function you'll need to use a GROUP BY clause and specify which fields you want from e1 and l1. Something like this: SELECT e1.field1, e1.field2, l1.field3, SUM(a1.adp_amount) as amount FROM a1 inner join e1 on (e1.loanID = a1.adp_loanID) inner join l1 on (l1.entreID = e1.entre_ID) WHERE e1.entre_active = 'Y' hth, Yves - Original Message - From: "Abah Joseph" To: Sent: Tuesday, January 13, 2009 6:46 AM Subject: [PHP-DB] help me JOIN 3 tables. I have this SQL SELECT e1.*, l1.* FROM e1 INNER JOIN l1 WHERE e1.entre_active = 'Y' AND l1.entreID = e1.entre_id The above query works but i want to add the one below SELECT SUM(a1.adp_amount) as amount FROM a1 WHERE a1.adp_loanID = e1.loanID; the last part of the query is to SUM the part payment made on table 'l1' and return total raised with the first query. the whole idea is three tables, (business, loan, raised), loan referenced ID from business, raised referenced ID from loan. loan maybe $300 and it can be raised over time till completed, so all the amount raised + the loanId will be stored inside the raised table. 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] help me JOIN 3 tables.
Hi Joseph, With the sum() aggregate function you'll need to use a GROUP BY clause and specify which fields you want from e1 and l1. Something like this: SELECT e1.field1, e1.field2, l1.field3, SUM(a1.adp_amount) as amount FROM a1 inner join e1 on (a1.loanID = a1.adp_loanID) inner join l1 on (l1.entreID = e1.entre_ID) WHERE e1.entre_active = 'Y' hth, Yves - Original Message - From: "Abah Joseph" To: Sent: Tuesday, January 13, 2009 6:46 AM Subject: [PHP-DB] help me JOIN 3 tables. I have this SQL SELECT e1.*, l1.* FROM e1 INNER JOIN l1 WHERE e1.entre_active = 'Y' AND l1.entreID = e1.entre_id The above query works but i want to add the one below SELECT SUM(a1.adp_amount) as amount FROM a1 WHERE a1.adp_loanID = e1.loanID; the last part of the query is to SUM the part payment made on table 'l1' and return total raised with the first query. the whole idea is three tables, (business, loan, raised), loan referenced ID from business, raised referenced ID from loan. loan maybe $300 and it can be raised over time till completed, so all the amount raised + the loanId will be stored inside the raised table. Thank you -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQLDump through PHP/HTML UI
What PHP-function/command are you using to invoke the mysqldump command? Try including a flush() statement right before you start dumping. I don't know why it works, but it's solved some of my problems in the past. Must be something with buffer management. hth, Yves - Original Message - From: "Ken Kixmoeller.com" <[EMAIL PROTECTED]> To: Sent: Wednesday, December 10, 2008 11:38 AM Subject: Re: [PHP-DB] MySQLDump through PHP/HTML UI Merci, Yves - -- It takes the blink of an eye. It seems like none of the string is running at all. Also, yeah, the slashes thing used to trip me up, too, when I first started working around Linux boxes. However, the file *is* being created and it is in the right place, just nothing in it. Ken On Dec 10, 2008, at 9:43 AM, Yves Sucaet wrote: Hi Ken, How long does the mysqldump operation last? Maybe it's a script timeout problem? And maybe you have different settings on both machines? Other idea: what about pathnames? Linux uses "/" to separate paths, Windows uses "\". That's all I have for now, Yves - Original Message - From: "phphelp -- kbk" <[EMAIL PROTECTED]> To: Sent: Wednesday, December 10, 2008 9:32 AM Subject: [PHP-DB] MySQLDump through PHP/HTML UI Hello - - -- - I have a utility which creates a MySQLDump of selected tables or the whole database. This works fine on my development machine, a W2K box. It does not work on the testing server, a linux box. I'll post code if you want, but it is very simple: 1. I create the "dump" language, including the file into which the data is dumped into a variable. 2. I perform system($dump_language). I also tried it exec ($dump_language). Both produce the same result: The file is created (the directory is one for which the application has r/w rights). In Windoze, the file is complete and perfect. On the Linux box, only the header information of the dump file is written, nothing about any database or table. Any ideas? Thank you, Ken -- 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] MySQLDump through PHP/HTML UI
Hi Ken, How long does the mysqldump operation last? Maybe it's a script timeout problem? And maybe you have different settings on both machines? Other idea: what about pathnames? Linux uses "/" to separate paths, Windows uses "\". That's all I have for now, Yves - Original Message - From: "phphelp -- kbk" <[EMAIL PROTECTED]> To: Sent: Wednesday, December 10, 2008 9:32 AM Subject: [PHP-DB] MySQLDump through PHP/HTML UI Hello - - -- - I have a utility which creates a MySQLDump of selected tables or the whole database. This works fine on my development machine, a W2K box. It does not work on the testing server, a linux box. I'll post code if you want, but it is very simple: 1. I create the "dump" language, including the file into which the data is dumped into a variable. 2. I perform system($dump_language). I also tried it exec ($dump_language). Both produce the same result: The file is created (the directory is one for which the application has r/w rights). In Windoze, the file is complete and perfect. On the Linux box, only the header information of the dump file is written, nothing about any database or table. Any ideas? Thank you, Ken -- 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] Value of $_POST['submit']
Hi Steve, He's using Ajax, so some variant of the XMLHttpRequest Javascript object on the client. It may not be obvious which method is used when the data is sent. Now that I think of it, printing $_SERVER[REQUEST_METHOD] should let you know which one is being used. hth. Yves -- Original Message -- Received: Thu, 27 Nov 2008 08:48:08 PM CST From: "Martin, Steve \(MAN-Corporate\)" <[EMAIL PROTECTED]> To: "Yves Sucaet" <[EMAIL PROTECTED]>, Subject: RE: [PHP-DB] Value of $_POST['submit'] When I'm developing a number of pages and don't keep track of every variable or form name (etc), I plant a print_r($_POST); at the top of the page, so there's no guessing what gets sent to the page . . . If you have an empty $_POST array, then the isn't using action=post, or you didn't code your button as type="submit" (?) Just suggestions - since I can't see the code. Steve - Original Message - From: "Ron Piggott" <[EMAIL PROTECTED]> To: "PHP DB" Sent: Thursday, November 27, 2008 7:02 PM Subject: [PHP-DB] Value of $_POST['submit'] >I am working on the following web page tonight: > http://www.actsministrieschristianevangelism.org/verseoftheday/ > > I am trying to program the "Load Previous Issue" "Random Issue" and > "Load Next Issue" buttons. > > I am using Ajax to pass the date the user is requesting to the PHP > script for processing. > > I am wondering how my PHP script may access the value of value of > $_POST['submit']. At present echo $_POST['submit']; doesn't give me a > value. Consequently all queries to the mySQL database fail. > > Ron > > > -- > 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] Value of $_POST['submit']
Hi Ron, What's your Javascript client-side code to invoke the PHP-script? You may need to switch to $_GET[] instead of $_POST... Yves - Original Message - From: "Ron Piggott" <[EMAIL PROTECTED]> To: "PHP DB" Sent: Thursday, November 27, 2008 7:02 PM Subject: [PHP-DB] Value of $_POST['submit'] I am working on the following web page tonight: http://www.actsministrieschristianevangelism.org/verseoftheday/ I am trying to program the "Load Previous Issue" "Random Issue" and "Load Next Issue" buttons. I am using Ajax to pass the date the user is requesting to the PHP script for processing. I am wondering how my PHP script may access the value of value of $_POST['submit']. At present echo $_POST['submit']; doesn't give me a value. Consequently all queries to the mySQL database fail. Ron -- 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] PHP MySQL Driver Choice -- Fastest?
How does the "default" php_mysql.dll compare to these? Is mysqli faster than mysql? tia, Yves -- Original Message -- Received: Wed, 19 Nov 2008 04:00:46 PM CST From: Chris <[EMAIL PROTECTED]> To: Micah Gersten <[EMAIL PROTECTED]>Cc: PHP DB Subject: Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest? Micah Gersten wrote: > Which is the fastest driver for this? > ADODB > PDO > mysqli Either mysqli or pdo since they'd deal with the mysql client directly. ADODB is a php library, so it's not going to be as fast because you have php code overhead. -- Postgresql & php tutorials http://www.designmagick.com/ -- 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] Can MySql handle Large data?
Just my two cents, but I doubt if Yahoo uses the same implementation of MySQL as we do. They probably have a tweaked version of it that fits their needs better than the free public version. Bare in mind too that MySQL *is* a commercial company, even more so now they've been acquired by Sun. That being said: The largest table I've had so far has 1 million+ records in it. No problems with performance, but much depends on how you define indexes and how you write your queries obviously. I think design is more important than size! Yves - Original Message - From: "Abah Joseph" <[EMAIL PROTECTED]> To: Sent: Monday, November 17, 2008 11:15 AM Subject: [PHP-DB] Can MySql handle Large data? I want to quickly ask if MySql can handle large data like 10 – 20 million rows in one database (e.g member table) The question came to my mind is, How did large website like Yahoo handle such data? Sure. Yahoo users may be more than 20 millions users or so. Users will have -permission table -profile table -page table and so on, so query will be perform on 2 or three tables same time, i`m trying to check the speed, performance and risk . I need your advice on how to handle such data and the best structure to use. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] SQL Server Express 2008
Hello, Anybody knows how to make PHP connect to Microsoft SQL Server Express 2008? I know about the php_mssql extension, but that's apparently only the beginning. What else do I need to do, assuming I have a standard SQLServer setup... Thanks in advance, Yves
Re: [PHP-DB] PHP Exercises
Hi Twaha, Have a look at a short-course curriculum that we developed over summer: http://lab.bcb.iastate.edu/training/webdev/nmsu/ hth, Yves - Original Message - From: "Twaha Uddessy" <[EMAIL PROTECTED]> To: Sent: Friday, October 31, 2008 2:19 AM Subject: [PHP-DB] PHP Exercises Hello all, Iam new here,trying hard to study PHP.Can anyone help me with a link where I can get PHP exercises and possible solution?. Thank you in advance -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] using database without mysql installed
Well, *technicaly*... you could open a socket to the MySQL server and talk to it, but that's probably a bit much, so... You never mentioned what kind of server this is. Is this on *nix or Windows? And do you have access to the php.ini file at least so you can enable the mysql extension? Other than that, I think your idea of putting a script on a second server to get your data would work just fine. You could have the second script even send back your requested data in XML or use Ajax to populate tables on the client-side rather than the server side. It may even make your application run more smoothly (and definitely scalable). HTH, Yves -- Original Message -- Received: Fri, 24 Oct 2008 03:35:47 PM CDT From: "Patrick Price" <[EMAIL PROTECTED]> To: Subject: [PHP-DB] using database without mysql installed I am trying to access a mysql database server from a php 5.2 server that doesn't have mysql installed on it. I don't have access or the ability to reinstall php on this server. Is it possible to install mysql after php is installed and up and running? If it is not possible, what would be the best solution to accessing the database? The best solution I could think of would be to require a php file that is running on a server that I have control of and that has mysql installed and using that file to call the database to get the information I need. Thanks for any help. Patrick -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] query optimization - DB
Hi Micah, I'm learning here. Great! :-) How can I look this up? I'm pretty sure multiple fields are indexed. So should I specify explicitely which indices should be used? What fields do you think should be indexed? I do have control over the database and can create additional indices. Can you help out rewriting the query using EXISTS syntax? Thanks in advance, Yves - Original Message - From: "Micah Gersten" <[EMAIL PROTECTED]> To: Sent: Friday, September 26, 2008 11:47 AM Subject: Re: [PHP-DB] query optimization - DB MySQL queries use 1 index per table, so to speed the query, we need to know what indices you have for the 2 tables. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Yves Sucaet wrote: Oh, sorry I forgot to mention this. It's a MySQL database. - Original Message - From: "Micah Gersten" <[EMAIL PROTECTED]> To: "YVES SUCAET" <[EMAIL PROTECTED]> Cc: Sent: Thursday, September 25, 2008 7:55 PM Subject: Re: [PHP-DB] query optimization Other question is, what DB is this for? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com YVES SUCAET wrote: How could I rewrite the following query so it runs faster: select distinct location from blockunit where blockid in ( select bu.blockid from blockunit bu inner join interactionparts ip on (bu.blockid = ip.part) where ip.blockid in (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087, 124088,124562,124563,133358,133359,133409,133410,135304,135305,136096) union select bu.blockid from blockunit bu where bu.blockid in (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087, 124088,124562,124563,133358,133359,133409,133410,135304,135305,136096) ) Thanks in advance, Yves -- 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 optimization - DB
Oh, sorry I forgot to mention this. It's a MySQL database. - Original Message - From: "Micah Gersten" <[EMAIL PROTECTED]> To: "YVES SUCAET" <[EMAIL PROTECTED]> Cc: Sent: Thursday, September 25, 2008 7:55 PM Subject: Re: [PHP-DB] query optimization Other question is, what DB is this for? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com YVES SUCAET wrote: How could I rewrite the following query so it runs faster: select distinct location from blockunit where blockid in ( select bu.blockid from blockunit bu inner join interactionparts ip on (bu.blockid = ip.part) where ip.blockid in (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087, 124088,124562,124563,133358,133359,133409,133410,135304,135305,136096) union select bu.blockid from blockunit bu where bu.blockid in (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087, 124088,124562,124563,133358,133359,133409,133410,135304,135305,136096) ) Thanks in advance, Yves -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] query optimization
Hi Jack, I'm expecting less than 10 records in the resulting set. The BlockUnit table contains 337,253 records; the InteractionParts table contains 279,953 records. It takes currently 8.3 seconds to execute the query as I have it. Erh, this is embarassing but I'm going to need some help re-writing it with EXISTS... Thanks for the help so far, Yves - Original Message - From: Jack van Zanen To: Chris Cc: YVES SUCAET ; php-db@lists.php.net Sent: Thursday, September 25, 2008 7:49 PM Subject: Re: [PHP-DB] query optimization If you can answer the other questions that would help as well you can try rewriting using "exist" instead of "in" But without the basic information like number of records expected and explain plan it is very hard to come up with a better solution. Brgds Jack 2008/9/26 Chris <[EMAIL PROTECTED]> Jack van Zanen wrote: Hi If I am not mistaken, the second part of the union contains all rows that are in the first part of the union. just remove the first part. Kind of. The first part is a join, the second isn't. I was going to suggest rewriting the subquery into a single: where ip.blockid in (...) or bu.blockid in (...) however that'll probably be slower, but def. worth a try. -- Postgresql & php tutorials http://www.designmagick.com/ -- J.A. van Zanen
[PHP-DB] query optimization
How could I rewrite the following query so it runs faster: select distinct location from blockunit where blockid in ( select bu.blockid from blockunit bu inner join interactionparts ip on (bu.blockid = ip.part) where ip.blockid in (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087, 124088,124562,124563,133358,133359,133409,133410,135304,135305,136096) union select bu.blockid from blockunit bu where bu.blockid in (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087, 124088,124562,124563,133358,133359,133409,133410,135304,135305,136096) ) Thanks in advance, Yves -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Insert a xml file into a DB
Why do you need to store the files in a database? Can't you just keep them on the hard disk and query them with DOM? -- Original Message -- Received: Tue, 23 Sep 2008 03:55:25 PM CDT From: ERNESTO PENALOZA <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] Insert a xml file into a DB Hi there, I've been trying to insert (and retrieve) a xml file into a postgres DB into a BLOB field, using some nice examples downloaded from the net, but they don't seem to work. Is there a "standard" way to do this? I read about a bytea data type and run some examples, but never understood how this data type works. When I retrieve the data, all I could see was a number. What should I do with this number? How can I use it to see the xml file content.? Thank you in advance. -- 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] Matrix programming
You don't need a matrix for parent-child relations, you need a tree. Try getting a copy of Joe Celko's book. It's pretty much the bible on recursive SQL as I understand it: http://www.amazon.com/Hierarchies-Smarties-Kaufmann-Management-Systems/dp/1558609202/ hth, Yves -- Original Message -- Received: Tue, 23 Sep 2008 04:09:30 PM CDT From: "A. Joseph" <[EMAIL PROTECTED]> To: "YVES SUCAET" <[EMAIL PROTECTED]> Subject: Re: [PHP-DB] Matrix programming LIKE.. remember every child is also parent parent on level 0 earn 5% of each fee paid by left leg downline earn 3% of each fee paid by right leg downline parent on level 1 earn $5 parent on level2 earn $4 after this first deal another deal started from level 1 Now what take the parent to those levels? parent bring 3 Ps, each 3 Ps bring 3 Es. parent move to level 0 3 Es bring 3 Fs and 3 Fs bring 3 Gs each. parent move to level 1 remember 3 Ps will now move to level 0, when parent move to level 1 something like that, i want to learn how to code it myself. if matrix caculation is a wrong terms for this, then i`m sorry. On 9/23/08, YVES SUCAET <[EMAIL PROTECTED]> wrote: > > I don't quite see where the matrix-calculations come in. > > -- Original Message -- > Received: Tue, 23 Sep 2008 03:41:51 PM CDT > From: "A. Joseph" <[EMAIL PROTECTED]> > To: "YVES SUCAET" <[EMAIL PROTECTED]> > Subject: Re: [PHP-DB] Matrix programming > > Multi level marketing, data will be arranged in hierarchical structure, the > system will need to auto pay when user get to some level or have specific > amount if people under him/she, I think u understand how MLM works? > > > > Thank u > > > On 9/23/08, YVES SUCAET <[EMAIL PROTECTED]> wrote: > > > > Do you mean multi level marketing? What kind of matrix calculations? What > > sort > > of data do the matrices include? > > > > And what does this have to do with databases? Do you need to store matrix > > data > > in your db? > > > > -- Original Message -- > > Received: Tue, 23 Sep 2008 12:29:40 PM CDT > > From: "A. Joseph" <[EMAIL PROTECTED]> > > To: "Micah Gersten" <[EMAIL PROTECTED]>Cc: "php list" < > > php-db@lists.php.net> > > Subject: [PHP-DB] Matrix programming > > > > I need to do some stuff on MLM system so i will be using matrix > caculation, > > i need a tutorial on it. > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > I develop dynamic website with PHP & MySql, Let me know about your site > > > > > -- I develop dynamic website with PHP & MySql, Let me know about your site -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Matrix programming
Do you mean multi level marketing? What kind of matrix calculations? What sort of data do the matrices include? And what does this have to do with databases? Do you need to store matrix data in your db? -- Original Message -- Received: Tue, 23 Sep 2008 12:29:40 PM CDT From: "A. Joseph" <[EMAIL PROTECTED]> To: "Micah Gersten" <[EMAIL PROTECTED]>Cc: "php list" Subject: [PHP-DB] Matrix programming I need to do some stuff on MLM system so i will be using matrix caculation, i need a tutorial on it. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] databases and XML
Well, we're actually in the process of developing a DB that's only accessible through XML/XQuery. But before we add new features it would be good to get an idea of what the needs are "in the field", sort of speak. So instead of artifically trying to map a DTD to an RDBMS scheme, our engine can accept any XML-content that you want to put into it. After that, it's simply a matter of firing XQuery statements to the engine to get the data you want. We're thinking about building a PHP driver in order to offer outside connectivity (right now GUI and engine are too tightly coupled). Ideas, considerations, thoughts, suggestions...? -- Original Message -- Received: Tue, 09 Sep 2008 10:29:57 AM CDT From: Lester Caine <[EMAIL PROTECTED]> To: php-db@LISTS.PHP.NET Subject: Re: [PHP-DB] databases and XML Yves Sucaet wrote: > Hi List, > > I was wondering what strategies people are using to handle large volumes of XML data: > > How do you store the data? e.g.: Text-files, databases (which one)...? > How big are your datasets? e.g.: MB, GB, TB...? > What do you use to query the data? e.g.: PHP w/ text-files, SQLServer with "for xml" clause...? > > Finally, what limitations do you experience currently when handling XML? Take a look at openstreetmap.org http://wiki.openstreetmap.org/index.php/Planet is several GB of XML data. The only way of handling it to use it IS via a database, and it has scripts to dump it to various databases. So what large volume are you thinking about? -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.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-DB] databases and XML
Hi List, I was wondering what strategies people are using to handle large volumes of XML data: How do you store the data? e.g.: Text-files, databases (which one)...? How big are your datasets? e.g.: MB, GB, TB...? What do you use to query the data? e.g.: PHP w/ text-files, SQLServer with "for xml" clause...? Finally, what limitations do you experience currently when handling XML? Thanks in advance, Yves
Re: [PHP-DB] Getting started with MDB2 - got it!
My problem was that my SQL class is a wrapper around MDB2. Obviously the SQL class didn't have a lastInsertID() method of its own (but now it does!): public function InsertID() { return $this->db->lastInsertID(); } Thanks for all the help, Yves -- Original Message -- Received: Mon, 08 Sep 2008 02:02:44 PM CDT From: "Evert Lammerts" <[EMAIL PROTECTED]> To: "YVES SUCAET" <[EMAIL PROTECTED]>Cc: php-db@lists.php.net, [EMAIL PROTECTED] Subject: Re: [PHP-DB] Getting started with MDB2 Have a look at this: http://wiki.pooteeweet.org/index.php?area=MDB2&page=ExampleS&view=diff&to=2006-05-25%2010:27:49&from=2006-03-22%2011:08:24 It loads the Extended module On Mon, Sep 8, 2008 at 8:55 PM, YVES SUCAET <[EMAIL PROTECTED]> wrote: > Interesting. I'm following the documentation at > http://pear.php.net/manual/en/package.database.mdb2.intro-sequences.php > > Here's my code: > >$sql = new SQL(); >$sql->connect(DSN_METNET3_MY_EDIT); >$qry = "insert into List(lstName, lstNotes, UserName) values ($name, > $notes, $user)"; >$sql->query($qry); >return $sql->lastInsertID("List"); > > I'm now getting the following error message: Call to undefined method > SQL::lastInsertID() > > Any further clues? > > Yves > > -- Original Message -- > Received: Mon, 08 Sep 2008 01:29:42 PM CDT > From: "Evert Lammerts" <[EMAIL PROTECTED]> > To: "YVES SUCAET" <[EMAIL PROTECTED]>Cc: php-db@lists.php.net > Subject: Re: [PHP-DB] Getting started with MDB2 > >> * mysql_last_insert_id() > > getAfterId() > > http://pear.php.net/reference/LiveUser_Admin-0.3.3/LiveUser_Admin/LiveUser_Admin_Storage_MDB2.html#methodgetAfterId > >> * mysql_real_escape_string() > > escape() > > http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Common.html#methodescape > > -- > 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] Getting started with MDB2
Interesting. I'm following the documentation at http://pear.php.net/manual/en/package.database.mdb2.intro-sequences.php Here's my code: $sql = new SQL(); $sql->connect(DSN_METNET3_MY_EDIT); $qry = "insert into List(lstName, lstNotes, UserName) values ($name, $notes, $user)"; $sql->query($qry); return $sql->lastInsertID("List"); I'm now getting the following error message: Call to undefined method SQL::lastInsertID() Any further clues? Yves -- Original Message -- Received: Mon, 08 Sep 2008 01:29:42 PM CDT From: "Evert Lammerts" <[EMAIL PROTECTED]> To: "YVES SUCAET" <[EMAIL PROTECTED]>Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Getting started with MDB2 > * mysql_last_insert_id() getAfterId() http://pear.php.net/reference/LiveUser_Admin-0.3.3/LiveUser_Admin/LiveUser_Admin_Storage_MDB2.html#methodgetAfterId > * mysql_real_escape_string() escape() http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Common.html#methodescape -- 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] Getting started with MDB2
Hi List, What are the equivalent MDB2 methods for: * mysql_last_insert_id() * mysql_real_escape_string() Much obliged, Yves -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with updating MySQL table
Ah, how to debug SQL code in PHP... Here's what I would do: run your query separately in something like SQLyog or the Netbeans database interface. Just to "echo $sql" and copy and paste. An "echo $Record" statement may also help to assure that you're passing on the PK to the record correctly. One suggestion: you may want put mysql_real_escape_string() wrappers around all those $_POST[] fields to prevent SQL hijacking of your site. HTH, Yves -- Original Message -- Received: Wed, 27 Aug 2008 11:07:20 AM CDT From: Jason Pruim <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] Problem with updating MySQL table Hi Everyone, So I'm working on a project (Same one I sent the question about regarding the user access rights on monday) And now I am attempting to update the record... Here is some of my code: index.php First Name/Last Name Email Address Company name Company Address City/State/Zip Phone Your Favorite Type of coffee: Other: When would a good time to bring it over be? ?> purlprocessing.php mysql> describe schreur; ++-+--+-+-+---+ | Field | Type| Null | Key | Default | Extra | ++-+--+-+-+---+ | FName | varchar(20) | YES | | NULL| | | LName | varchar(20) | YES | | NULL| | | email | varchar(50) | YES | | NULL| | | phone | varchar(12) | YES | | NULL| | | url| int(12) | YES | | NULL| | | record | int(7) | YES | | NULL| | | subscribed | int(1) | NO | | | | | date | varchar(12) | YES | | NULL| | | IPAddress | varchar(19) | YES | | NULL| | | Business | varchar(20) | YES | | NULL| | | Address1 | varchar(50) | YES | | NULL| | | City | varchar(20) | YES | | NULL| | | State | varchar(2) | YES | | NULL| | | Zip| varchar(10) | YES | | NULL| | | Coffee | varchar(20) | YES | | NULL| | | Meeting| text| YES | | NULL| | ++-+--+-+-+---+ The problem is when I am attempting to update some of the info, it erases the info in the field. Anyone got a clue as to what is going on? :) Thanks for looking! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mathematical discrepancies
Well, yes, it is expected behavior. I think you're confusing the abs() with the round() function (see Evert's answer earlier). abs(-1.05) = 1.05 round(-1.05) = -1 abs(1.35) = 1.35 round(1.35) = 1 hth, Yves - Original Message - From: "Andrew Martin" <[EMAIL PROTECTED]> To: Sent: Thursday, August 14, 2008 7:55 AM Subject: [PHP-DB] mathematical discrepancies Hello, Can anybody shed any light on this behaviour please? PHP Version 5.2.5 on XP $a = 1754.00 ; $b = 1754.03 ; $diff = abs($b) - abs($a); echo "$diff"; //output: 0.03 $a = 1754.00 ; $b = 1754.09 ; $diff = abs($b) - abs($a); echo "$diff"; //output :0.08999 $a = 1754.01 ; $b = 1754.02 ; $diff = abs($b) - abs($a); echo $diff; //output: 0.00 Is this expected behaviour? Can anybody reproduce this? Many thanks, Andy -- 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] I want to remove the last comma
Ah, I forgot the \n newline character you're adding as well. That would require you to chop off two character instead of one :-) Here's the adjusted script: $dir = "images"; $d = opendir($dir); $out = " var tinyMCEImageList = new Array(\n"; while(false != ($entry = readdir($d))) { if(preg_match("/(.jpg|.gif|.png)$/", $entry) != false) { $out .= "['{$entry}', '{$dir}/{$entry}'],\n"; } } $out = substr($out, 0, strlen($out) - 2); // MY LINE $out .= ");\n"; hth, Yves -- Original Message -- Received: Tue, 12 Aug 2008 03:08:41 PM CDT From: "A. Joseph" <[EMAIL PROTECTED]> To: "YVES SUCAET" <[EMAIL PROTECTED]> Subject: Re: [PHP-DB] I want to remove the last comma I tried all this, all i want is something line this var tinyMCEImageList = new Array( ['1_h_1.gif', 'images/1_h_1.gif'], ['1_h_1.gif', 'images/1_h_1.gif'] ); But this what i got var tinyMCEImageList = new Array( ['1_h_1.gif', 'images/1_h_1.gif'], ['1_h_1.gif', 'images/1_h_1.gif'], ); Remember the last commad on the last element. please show some example code On Tue, Aug 12, 2008 at 12:36 PM, YVES SUCAET <[EMAIL PROTECTED]> wrote: > > $out = substr($out, 0, strlen($out) - 1); > > Removes the overhead cost of creating the array and then joining it. > > HTH, > > Yves > > -- Original Message -- > Received: Tue, 12 Aug 2008 02:31:28 PM CDT > From: Micah Gersten <[EMAIL PROTECTED]> > To: "A. Joseph" <[EMAIL PROTECTED]>Cc: php-db@lists.php.net > Subject: Re: [PHP-DB] I want to remove the last comma > > Create an Array in the loop and then join with ",\n". > > A. Joseph wrote: > > This the script > > $dir = "images"; > > $d = opendir($dir); > > $out = " > > var tinyMCEImageList = new Array(\n"; > > while(false != ($entry = readdir($d))) { > > if(preg_match("/(.jpg|.gif|.png)$/", $entry) != false) { > > $out .= "['{$entry}', '{$dir}/{$entry}'],\n"; > > } > > > > } > > $out .= ");\n"; > > > > This the out put > > > > var tinyMCEImageList = new Array( > > ['1_h_1.gif', 'images/1_h_1.gif'], > > ['1_h_2.gif', 'images/1_h_2.gif'], > > ['rss_2.jpg', 'images/rss_2.jpg'], > > ['spacer.gif', 'images/spacer.gif'], # I want to remove this comma > > ); > > > > if the last element (['spacer.gif', 'images/spacer.gif'],) contain comma, > > javascript will return error, so i want to remove it. > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] I want to remove the last comma
$out = substr($out, 0, strlen($out) - 1); Removes the overhead cost of creating the array and then joining it. HTH, Yves -- Original Message -- Received: Tue, 12 Aug 2008 02:31:28 PM CDT From: Micah Gersten <[EMAIL PROTECTED]> To: "A. Joseph" <[EMAIL PROTECTED]>Cc: php-db@lists.php.net Subject: Re: [PHP-DB] I want to remove the last comma Create an Array in the loop and then join with ",\n". Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com A. Joseph wrote: > This the script > $dir = "images"; > $d = opendir($dir); > $out = " > var tinyMCEImageList = new Array(\n"; > while(false != ($entry = readdir($d))) { > if(preg_match("/(.jpg|.gif|.png)$/", $entry) != false) { > $out .= "['{$entry}', '{$dir}/{$entry}'],\n"; > } > > } > $out .= ");\n"; > > This the out put > > var tinyMCEImageList = new Array( > ['1_h_1.gif', 'images/1_h_1.gif'], > ['1_h_2.gif', 'images/1_h_2.gif'], > ['rss_2.jpg', 'images/rss_2.jpg'], > ['spacer.gif', 'images/spacer.gif'], # I want to remove this comma > ); > > if the last element (['spacer.gif', 'images/spacer.gif'],) contain comma, > javascript will return error, so i want to remove it. > > -- 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] How to import data from Oracle 10g to MySQL 5.0
Depending on how much data we're talking about, the PHPMyAdmin may not be the best solution. Microsoft SQL Server has a DTS (data transformation services) that will convert anything into anything (as long as *it* has a ODBC or OLEDB driver). Yves - Original Message - From: "santoso berkah" <[EMAIL PROTECTED]> To: Sent: Wednesday, July 30, 2008 10:24 PM Subject: [PHP-DB] How to import data from Oracle 10g to MySQL 5.0 Dear friends, I would ask to you about the tools or references for importing data from Oracle 10g to MySQL 5. Thank you for your kindness. Regards, im_id -- 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] MDB2 help needed
Thanks for trying to help, but that's what I'm doing already. I already know if something's wrong. But instead of a MySQL error reference I'm only getting "MDB2 Error: syntax error" in return from the getMessage() function. I want to obtain more info regarding the error (such as foreign key constraint incompatilibities). Obviously I can copy the query subsequently to SQLyog or another tool, but that takes more time. Yves -- Original Message -- Received: Thu, 12 Jun 2008 10:25:02 AM CDT From: Laura Longo <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: Re: [PHP-DB] MDB2 help needed Hi Yves, to understand if an error is occured you can use the static method Pear::isError($db) where $db is an instance of MDB2 object. To get the specific error you can use the MDB2 method getMessage() ($db->getMessage()). Hope this help, Laura > Hello, > > What's the equivalent of mysql_error() and mysql_errno() in MDB2? > > When I'm sending an incorrect SQL-statement to the server and it fails, all > I'm getting is "MDB2 Error: syntax error". > > Thanks in advance, > > Yves Sucaet > Iowa State University > > > -- 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] MDB2 help needed
Hello, What's the equivalent of mysql_error() and mysql_errno() in MDB2? When I'm sending an incorrect SQL-statement to the server and it fails, all I'm getting is "MDB2 Error: syntax error". Thanks in advance, Yves Sucaet Iowa State University -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Serializing mySQLi result resource
It is definitely possible, but I'm not sure if any standard solutions exist. You could encapsulate your mysql_query() function into a class that has a Serializable() method. You'd have to write your own method for that though. Too bad MySQL doesn't support the "select for xml" construction that SQLServer has, because then you could simply serialize the XML-output from your query. PEAR has two alternate packages for caching: http://pear.php.net/packages.php?catpid=3&catname=Caching Maybe that's a starting point as well? HTH, Yves - Original Message - From: "Andrew Martin" <[EMAIL PROTECTED]> To: Sent: Sunday, June 08, 2008 7:26 AM Subject: [PHP-DB] Serializing mySQLi result resource Hello, Is it possible to serialize a MySQL(i) result resource? I am looking to insert results into the eAccelerator cache but the returned resource does not appear to be recognised by mysqli_fetch_assoc. Thanks, Andy -- 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 in concatenation - modular development
If you want to go for a modular approach, you should consider switching to a solution such as Smarty: http://www.smarty.net for more info. HTH, Yves -- Original Message -- Received: Sat, 07 Jun 2008 11:55:38 AM CDT From: "Nitsan Bin-Nun" <[EMAIL PROTECTED]> To: "Nasreen Laghari" <[EMAIL PROTECTED]>Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Help in concatenation 1. 0?("?start=").$y:""));?>"> 2. 0?("?start=").$next:""));?>"><< turns into: > $string = '' . $pg . ''; > ?> > $string2 = ''; > ?> I can squeeze the if operation into the string but I can't see good cause for this (this is less spageti this way) On 06/06/2008, Nasreen Laghari <[EMAIL PROTECTED]> wrote: > > Hi, > > I need to change PHP embeded in HTML to HTML embeded in PHP as trying to > use modularity approach. > I'm stuck on below these lines where concatenation is the big issue. I have > researched, read but couldnt sort this out after try really hard. > Could any one please help me to change this code to HTML embeded in PHP > please. Mostly i'm getting confuse where text is written in red > I know it is very basic question but this concatenation is confusing me so > much. I have spended my whole day in sorting this out but :( > 1. 0?("?start=").$y:""));?>"> > 2. 0?("?start=").$next:""));?>"><< > Thank you > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mssql_connect()
phpinfo() should also contain a reference to which php.ini file it reads. Does it match the location of your php.ini file? When you say "all versions of php.ini", I would recommend that you only keep one copy of php.ini on your system. About your php.ini: What value do you have for the extension_dir value? That should be the folder referring to where your mssql.dll is located. On my system it's c:\php\ext. Do you see any error messages at the bottom of your page that indicates an extension wasn't loaded (you may have to change the error-reporting parameters for this)? Can you enable other extensions on your system (gd2 e.g.)? HTH, Yves - Original Message - From: "Simge RESMOR" <[EMAIL PROTECTED]> To: Sent: Tuesday, June 03, 2008 5:11 AM Subject: Re: [PHP-DB] mssql_connect() i restart ISS and i checked all the version of php.ini ,i unquoted in all php.ini file php_mssql.dll extension. i put this dll into system32 folder . but still i cant see mssql library in phpinfo() page. i dont understand why? is there anything besides above things i should do? ""YVES SUCAET"" <[EMAIL PROTECTED]>, haber iletisinde sunlari yazdi:[EMAIL PROTECTED] My php.ini is actually in the c:\windows folder. Also: Check to see if you have multiple versions of php.ini on your system. Maybe you have a version in c:\php or c:\windows in addition to c:/windows/system32 and the wrong file gets interpreted. HTH, Yves -- Original Message -- Received: Mon, 02 Jun 2008 06:31:37 AM CDT From: "simge" <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] mssql_connect() hi, I have a problem to connect MsSQL server 2005 with mssql_connect() function. the error: fatal error undefined function mssql_connect(). I correct php.ini(unquoting php_mssql.dll) i put it in c:/windows/system32 but still i cany see mssql library in phpinfo() page. Please Help Me. -- 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] mssql_connect()
My php.ini is actually in the c:\windows folder. Also: Check to see if you have multiple versions of php.ini on your system. Maybe you have a version in c:\php or c:\windows in addition to c:/windows/system32 and the wrong file gets interpreted. HTH, Yves -- Original Message -- Received: Mon, 02 Jun 2008 06:31:37 AM CDT From: "simge" <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] mssql_connect() hi, I have a problem to connect MsSQL server 2005 with mssql_connect() function. the error: fatal error undefined function mssql_connect(). I correct php.ini(unquoting php_mssql.dll) i put it in c:/windows/system32 but still i cany see mssql library in phpinfo() page. Please Help Me. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] synchronizing/replicating MySQL servers
Hello, We have several PHP applications that run on the same server. We'd like to split them up over two servers. Can somebody help me get started to set up a replicated MySQL installation? I'd like to host the same DB on both machines, and so when one updates the other should update etc... How does one do that? Is that even possible with the community version of MySQL? Thanks in advance, Yves
Re: RES: [PHP-DB] input field validation
Nope, it's not. The problem was formulated as "Integer" detection. not numerical detection in general. isNaN will return positive for e.g. floating point values as well. The solutions described in this thread all result in integer-only values. All solutions presented are still off-topic, of course... Yves -- Original Message -- Received: Mon, 12 May 2008 11:12:02 AM CDT From: "Thiago Pojda" <[EMAIL PROTECTED]> To: "'sahabettin akca'" <[EMAIL PROTECTED]>, Subject: RES: [PHP-DB] input field validation It'd be simpler to use isNaN() Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] Excelência em Softwares Financeiros -Mensagem original- De: sahabettin akca [mailto:[EMAIL PROTECTED] Enviada em: domingo, 11 de maio de 2008 14:31 Para: php-db@lists.php.net Assunto: Re: [PHP-DB] input field validation hi, *javascript function : function isNumber(obj) { var len = obj.value.length; var lastChar = obj.value.charAt(len-1); if( lastChar != '0' && lastChar != '1' && lastChar != '2' && lastChar != '3' && lastChar != '4' && lastChar != '5' && lastChar != '6' && lastChar != '7' && lastChar != '8' && lastChar != '9' ) { obj.value = obj.value.substring(0, len-1); } } this is function use : do not alert , but add alert * obj.value = obj.value.substring(0, len-1); --- this line before --- alert('this field only integer!'); * add. good luck ?ahabettin akca (saho) 2008/5/11 arafat uddin <[EMAIL PROTECTED]>: - and this database field data type select int (integer) , tinyint, int, bigint... or if(gettype($_POST['field'])!="integer") // or if(intval($_POST['field'])==0) or if(!intval($_POST['field'])) { print"not integer"; location("header: .php"); #or print""; } else { ... } 2008/5/11 Yves Sucaet <[EMAIL PROTECTED]>: > Allow me to point out that this is not database-related... > > This website should get you everything you want: > http://www.acmesoffware.com/acme/ExamplesJS/jsExm_ValidateInteger.asp > > HTH, > > Yves > > - Original Message - From: "arafat uddin" <[EMAIL PROTECTED]> > To: > Sent: Sunday, May 11, 2008 12:48 AM > Subject: [PHP-DB] input field validation > > > > hi, > > i want to input only integer in my field.if without integer any > > input put in the field it will show warning messege. > > such as "12 "will be accept > > but "12sds" will not accept . > > "fhe34" will not accept > > > > > > plz help me by any javascript code. > > > > -- > > 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 > > -- ?ahabettin akca // saho -- 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] input field validation
Allow me to point out that this is not database-related... This website should get you everything you want: http://www.acmesoffware.com/acme/ExamplesJS/jsExm_ValidateInteger.asp HTH, Yves - Original Message - From: "arafat uddin" <[EMAIL PROTECTED]> To: Sent: Sunday, May 11, 2008 12:48 AM Subject: [PHP-DB] input field validation hi, i want to input only integer in my field.if without integer any input put in the field it will show warning messege. such as "12 "will be accept but "12sds" will not accept . "fhe34" will not accept plz help me by any javascript code. -- 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] Inner joining 3 tables
select * from table1 inner join table2 on (table1.common1 = table2.common2) inner join table3 on (table2.common2 = table3.common3) HTH, Yves - Original Message - From: "Ron Piggott" <[EMAIL PROTECTED]> To: "PHP DB" Sent: Saturday, May 10, 2008 4:33 PM Subject: [PHP-DB] Inner joining 3 tables How do I inner join 3 tables together? What would the syntax look like for this situation: Table 1 and table 2 have a common field; Table 2 and table 3 have a common field Ron -- 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] Alternative for MySQL Admin tools
Just like to point out http://www.sqlyog.com, an alternative stand-alone desktop tool to manage you MySQL servers. The free community edition is very good! I've been using it for 3 years now and never had to need to install anything else or additional. HTH, Yves
Re: [PHP-DB] Timestamps
Hi Jason, It's not because you create a date/time value that you automatically have an integer-value. You need to specify first that you want the date/time value converted to an integer value first. See http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_unix-timestamp for an example of how to do this. Actually, by using this function, you probably don't even need to create the $modifiedTimestamp variable anymore. You can just write your SQL query as follows: $sql = "Update `mytable` set timestamp=UNIX_TIMESTAMP() where Record='1'"; HTH, Yves -- Original Message -- Received: Wed, 30 Apr 2008 10:39:11 AM CDT From: Jason Pruim <[EMAIL PROTECTED]> To: Stut <[EMAIL PROTECTED]>Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Timestamps On Apr 30, 2008, at 11:35 AM, Stut wrote: > On 30 Apr 2008, at 16:29, Jason Pruim wrote: >> Okay... So I know this should be simple... >> >> Trying to store a timestamp in a MySQL database... The timestamp I >> am making like so: $modifiedTimestamp = time(); >> >> and then just $sql = "Update `mytable` set >> timestamp='$modifiedTimestamp' where Record='1'"; >> >> Simple right? Not quite...in my database it's storing a "0" in the >> timestamp field which is a int(10) field. >> >> I have googled, and searched manuals, but have not been able to >> figure out what is going on >> >> Any Ideas? > > timestamp is a reserved word. Try putting it in backticks. Okay, so I did a really crappy job at my sudo code... The field name is actually Last_Updated. so my update code looks like this: Last_Updated='$modifiedTimestamp' *Slaps his wrist... Bad copy/paste! BAD!!! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- 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 Criteria
An easier way would be to use the built-in MySQL functions directly. That way, you avoid issues with date-format conversions between PHP and MySQL. Look at: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html You code then becomes: switch ($type) { case "today": $sql = "... where field = current_date()"; break; case "tomorrow": $sql = "... where field = (INTERVAL 1 DAY + current_date())"; break; case "week": $sql = "... where field = (INTERVAL 1 WEEK + current_date())"; break; default: die("Don't know what to do?"); HTH, Yves -- Original Message -- Received: Mon, 28 Apr 2008 01:32:31 PM CDT From: Nasreen Laghari <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] Query Criteria Hi All, I need help in below coding as it is not working. What I'm trying to do here, if $type contains "today" value then bring all record which has today's date, If $type contains "tomorrow" bring all tomorrow's record. Do you think below coding is correct? becuase when I run this query I get exception but if I place only one $query and outside of if.. else the same query runs without errors. Thank you for your help Regards $query; $date = date("d/m/y"); if($type=="today") { $query = "SELECT * FROM gig where gig_Date= $date"; } else if($type=="tomorrow") { $tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y")); $query = "SELECT * FROM gig where gig_Date= $tomorrow"; } else if($type=="week") { $week = mktime(0, 0, 0, date("m") , date("d")+6, date("Y")); $query = "SELECT * FROM gig WHERE g.gig_Date <= ".$date." OR g.gig_Date >=".$week."; } $result = mysql_query($query)or die(mysql_error()); return $result; } Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] session handling
>> 2. This is trickier. What do you mean with "access"? Are you talking about >> lost updates? Are you talking about simple read-operations? Actually, even as >> you claim you're a newbie, you're asking questions that are keeping us all up >> at night! :-) The solutions vary depending on your situation. Maybe you can >> add field "ActiveTable" to the above-mentioned "Sessions" table and take it >> from there? >it's more for editing records, when user customera1 opened a record to edit it, and almost at the same time user customera2 tried >to edit the same record, customera2 will get an error message that the record is already open. Well, like I said: the "lost update" problem is well known in database circles. Basically, when two users want to do the same thing at the same time, one of them WILL loose out. The only question is how you handle the situation. Please read e.g. http://forums.mysql.com/read.php?97,56420,56420 to give you some more ideas on how to handle this. Google for "database lost update" for more general information and strategies. Before you come up with too advanced features to solve this problem, you may also want to ask yourself the chance of this problem occuring in your specific application? While I've worked on many systems, I've never had a situation arise where this was an effective issue. But there definitely are circumstances where it may! >> 4. No, it won't. Each user has his/her own $_SESSION[] object >does that mean when user customera1 logs in, i passed $_SESSION[accountcode]. then user customera2 logs in also and i passed >$_SESSION[accountcode] again, so now $_SESSION[accountcode] is the same for both user, if customera1 logs out, i call >session_destroy, it wont destroy the session for user customera2? When customera1 logs in, a $_SESSION[] object is created for his/her eyes only. You can then e.g. say $_SESSION["code"] = getaccountcode(). When customera2 logs in in turn, a second $_SESSION[] object is created that only applies to that user. You can see the progress of these sessions popping in and out of existence by monitoring the files in the c:\php\sessions\ folder. Since customera1 has no access to the $_SESSION of customera2, there's risk in accidentally removing another user's session. HTH, Yves -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] session handling
Hi nhadie, 1. Unlike, ASP or ASP.NET, PHP only has a Session object, not an Application object. A session is only available to one single user only, and you can't share information between Sessions using PHP (you'd use the Application object for this in ASP(.NET)). While you can probably hack your way into the Session-files that PHP stores somewhere on the hard disk, that's obvioulsy not their intended you (but I want to mention this for the sake of being complete). What you can do is add a Boolean-field to your user-table in the database that says whether somebody is currently logged in. If the field is true, they can't log in a second time. The problem with this approach however is that it depends on the use actually logging out as well (thus calling a script that sets the field back to false). So here's a better solution: Create a separate table and call it something like "Sessions". It should contain at least three fields: AccountCode, LoginTime and LastActivityTime. When somebody first logs in, you create a record in this "Sessions" table. Everytime he pulls up a new page, you update the LastActivityTime field with the current date/time in the database. When somebody tries to log in a second time, you can deny them access based on the record that exists in the "Sessions" table. Here's how it works when somebody "forgets" to log out: each time you access the Sessions table, you should run a second query that automatically deletes all the sessions that haven't been updated for the last 30 minutes (the number should be the same to the timeout value for the $_SESSION[] object). So each time a user performs an action, you automatically remove all the sessions of all users that have been inactive for 30 minutes or more. 2. This is trickier. What do you mean with "access"? Are you talking about lost updates? Are you talking about simple read-operations? Actually, even as you claim you're a newbie, you're asking questions that are keeping us all up at night! :-) The solutions vary depending on your situation. Maybe you can add field "ActiveTable" to the above-mentioned "Sessions" table and take it from there? 3. I think I've covered this under [1]. 4. No, it won't. Each user has his/her own $_SESSION[] object HTH, Yves -- Original Message -- Received: Mon, 28 Apr 2008 10:06:19 AM CDT From: Nhadie Ramos <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] session handling hi all, i'm a newbie and i really would like to be able to understand how session works. for the scenario, i have customers with two users login to manage their records (like adding their own customers). e.g. customer A has a username customera1 and customera2, customer B has customerb1 and customerb2. when user logins, i add on the session accountcode $_SESSION['accountcode'] (which is the unique identifier for each customer). here are some of the questions i have: 1. how can i make sure each user can login only one time? 2. if customera1 and customera2 are logged in at the same time and they are going to access the same data, how can i lock it to whoever had access to it first? 3. if a session expires, is there a way to automatically logout that user and destroy the session? 4. if both a user in customer A and B are logged in, then user A logouts and i have a script that call session_destroy(), will that also destroy the session of customer B? hope someone can help me. regards, nhadie - Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] playing longblob media
So how large is the file/BLOB? How many seconds/minutes of data does it contain? The previous author was right: you can retrieve BLOB fields just like any other fields. The problem is sending them back to the client. Yves - Original Message - From: "Ron" <[EMAIL PROTECTED]> To: Sent: Sunday, April 27, 2008 10:02 PM Subject: Re: [PHP-DB] playing longblob media i'm trying to play a WAV file, this file is a voicemail file generated by asterisk pbx. it is stored in mysql and i would like users to be able to check their voicemail via web using php script that will retrieve it from the db as a wav format already. thank you Yves Sucaet wrote: What kind of media are you trying to retrieve? Are you trying to retrieve the MySQL data and stream that through your script to the client? How big is the BLOB? If nothing else, you'll need to adapt the MIME-type in the header of your HTTP-message. HTH, Yves - Original Message - From: "Ron" <[EMAIL PROTECTED]> To: Sent: Sunday, April 27, 2008 9:15 AM Subject: [PHP-DB] playing longblob media Hi, How can i retrieve via php a media stored in a mysql database as longblob? I'd like to be able to retrieve the media and stream it. TIA regards, ron -- 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] playing longblob media
What kind of media are you trying to retrieve? Are you trying to retrieve the MySQL data and stream that through your script to the client? How big is the BLOB? If nothing else, you'll need to adapt the MIME-type in the header of your HTTP-message. HTH, Yves - Original Message - From: "Ron" <[EMAIL PROTECTED]> To: Sent: Sunday, April 27, 2008 9:15 AM Subject: [PHP-DB] playing longblob media Hi, How can i retrieve via php a media stored in a mysql database as longblob? I'd like to be able to retrieve the media and stream it. TIA regards, ron -- 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] Re: [EMAIL PROTECTED] PHP/MySQL and COUNT() problem
I notice your query says SELECT x,y,COUNT(y),z FROM ... GROUP BY y It was my understanding that when using aggregate function, you need to group by each field in your select-clause, so your query should be: SELECT x,y,COUNT(y),z FROM ... GROUP BY x, y, z Hope this helps, Yves Sucaet Iowa State University - Original Message - From: "Evert Lammerts" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; Sent: Saturday, April 26, 2008 6:31 AM Subject: [PHP-DB] Re: [EMAIL PROTECTED] PHP/MySQL and COUNT() problem I've forwarded this msg to the php-db list (php-db@lists.php.net). Try to subscribe to it. The mysql extension for php is only an interface between php and mysql - the parsing of queries is done within mysql itself. So if your query works through CLI it will also work from within php. Try to var_dump every result row: while ($row = mysql_fetch_assoc($result)) var_dump($row); Apart from this, why would you use the COUNT function and return the amount of NOT NULL y's (which all of your y's are because of your WHERE clause) for every row in the result set? You can simply count the amount of loops when looping over the result, or you can use php's mysql_num_rows($result) function. Paul Heath wrote: This may be the wrong message board for this [apologies if it is], but if any of you are PHP/MySQL gurus. Have been trying to get a particular MySQL query to work the through PHP5 with out success. I'll simplify my problem: I have an MySQL query along the lines of ("SELECT x,y,COUNT(y),z FROM table WHERE y LIKE '%/some text% /AND --/someotherstuff-- /GROUP BY y"); When i run this on the MySQL command line it works fine, when i run inside my PHP file, it returns everything ok except the COUNT (y) value [Note y is a string variable] I then go on to run /$result = mysql_query($query) or die ('cant run query'.mysql_error());/ /while ($row = mysql_fetch_assoc($result)) { } etc etc... /all my other queries in this file work perfectly. When i put some checking code in it definately is returning blank/null from MySQL for this count value Is there something special with PHP and COUNT() MySQL functions im not doing.?? or does the problem lie on the MySQL side and how it treats PHP requests for COUNT()? I would appreciate any advice now cos now ive ran out of ideas! -- Rgds 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