Re: [PHP-DB] SELECT syntax
Hi In Oracle (and maybe others) you can use select case when answer=1 then trivia_answer_1 when answer=2 then trivia_answer_2 when answer=3 then trivia_answer_3 when answer=4 then trivia_answer_4 else null end answer from bible_trivia_table OR You can select all of them and process in PHP, should not be too hard to come up with a couple of lines of code to display only 1 variable based on the value of variable 5. Overhead should be pretty minimal as well You'll be writing something to display a value anyway Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation On Thu, Oct 13, 2011 at 6:24 AM, Ron Piggott ron.pigg...@actsministries.org wrote: In my Bible_Trivia table I have the columns `trivia_answer_1`, `trivia_answer_2`, `trivia_answer_3`, `trivia_answer_4`, `answer` `answer` is an integer always with a value of 1 to 4. Is there a way to use the value of `answer` to only select the correct trivia answer? This doesn’t work, but this is the idea I am trying to achieve: SELECT `trivia_answer_`answer`` FROM `Bible_trivia` Thanks in advance, Ron www.TheVerseOfTheDay.info http://www.theverseoftheday.info/
Re: [PHP-DB] Working with large datasets
Hi You need to index the right fields. even on a laptop a select from 8 million rows with two rows returned should take a few seconds max only. The first time you run the query the data has to come from disk, second time you run same query you'd expect that data to sit in cache and be very quick. Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation On Tue, Oct 11, 2011 at 10:39 AM, Jason Pruim li...@pruimphotography.comwrote: Jason Pruim li...@pruimphotography.com On Oct 10, 2011, at 5:27 PM, Thompson, Jimi wrote: I really think that you should try running it from the command line and see what the issues are. Get both Apache and php out of the way. I've seen some PHP scripts use up all the file handles (OS limit) even on a 64 bit server when they start doing complex things with data sets. If it works ok without PHP/Apache then you can start lookig at PHP and APache. ISOLATE the issue not complicate it My 2 cents, Hi Jimi, I've done it from the command line a few times, first time I run a simple: SELECT * FROM Main WHERE state=test; it takes: 2 rows in set (1 min 44.20 sec) after that initial run it's pretty responsive, usually around 0.01 seconds. If I do a select based on the new-york state, which is all of my almost 9 million records after the initial run, it returns it all VERY quickly: 25000 rows in set (0.02 sec) So commandline is running fine after the initial... I'm leaning towards either a problem with web server, PHP setup, or my PHP code... I've used the code many times before but never on such a large dataset... When I pull the pagination out completely It's pretty much the same result... fetching the info for new-york works just fine but not test One thing I am noticing right now though is the fact that when I switch over to using the test state Right now it's not displaying anything... Not even able to view the source... Okay... Enough rambling right now... Need to do some more checking before I can come to a conclusion :) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Hello
I don't quite understand what your problem is but it looks as if some fields of the records that show up in phpMySql are empty and that the result page that you have built does not show them. If that is the case, is there a where clasue that causes them to not return? Can you run the query that is on your result page in phpmysql and see what it returns. Jack 2009/12/14 Karl DeSaulniers k...@designdrumm.com Hi I am new to this list. I am in need of some help or direction. I am new to php and databases, so forgive me if my request seems too simple. I am making a database if users and have had much success in getting it to work however, not all my data is getting shown once I try to display results. I am running an INSERT query that inputs data into the database from a form. But here is the hiccup. I am asigning the form data to a $variable. Eg: $Username = $_POST['Username']; I then run $Username through some checks to make sure it's not an injection. After all that I want to insert it into the database. This works fine if I use: $query = INSERT INTO users (Username, UserEmail, etc) VALUES ('.$_POST['Username'].', '.$_POST['UserEmail'].', etc); And it works if I use VALUES ('.$Username.', '.$UserEmail.', etc); However I have some variables that are not posted from the form and in the first example, it does not insert those in the database. In the second, it will insert them into the database, but when I go to display them it is saying there are no records to retrieve. I looked at the database in phpMySql and they are there. It will only display them in the results page if they had been inserted using $_POST. Is this normal? What is the best way to $_POST a $Variable. Something like $_POST[$Username] (which doesn't work). Any help would be greatly appreciated. Thanks, Karl Design Drumm Sent from losPhone -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation
Re: [PHP-DB] Search
For starters try this FROM cupones INNER JOIN empresas ON (empresas.id =cupones.empresa) INNER JOIN rubros ON (rubros.id = cupones.rubro) I am not sure about the join criteria you have given us, they look a bit suss to me. What is the field/are the fields that join the tables? I would imagine the joining should be on the ID field that is present in all three tables, but the ID may not be the same meaning for the tables. Jack 2009/10/16 Emiliano Boragina emiliano.borag...@gmail.com Hello I’m using this code to a search: $sql = SELECT empresas.id, empresas.nombre, rubros.id, rubros.nombre, cupones.empresa, cupones.rubro, cupones.titulo, cupones.descripcion FROM cupones INNER JOIN empresas INNER JOIN rubros ON (empresas.id = cupones.empresa OR rubros.id = cupones.rubro) WHERE (empresas.nombre LIKE '%$_GET[busqueda]%' OR rubros.nombre LIKE '%$_GET[busqueda]%' OR cupones.titulo LIKE '%$_GET[busqueda]%' OR cupones.descripcion LIKE '%$_GET[busqueda]%'); I have a input text with name “clave”. I have three tables: empresas, rubros anda cupones. The “empresa” table has got ID and NOMBRE The “rubro” table has got ID and NOMBRE And the “cupones” table has got ID (from the coupon), EMPRESA (int), RUBRO (int) , TITULO, DESCRIPCION The client has got 100 coupons (CUPONES table) in the data base. He wants to search in any of these fields, but with tath code the search return 200 or 1000 results. If the total of coupons are 100, what should I do to the searching return only one time the coupon with the keyword insert to search... 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 -- Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation
Re: [PHP-DB] Re: Need help-Send email
what is the client email filter looking for to classify this as spam?? 1. Mail from GMAIL? Bit rough considering the number of valid users 2. subject Test mail ? if so change subject to something more business like 3. message Hello! This is a simple email message? I do not think so Most likely culprit is number 2. Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation 2009/9/12 nagendra prasad nagendra802...@gmail.com Exactly, the mail-client filter is actively working for such mail. But when I researched on Google I have found that to send an email using PHP we at lest need a mail server domain. Also we have to set SMTP to send email to inbox otherwise every mail-client will filter it and send it to SPAM folder. Also, I am using WAMP to use all these codes so right now I don't have an email server domain or something like that. Is their a way to set my PHP ini file to use my Gmail SMTP and PORT settings so that I can at lest send emails directly to inbox and later I will change it to some other email client. Thanks for the quick response :)
Re: [PHP-DB] Re: Need help-Send email
I thought he said he was using the gmail smtp server? Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation 2009/9/13 Kyle Smith kyle.sm...@inforonics.com Mail from GMail coming from a non-gmail server? Yes, definately. Do not use @gmail.com in the from address, see how that works. Jack van Zanen wrote: what is the client email filter looking for to classify this as spam?? 1. Mail from GMAIL? Bit rough considering the number of valid users 2. subject Test mail ? if so change subject to something more business like 3. message Hello! This is a simple email message? I do not think so Most likely culprit is number 2. Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation 2009/9/12 nagendra prasad nagendra802...@gmail.com nagendra802...@gmail.com Exactly, the mail-client filter is actively working for such mail. But when I researched on Google I have found that to send an email using PHP we at lest need a mail server domain. Also we have to set SMTP to send email to inbox otherwise every mail-client will filter it and send it to SPAM folder. Also, I am using WAMP to use all these codes so right now I don't have an email server domain or something like that. Is their a way to set my PHP ini file to use my Gmail SMTP and PORT settings so that I can at lest send emails directly to inbox and later I will change it to some other email client. Thanks for the quick response :)
RE: [PHP-DB] newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?
Just keep in mind that while that may be a very possible solution when datasets are small. This could get problematic when for instance there are a 10 years worth of dates and millions of records in the other tables. The resulting program could end up taking lots of time to display data. In your case this might not happen if you do not get that much data, but again we do not know. Just something to keep in mind before deploying. Jack -Original Message- From: Govinda [mailto:govinda.webdnat...@gmail.com] Sent: Tuesday, August 04, 2009 12:34 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column? Bastien, I had tried it with the parantheses around the date for the distinct. I tried again just now. Same result. But that's ok. I am onto the next step now. Niel, Jack, I got your fix working. It shows me that I am still so new; I own yet so little mastery of MySQL. Nisse, I see what you are suggesting. It seems I can go that route too. I have much to learn in every direction, so for right now anyway I am thinking to pursue the stream of thought started with what Niel and Jack just gave me. I do need data from the other columns too, and not just the date extracted from that timestamp field, ...and I need to count # of records in other tables that have the same unique date as the list of unique dates I just found in my first table, etc. .. so my thought is to want to do nested query(ies), where: *within* the while loop of the first recordset (which is now successfully returning just rows with unique dates), I do other query(ies) which will (in their own code block) find all rows of the date we are iterating.. so I can, for example, count number of records for each unique date, do math/statistics, etc. I need to play with everything before asking for more detailed help; I am just now asking if you think I am on the right track with my thinking - as I just mentioned in the sentence above this one? Thanks everyone! -Govinda -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.392 / Virus Database: 270.13.40/2276 - Release Date: 08/01/09 18:04:00 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?
The distinct can only work as you want it to work when you only select the date column and only the date part (not the time part). Unfortunately I'm more an oracle DBA where the date functions are more clear to me so can not help with exact syntax. I think what you should be doing is returning the entire set of records (all required columns) in sorted by date order and loop through all of them. keep track of the last date processed and if it is the same as the current record, process nothing and go get the next record. BUT I am not quite sure what you are trying to achieve so my advise may be completely flawed. Jack 2009/8/3 Govinda govinda.webdnat...@gmail.com Oops, forgot to mention that with the alias you can change the ORDER BY clause to use the aliased column data: ORDER BY solarLandingDate DESC this will only use the returned data instead of the entire column. If you are aliasing a column it is better to use the optional AS keyword to avoid confusion. MySQL's DATE function returns dates formatted as '-MM-DD' so DATE_FORMAT is not needed here. Niel, Bastien, thanks for your efforts to lead me to understanding this! I tried everything you both suggested. Ideally I would have some clear docs that outline the syntax for me, for such an example as I need.. and I would be able to check my code myself. Meanwhile, In every case, I just get every record in the table back as a result. So then I thought, try and make even a *simple* DISTINCT work, and then move on to the date thing... so I try this: //$foundTrackingRows=mysql_query(SELECT DISTINCT solarLandingDir, solarLandingIP, solarLandingDir, solarLandingDateTime FROM .$whichTable. ORDER BY solarLandingDateTime DESC LIMIT $Maxrecs2Show) or die(query failed: .mysql_error()); In all the records in this table, there are only 3 possible values in the 'solarLandingDir' column (TINYTEXT): diysolar solar_hm (null) but I still get all the records back, with each distinct 'solarLandingDir' column value represented several times. So something really basic is missing in my understanding/code. Can you see what it is? -Govinda -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation
Re: [PHP-DB] MySQLand a prepared statement problem
check into stripslashes ,addslashes and mysqli_real_escape_string functions. Jack 2009/7/17 Jason Carson ja...@jasoncarson.ca Hello everyone, I have a problem. When I insert a href=http://example.comExample/a into my database with the following code... $connect = mysqli_connect($hostname, $username, $password, $database); $sql=INSERT INTO notes VALUES ('$id', '$note'); $result=mysqli_query($connect, $sql); ...everything works fine. The link (when I SELECT it and display it in my browser) works as one would expect. However when I insert a href=http://example.com;Example/a into my database with the following code (prepared statement)... $submitnote = mysqli_prepare($connect, INSERT INTO notes VALUES (?, ?)); mysqli_stmt_bind_param($submitnote, is, $id, $note); mysqli_stmt_execute($submitnote); ...the link (when I SELECT it and display it in my browser) shows up as... http://jasoncarson.ca/admin/\http://example.com\; ...Anyone know how to fix this so I can use the prepared statement? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Just to clarify, $id would be different for each entry in the database. $id=1 or 2 or 3 etc... and $note = a href=http://example.com;Example/a -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation
Re: [PHP-DB] finder
and also represents poor/lazy programming (in my opinion) leaving you open to all sorts of trouble if columns get added or deleted. I always advise to querry exactly what you require. Sorry for this comment but op seems to be fairly novice on SQL and could benefit from this post. Brgds Jack 2009/7/17 Corin Schedler corin...@gmail.com The * is a SQL shortcut. It means, in this case, all columns. So, in the SQL you posted it means get all columns from the buildings and city tables. corin dubdromic.com On Thu, Jul 16, 2009 at 06:50:20PM -0300, Emiliano Boragina wrote: Hi again… I searching in www and find this (to do the finder): $sql = SELECT buildings.*, citiy.* FROM buildings, city WHERE buildings.idcity = city.id ; Dont understand “building.*”... what do it means? Thanks. + _ // Emiliano Boragina _ // Diseño Comunicación // + _ // emiliano.borag...@gmail.com / // 15 40 58 60 02 /// + _ _ De: Dan Shirah [mailto:mrsqua...@gmail.com] Enviado el: Miércoles, 15 de Julio de 2009 09:17 a.m. Para: Emiliano Boragina CC: php-db@lists.php.net Asunto: Re: [PHP-DB] finder But with that it doesnt difference between full and empty field… If the user want search on two posibilities on ten... Maybe I'm not understanding what you're asking... Or maybe you don't understand the query... Say your form has 10 checkboxes. If the users picks 3 out of ten boxes and clicks submit, the example I gave you will search your database looking for all records that match the 3 check boxes. if $houses equals $_POST['houses'] then $houses will be empty if the checkbox was not clicked and will not be included in the query. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation
Re: [PHP-DB] finder (I AM REALLY SORRY)
not quite if $f_inmueble 0 is false (=0) than this will not be part of the search and the next line will add a AND following the WHERE which is syntax error so try this: $sql_BUSQUEDA = SELECT * FROM principal FULL JOIN detalles WHERE 1=1 '; //1=1 is always true if ($f_inmueble 0) { $sql_BUSQUEDA .= AND inmueble LIKE '%$f_inmueble%' ; } 2009/7/17 Emiliano Boragina emiliano.borag...@gmail.com Sorry a lot of times!!! Please... tell me (and help me) to know if this is right: ? include conn.php; $sql = SELECT * FROM principal FULL JOIN detalles FULL JOIN aestrenar FULL JOIN fotos ON principal.id=detalles.id=aestrenar.id=fotos.id ORDER BY id ASC; $result=mysql_query($sql,$conn); $row=mysql_fetch_row($result); $f_codigo = $_REQUEST['codigo']; $f_inmueble = $_REQUEST['inmueble']; $f_operacion = $_REQUEST['operacion']; $f_desde = $_REQUEST['fpreciodesde']; $f_hasta = $_REQUEST['fpreciohasta']; $f_moneda = $_REQUEST['moneda']; $f_region = $_REQUEST['region']; $f_barrio = $_REQUEST['barrio']; $f_ambientes = $_REQUEST['ambientes']; $f_dependencia = $_REQUEST['dependencia']; $f_cochera = $_REQUEST['cochera']; $f_ubicacion = $_REQUEST['ubicacion']; $f_apto = $_REQUEST['apto']; if(($f_desde = 0) || ($f_desde == )) { $f_desde = 0; } if(($f_hasta = 0) || ($f_hasta == )) { $f_hasta = 0; } if(($f_ambientes = 0) || ($f_ambientes == )) { $f_ambientes = 0; } $f_precio = $f_desde = $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 /// + _ -- Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation
Re: [PHP-DB] Get ID of ROW when using aggregate functions
the answer is exactly what you asked for. It gave you the max salary per company and made a lucky guess (not really, alfabetically first) as to which name you wanted since you never specified this of the top of my head, try this. SELECT a.id,a.name,a.company,a.sallary FROM `test` a ,(select company,max(sallary) sallary from test group by company) b where a.company=b,company and a.sallary=b.sallary 2009/4/8 Ondrej Kulaty kopyto...@gmail.com Hi, I have following table: id int(11) name varchar(255) company varchar(255) sallary int(11) CREATE TABLE `test` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `company` varchar(255) NOT NULL, `sallary` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin2 AUTO_INCREMENT=1 ; With rows: INSERT INTO `test` (`id`, `name`, `company`, `sallary`) VALUES (1, 'Jane', 'Microsoft', 1), (2, 'Peter', 'Novell', 12000), (3, 'Steven', 'Microsoft', 17000); I want to select person from each company with a highest sallary. I run this SQL: SELECT id,name,company,MAX(sallary) FROM `test` GROUP BY company; And result is: id name company MAX( sallary ) 1 Jane Microsoft 17000 2 Peter Novell12000 Why it returned Jane (id 1) as a person with highest sallary (17000) when obviously Jane has sallary of 10 000? Thanks for any help. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation
[PHP-DB] Date formatting question
I need to reformat the output of the 'dates' field from '2009-04-08' to 'Wed. Apr. 8th'. Any help would be appreciated. Thanks. --- for ($counter = 0; $counter mysql_num_rows($resultID); $counter++); while ($row = mysql_fetch_object($resultID)) { print tr; print td . $row-dates . /td; print td . $row-times . /td; print td . $row-am_pm . /td; print td . $row-height . /td; print td . $row-cond . /td; print /tr; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Bounty for PHP DB project
Always willing to make a buck, but in all honesty I reckon if you use the adodb libraries it will take you all of 20 minutes to create this yourself as this has Builtin functions to create the html page with bext and previous already. There is an example in the documentation that is included in the download Brgds Jack 2009/3/23 B B bmnsoftwa...@hotmail.com Hi Guys, I am new to PHP but have Linux and MySql experience. I have a requirement which I would like to outsource for few hundred dollars if anyone is will to take the job. The requirement is as follows: - PHP to queury MySql for data and display it on an html page. - The query is to support up to 200, 000 records which should be displayed onto few pages by buttons like Next and Previous. - One of the table fields include a unique ID which corresponds to a file name in a directory where it should allow the user to download that file. If interested please e-mail me off list. If you know of samples of something like this done please post here so that I can go ahead and read it in case no one wants to make $$$. Thanks guys, Bruce _ Reunite with the people closest to you, chat face to face with Messenger. http://go.microsoft.com/?linkid=9650736 -- Jack van Zanen - This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Thank you for your cooperation
Re: [PHP-DB] Re: New Table Creation with PHP Variables
That looks like it should work, just execute the select query and see what is the output Jack 2008/12/29 Keith Spiller larent...@hosthive.com Another option that would work if I can figure out the correct syntax is to just NULL certain values if a given condition exists. If product_type='course' then just use the o.product_id value for field4. If product_type != 'course' then use NULL for field4. CREATE TABLE $table[name] SELECT field1, field2, field3, IF(o.product_type='course', o.product_id, NULL) AS field4, field5, field6, field7 FROM table1 as a, table2 as o; Is this right? Thank you for your help. Keith - Original Message - From: Keith Spiller larent...@hosthive.com To: php_db php-db@lists.php.net Sent: Sunday, December 28, 2008 5:39 PM Subject: New Table Creation with PHP Variables Hi, I'm trying to join multiple tables to then create a new table from the query. I've figured out that part, but some of the fields need to be evaluated and then compared to a php array to derive their data. In this example I am trying to populate the field4 column (from the $product_name array) after evaluating the product_type value on each row. CREATE TABLE $table[name] SELECT field1, field2, field3, IF(o.product_type='course', $product_name[$product_id], NULL) AS field4, field5, field6, field7 FROM table1 as a, table2 as o; Is this possible? Is there another way to accomplish this task? Thanks for your help. Keith -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- J.A. van Zanen
Re: [PHP-DB] SimpleXML broke while I was sleeping.
did they change the source at WoWhead? 2008/12/11 Nicholas Mercier [EMAIL PROTECTED] So I had a code project that took the name of a piece of equipment in World of Warcraft - pulled the XML from WoWhead and pulled the database item number from the XML file. It worked for a long while and the code simply sat around not being used. I went back to pull the project out for inclusion in something new and it no longer works. I wasn't terribly comfortable with XML to begin with so I'm not sure what has changed - but here is the code the worked for so long: function item_num_from_xml($url) { $xml = new SimpleXMLElement(rawurlencode($url), NULL, TRUE); $item_num = $xml-items-item[id]; return $item_num; } $xml_link = http://www.wowhead.com/?search=.str_replace( , +, $item).xml; $item_num = item_num_from_xml($xml_link); $itemlink = http://www.wowhead.com/?item=.$item_num; This is the error message I now get: *Warning*: SimpleXMLElement::__construct() [simplexmlelement.--construct http://www.theredshirts.com/test/simplexmlelement.--construct]: http%3A%2F%2Fwww.wowhead.com http://2fwww.wowhead.com/ %2F%3Fsearch%3DAngelista%27s%2BSash%26xml:84: parser error : Entity 'nbsp' not defined in * /home/thered/public_html/test/config.php* on line *28 **Warning*: SimpleXMLElement::__construct() [simplexmlelement.--construct http://www.theredshirts.com/test/simplexmlelement.--construct]: pan span class=moneycopper64/span/div/lilidivDisenchantablenbsp; in * /home/thered/public_html/test/config.php* on line *28* and various other beauties including: *Fatal error*: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/thered/public_html/test/config.php:28 Stack trace: #0 /home/thered/public_html/test/config.php(28): SimpleXMLElement-__construct('http%3A%2F%2Fww...', 0, true) #1 /home/thered/public_html/test/config.php(105): item_num_from_xml() #2 /home/thered/public_html/test/display.php(86): display_drops(' http://www.wowh...') #3 /home/thered/public_html/test/index.php(2): include('/home/thered/pu...') #4 {main} thrown in * /home/thered/public_html/test/config.php* on line *28 First person to point out what stupid mistake I'm making can mock me for a long time. * -- J.A. van Zanen
Re: [PHP-DB] MySQLi not closing connections
Jonathan Langevin wrote: Hoping someone may have some insight. I'm a PHP developer for my current employer. Recently, a coworker and myself started revamping our PHP-based intranet to add more OO functionality and replace some of the repetitive procedural code that was in place. In this revamp, we also converted the majority of our scripts to use MySQLi instead of MySQL. We're using the MySQLi class, which I've extended to add some logging functionality, and also incorporated some query builder methods (similar to what you'll see in CodeIgniter's Active Record class). To better troubleshoot semi-random bugs in our intranet, I've implemented an activity log in the database, to record all data in/out, current page, queries used, etc, which logs at the end of each page load. The problem is, this activity log, when enabled, results in all MySQL connections being used, and we run out of open connections. I'm not sure where the error is. Our config.php, when included, initializes the MySQL or MySQLi connection as decided by the script that included the config. Within the same file, a shutdown function is registered to automatically close the MySQL or MySQLi connection at the end of script execution (based on which connection was initialized to begin with). We never have connection issues during normal usage, but once the activity log is enabled (which will execute during shutdown), that is when we see the connections fill up fast. The weird thing is, to my knowledge, the same DB connection is being used, never duplicated. I've seen a PHP 5.3 bug that results in multiple connections being allowed when using the OO mysqli methods, but the mysqli class is only instantiated *once* per page load, same for the mysql procedural instance. The only possibility I can think of, is that normal mysql is being instantiated outside of the config.php include, but then we'd have connections disappearing continuously, not just when the activity log is enabled. I realize this is a long, and probably none-to-helpful email. If anyone can assist, I'd appreciate it. Any info you need, let me know. -- Jon L. I'm not sure why the connections are staying open, but I would suggest using mysqli_real_connect with the flag to timout connections. http://www.php.net/manual/en/mysqli.real-connect.php If this is way off base, let me know. -- Jack -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL Query Timeout program in PHP
Just put the time out in your PHP.INI file max_execution_time = 30 ; Maximum execution time of each script, in seconds 2008/10/16 Piyush Kumar [EMAIL PROTECTED] I'm using http://myclient.polarlava.com/ as web query interface for mysql server Now I want to add Query Timeout functionality to it For that I need to get the PID for last ran mysql query and then using kill PID - I can kill the process on MySQL server Please explain how to do that in PHP Thanks! Similar to what described @ http://bytes.com/forum/thread156058.html -- Thanks Regards, -Piyush Mo.: 091-9910904233 Mail: [EMAIL PROTECTED] Web: http://piyush.me/ -In a world without fences, limits, boundaries and walls, Who needs Windows and Gates? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- J.A. van Zanen
Re: [PHP-DB] Foreign Key Versus Table Index
I am not up to scratch with innodb, but in oracle you would have a Primary key on both the id fields in the Car and person table and a Foreign key on PersonId linking it to Id in the Person table. IN your select an index on PersonId would be beneficial if the tables get large. Jack 2008/10/2 J Hussein [EMAIL PROTECTED] Hi, I'm slightly confused about foriegn keys and indexes on mysql innodb tables. Foreign key constraints create a reference between two tables and indexes make queries on a particular table faster if the index is on a field in the where or order by clause. My question was whether say for the following two tables: Person Car Id Id Name PersonId Address Make Phone Number Colour If I create a foriegn key linking the id field in person and the personid field in car, do I need to create another index in car table specifically for the personid field if I was running a query such as: SELECT Id FROM car WHERE personid={personkeynumber}? Thanks for your help. Jemma -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- J.A. van Zanen
Re: [PHP-DB] Performance (lots of tables / databases...)
If it were Oracle I'd go with one database and separate schema for each blog. For Mysql I think I'd go for a database each blog. Jack 2008/9/28 Martin Zvarík [EMAIL PROTECTED] Hi, I am working on a blog system and I am currently thinking of what would be the best DB approach. I have read lots about wordpress and other blog's optimizations and DB structure, but I have not found any mention of having separate database for each blog/user. So, my question is, which one is performance better (talking about 1000 blogs): a) 1000 blogs * 5 (let's say we will have tables like comments, post... for each blog) = 5000 tables in one database ... this is Wordpress default b) 1000 databases (for each blog) each having 5 tables c) 5 databases by 1000 tables - in this case, won't this be an issue when SELECTing like this: [db_comments].testblog, [db_posts].testblog ? Is that a controversial topic? :-/ Thanks for ideas, Martin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- J.A. van Zanen
Re: [PHP-DB] query optimization
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. Also What is the table sizes of the tables? How many records are expected to come back from the union sub query? How many records are expected to come back from the main query What is the current execution plan? Jack 2008/9/26 YVES SUCAET [EMAIL PROTECTED] 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 -- J.A. van Zanen
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
Re: [PHP-DB] How to retrieve the position of a row inside a table with garbage data in all cloumns?
As a caution, I would never, ever use a query that relies on the data to be returned from the table in a certain order. That is just wrong and goes against the principals of a rdbms. Just write your queries in such a way that the result is always returned the way you want it regardless of the way it is ordered in the table. Jack 2008/9/23 Trullo [EMAIL PROTECTED] En/na Chris ha escrit: Trullo wrote: hello_world(); in fact.. how to goTo next/previous row of a table without using incremental ids AND without reading the whole table? i will explain: I wanna do something like a paging toolbar blinded to a list of rows (for example, a literally view of a db table). The first difference from a normal paging system, is that i wanna show only one row per page, and luckily i know the id of that first viewed row; so, no problem until here. Im able to show the first row xD. The second difference is that i don't know the position of the first viewed row inside the whole original table, only the id of the row (maybe someone is laughing while reading 'only'). I would like to know the position of that row to allow a easy goTo next/prev method using LIMIT/OFFSET sql clauses. Assuming the row id you have is a primary key, you could do: select * from table where primary_key $current_rowid order by primary_key asc limit 1; For previous you could do: select * from table where primary_key $current_rowid order by primary_key desc limit 1; Lot of thanks! its true that i dont care about the position of row. Your solution will do the work sure :o] As a curiosity... then.. the only way to know the position of a row, is read the whole table? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- J.A. van Zanen
RE: [PHP-DB] display values from to_char() function.
Try to_char(task_start-(+480/1440),'mm/dd/yy-hh24:mi') as task_start),to_char(task_end-(+480/1440),'mm/dd/yy-hh24:mi') as task_end ,task_owner,label_phase,to_char(task_actual_start-(+480/1440),'mm/dd/yy-hh24 :mi') as task_actual_start Jack -Original Message- From: hridyesh pant [mailto:[EMAIL PROTECTED] Sent: Friday, September 19, 2008 7:23 PM To: php-db@lists.php.net Subject: [PHP-DB] display values from to_char() function. Hi Guys, i am facing one issue while displaying data. my sql query is $res = oci_parse($db,select label_name,task_name,task_runnum,task_result,task_machine,task_view,to_char( task_start-(+480/1440),'mm/dd/yy-hh24:mi'),to_char(task_end-(+480/1440),'mm/ dd/yy-hh24:mi'),task_owner,label_phase,to_char(task_actual_start-(+480/1440) ,'mm/dd/yy-hh24:mi') from intg_label_hist where label_name ='.$q.' order by task_start DESC); if (!$res) { echo(PError performing query: . mysql_error() . /P); exit(); } oci_execute($res); while ( $row = oci_fetch_array($res) ) { echoTDfont color=\#336699\b*$row[TASK_START]*/TD; echoTDfont color=\#336699\b*$row[TASK_END]*/TD; echoTDfont color=\#336699\b$row[LABEL_NAME]/TD; echoTDfont color=\#336699\b$row[TASK_NAME]/TD; } but i am not able to get any value of* $row[TASK_END]* and *$row[TASK_START] but *rest of the value os coming fine.So i suspect in my select statement because these two value are like to_char(task_start-(+480/1440),'mm/dd/yy-hh24:mi'),to_char(task_end-(+480/14 40),'mm/dd/yy-hh24:mi') in my select statement. How do i print the values which are coming to_char() function. Thanks hp -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] CMS-Blog system
I agree it depends on the architecture, however... 100 is not that many records. I personally like to keep my data together that could/should be used together. Jack -Original Message- From: Evert Lammerts [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2008 7:15 AM To: Martin Zvarík Cc: php-db@lists.php.net Subject: Re: [PHP-DB] CMS-Blog system 1) having separate databases for each blog = fast (problem: what if I will need to do search in all of the blogs for some article?) 2) having all blogs in one database - that might be 10 000 * 100 articles = too many rows, but easy to search and maintain, hmm? The answers on your question depends on the architecture of your software - if you really expect to have a big site, you'll have to design the interfaces between the several components of your system, both on hard- and software level. Generally speaking I think it's easier to use one database per user - it increases portability and scalability - you'll be able to distribute your database servers easier. I am thinking of having some file etc. cms-core.php in some base directory and every subdirectory (= users subdomains) would include this cms-core file with some individual settings. Is there better idea? Use WordPress ;-) Again, remember simple concepts of software engineering. Be careful to implement a system that depends on one component to work - this point'll easily become your single point of failure. I'm not just joking about wordpress, why develop another system in the wild world of open source CMS's? Take a look around - it'll save you loads of development headaches. -- 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] OCI8 , PHP and APACHE issue
Attached is phpinfo() both from the command line and from apache on the same machine I have done the exact same setup on my laptop and it works fine from apache and cli. I even copied over the httpd.conf and the php.ini file from my laptop as all paths and versions were identical. Oracle 10.2.0.4 client apache 2.2 php 5.2.6 Thanks On 01/09/2008, Evert Lammerts [EMAIL PROTECTED] wrote: Can you send your and the output of phpinfo when run from the command line and when run from the browser? On Mon, Sep 1, 2008 at 6:35 AM, Jack van Zanen [EMAIL PROTECTED] wrote: Hi List, I have installed Oracle, PHP and apache on my windows machine and have the following issue If I run phpinfo() from the command line it shows OCI8 as enabled and I can connect to oracle databases. When I copy my php.ini to my windows directory (from my php directory) and start apache and than run phpinfo() from a php page in my browser it does not show me that OCI8 is enabled and also does not allow me to connect to databases. It does show it is using the right php.ini from my windows directory I'm sure this must be an environment setting somewhere but I can't work this out. Anybody with some more experience in configuring this combo can shed some light on this?? Brgds Jack -- J.A. van Zanen phpinfo() PHP Version = 5.2.6 System = Windows NT D1LTYW1S 5.1 build 2600 Build Date = May 2 2008 18:01:20 Configure Command = cscript /nologo configure.js --enable-snapshot-build --with-gd=shared --with-extra-includes=C:\Program Files (x86)\Microsoft SDK\Include;C:\PROGRA~2\MICROS~2\VC98\ATL\INCLUDE;C:\PROGRA~2\MICROS~2\VC98\INCLUDE;C:\PROGRA~2\MICROS~2\VC98\MFC\INCLUDE --with-extra-libs=C:\Program Files (x86)\Microsoft SDK\Lib;C:\PROGRA~2\MICROS~2\VC98\LIB;C:\PROGRA~2\MICROS~2\VC98\MFC\LIB Server API = Command Line Interface Virtual Directory Support = enabled Configuration File (php.ini) Path = C:\WINDOWS Loaded Configuration File = C:\PHP\php.ini PHP API = 20041225 PHP Extension = 20060613 Zend Extension = 220060519 Debug Build = no Thread Safety = enabled Zend Memory Manager = enabled IPv6 Support = enabled Registered PHP Streams = php, file, data, http, ftp, compress.zlib Registered Stream Socket Transports = tcp, udp Registered Stream Filters = convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.* This program makes use of the Zend Scripting Language Engine: Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies ___ Configuration PHP Core Directive = Local Value = Master Value allow_call_time_pass_reference = Off = Off allow_url_fopen = On = On allow_url_include = Off = Off always_populate_raw_post_data = Off = Off arg_separator.input = = arg_separator.output = = asp_tags = Off = Off auto_append_file = no value = no value auto_globals_jit = On = On auto_prepend_file = no value = no value browscap = no value = no value default_charset = no value = no value default_mimetype = text/html = text/html define_syslog_variables = Off = Off disable_classes = no value = no value disable_functions = no value = no value display_errors = STDOUT = STDOUT display_startup_errors = Off = Off doc_root = no value = no value docref_ext = no value = no value docref_root = no value = no value enable_dl = On = On error_append_string = no value = no value error_log = no value = no value error_prepend_string = no value = no value error_reporting = 0 = 0 expose_php = On = On extension_dir = ./ext/ = ./ext/ file_uploads = On = On highlight.bg = font style=color: #FF#FF/font = font style=color: #FF#FF/font highlight.comment = font style=color: #FF8000#FF8000/font = font style=color: #FF8000#FF8000/font highlight.default = font style=color: #BB#BB/font = font style=color: #BB#BB/font highlight.html = font style=color: #00#00/font = font style=color: #00#00/font highlight.keyword = font style=color: #007700#007700/font = font style=color: #007700#007700/font highlight.string = font style=color: #DD#DD/font = font style=color: #DD#DD/font html_errors = Off = Off ignore_repeated_errors = Off = Off ignore_repeated_source = Off = Off ignore_user_abort = Off = Off implicit_flush = On = On include_path = .;C:\php5\pear = .;C:\php5\pear log_errors = On = On log_errors_max_len = 1024 = 1024 magic_quotes_gpc = Off = Off magic_quotes_runtime = Off = Off magic_quotes_sybase = Off = Off mail.force_extra_parameters = no value = no value max_execution_time = 0 = 0 max_input_nesting_level = 64 = 64 max_input_time = -1 = -1 memory_limit = 128M = 128M open_basedir = no value = no value output_buffering = 0 = 0 output_handler = no value = no value post_max_size = 8M = 8M precision = 14 = 14 realpath_cache_size = 16K = 16K realpath_cache_ttl = 120 = 120 register_argc_argv = On = On register_globals
Re: [PHP-DB] OCI8 , PHP and APACHE issue
I have the phpinidir directive set in apache so it loads the exact same php.ini as the cli Jack 2008/9/1 Evert Lammerts [EMAIL PROTECTED] I see that in both cases c:\PHP\php.ini is loaded. Are you sure that after trying the command line you didn't cut - paste the file to c:\windows? What do apache's and PHP's logs say? On Mon, Sep 1, 2008 at 1:25 PM, Jack van Zanen [EMAIL PROTECTED] wrote: Attached is phpinfo() both from the command line and from apache on the same machine I have done the exact same setup on my laptop and it works fine from apache and cli. I even copied over the httpd.conf and the php.ini file from my laptop as all paths and versions were identical. Oracle 10.2.0.4 client apache 2.2 php 5.2.6 Thanks On 01/09/2008, Evert Lammerts [EMAIL PROTECTED] wrote: Can you send your and the output of phpinfo when run from the command line and when run from the browser? On Mon, Sep 1, 2008 at 6:35 AM, Jack van Zanen [EMAIL PROTECTED] wrote: Hi List, I have installed Oracle, PHP and apache on my windows machine and have the following issue If I run phpinfo() from the command line it shows OCI8 as enabled and I can connect to oracle databases. When I copy my php.ini to my windows directory (from my php directory) and start apache and than run phpinfo() from a php page in my browser it does not show me that OCI8 is enabled and also does not allow me to connect to databases. It does show it is using the right php.ini from my windows directory I'm sure this must be an environment setting somewhere but I can't work this out. Anybody with some more experience in configuring this combo can shed some light on this?? Brgds Jack -- J.A. van Zanen -- J.A. van Zanen
RE: [PHP-DB] OCI8 , PHP and APACHE issue
Funny you should mention that. Could not load the extension. I tried putting c:\php\ext as extension_dir but that resulted in apache being unable to start at all. Than I remembered that on this particular machine we were running as a different user and not local system. When I changed that it worked ok I really need to understand more about windows I guess Jack -Original Message- From: Evert Lammerts [mailto:[EMAIL PROTECTED] Sent: Monday, September 01, 2008 10:32 PM To: Jack van Zanen Cc: php-db@lists.php.net Subject: Re: [PHP-DB] OCI8 , PHP and APACHE issue No interesting entries in the logs? On Mon, Sep 1, 2008 at 2:27 PM, Jack van Zanen [EMAIL PROTECTED] wrote: I have the phpinidir directive set in apache so it loads the exact same php.ini as the cli Jack 2008/9/1 Evert Lammerts [EMAIL PROTECTED] I see that in both cases c:\PHP\php.ini is loaded. Are you sure that after trying the command line you didn't cut - paste the file to c:\windows? What do apache's and PHP's logs say? On Mon, Sep 1, 2008 at 1:25 PM, Jack van Zanen [EMAIL PROTECTED] wrote: Attached is phpinfo() both from the command line and from apache on the same machine I have done the exact same setup on my laptop and it works fine from apache and cli. I even copied over the httpd.conf and the php.ini file from my laptop as all paths and versions were identical. Oracle 10.2.0.4 client apache 2.2 php 5.2.6 Thanks On 01/09/2008, Evert Lammerts [EMAIL PROTECTED] wrote: Can you send your and the output of phpinfo when run from the command line and when run from the browser? On Mon, Sep 1, 2008 at 6:35 AM, Jack van Zanen [EMAIL PROTECTED] wrote: Hi List, I have installed Oracle, PHP and apache on my windows machine and have the following issue If I run phpinfo() from the command line it shows OCI8 as enabled and I can connect to oracle databases. When I copy my php.ini to my windows directory (from my php directory) and start apache and than run phpinfo() from a php page in my browser it does not show me that OCI8 is enabled and also does not allow me to connect to databases. It does show it is using the right php.ini from my windows directory I'm sure this must be an environment setting somewhere but I can't work this out. Anybody with some more experience in configuring this combo can shed some light on this?? Brgds Jack -- J.A. van Zanen -- J.A. van Zanen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] OCI8 , PHP and APACHE issue
Hi List, I have installed Oracle, PHP and apache on my windows machine and have the following issue If I run phpinfo() from the command line it shows OCI8 as enabled and I can connect to oracle databases. When I copy my php.ini to my windows directory (from my php directory) and start apache and than run phpinfo() from a php page in my browser it does not show me that OCI8 is enabled and also does not allow me to connect to databases. It does show it is using the right php.ini from my windows directory I'm sure this must be an environment setting somewhere but I can't work this out. Anybody with some more experience in configuring this combo can shed some light on this?? Brgds Jack
[PHP-DB] Test connection to database
Hi I have written a little program that cycles through a list of databases and checks conectivity. it writes the status of this to a table now to check all 143 databases it takes about 50 seconds and I was wondering if this sounds about right to you guys. ?php //Include the required libraries and variables include_once (adodb5/adodb.inc.php); include_once (ola_ini.php); //Setup the connection to the database to be updated $db = NewADOConnection('oci8'); $db-Connect(false, $ola_usr, $ola_pwd, $ola_dbs); //Get the current status of the database (UP, DOWN or CHECKING) $stmt = $db-Prepare(select nvl(status,'NEW') from sla_monitoring where upper(database)=upper(:dbs)); $rs=$db-Execute($stmt, array('dbs' = $argv[1])); //Logon check for ORACLE (OCI) if($argv[2]=='Oracle') { if($rs-fields[0] == 'CHECKING') //If current status is CHECKING than the previous check has not completed. Find out why!!! { echo exiting; exit; } else { $stmt = $db-Prepare(update sla_monitoring set status=:status, last_check=to_date(:checkdate,'ddmmhh24miss') where upper(database)=upper(:dbs)); $rs=$db-Execute($stmt, array('dbs' = $argv[1],'status'='CHECKING','checkdate'=$argv[3])); //set status to CHECKING for current database before proceding if($db-Connect(false, $ora_usr, $ora_pwd,$argv[1] )) { $db-Execute($stmt, array('dbs' = $argv[1],'status'='UP')); } else { $rs=$db-Execute($stmt, array('dbs' = $argv[1],'status'='DOWN')); } } } ? this script gets called from a windows batch file to try and mimic a bit of multithreading snip startphp-win check_connect.php B2B Oracle 27082008145929 eamdasoplp01 startphp-win check_connect.php B2B Oracle 27082008145929 opal startphp-win check_connect.php BOCMSDEV Oracle 27082008145929 eawalsbop02 startphp-win check_connect.php BOCMSDR Oracle 27082008145929 eawalsbop02 startphp-win check_connect.php BOCMSP Oracle 27082008145929 eahobsorap01 . /snip Is this the best way to do this or are there any other ways that may lead to better performance. I realize I will have some contention on my table that can maybe be addressed, but for now let's focus on the PHP/BAT process Thanks Jack
Re: [PHP-DB] Test connection to database
Databases are located in several datacentres throughout the area/country and we connect through dedicated lines not internet. I realize that there may be many factors to consider, I just would like to have the PHP experts have a look at my method/PHP code to check that this is fairly optimized Jack On 27/08/2008, Chris [EMAIL PROTECTED] wrote: Jack van Zanen wrote: Hi I have written a little program that cycles through a list of databases and checks conectivity. it writes the status of this to a table now to check all 143 databases it takes about 50 seconds and I was wondering if this sounds about right to you guys. Across your network I assume. All internal or some db's are external? Don't forget about network overhead, and even more so if you're going out to the internet at some point. -- Postgresql php tutorials http://www.designmagick.com/ -- J.A. van Zanen
[PHP-DB] Configuring PHP 5.2.0 with Postgres 8.1.3 (no source)
I'm trying to configure PHP 5.2.0 with support for Postgres 8.1.3. Postgres was installed with FC5 without source. PHP's configure needs source. When I run configure: configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path I tried downloading Postgres source and modifying PHPs configure to point to it, and that worked. But then compilation failed, e.g. In file included from /home/jao/php-5.2.0/ext/pgsql/php_pgsql.h:32, from /home/jao/php-5.2.0/ext/pgsql/pgsql.c:45: /usr/local/src/postgresql-8.1.4/src/interfaces/libpq/libpq-fe.h:29:26: error: postgres_ext.h: No such file or directory In file included from /home/jao/php-5.2.0/ext/pgsql/php_pgsql.h:32, from /home/jao/php-5.2.0/ext/pgsql/pgsql.c:45: /usr/local/src/postgresql-8.1.4/src/interfaces/libpq/libpq-fe.h:317: error: expected ';', ',' or ')' before '*' token Then I thought I'd uninstall the postgres RPMs and build postgres from scratch, but there are dependencies on postgres: libpq.so.4 is needed by (installed) apr-util-1.2.2-4.2.i386 libpq.so.4 is needed by (installed) dovecot-1.0-0.beta2.7.i386 libpq.so.4 is needed by (installed) perl-DBD-Pg-1.43-2.2.2.i386 And I really don't want to unravel my entire set of RPMs. So I have two questions: 1) Does PHP 5.2.0 support Postgres 8.x? The compilation errors, and some of the postgres paths in the configure file suggest that it might not. 2) How can I get PHP configured to support postgres? Jack Orenstein -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with list#2
On Friday 07 July 2006 14:30, Karl James wrote: Team, I am still receiving duplicate emails. Karl James (TheSaint) mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] www.theufl.com Did you save your confirm and welcome e-mail from the list? That will tell you which one or if both of them are on the list. -- Jack Gates http://www.jlgates.com/ http://www.myenergyproducts.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] unsuscribe
[PHP-DB] unsuscribe __ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: send email
Hi my example earlier does not show the email address in the source of the displayed web page. It is in the source code, but you can change that to be put in a config file and include this file in the script. Jack -Original Message- From: howard gramer [mailto:[EMAIL PROTECTED] Sent: dinsdag 25 november 2003 21:09 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Re: send email I am in the same boat, ( I posted a couple of days ago Subject: Re: [PHP-DB] Send formmail data to Email and Database ), not knowing where to put the Mail() into my own code. I am working on it but no success yet. But, my real question in this topic; with formmail.pl using Sendmail your able to use recipients_alias = [EMAIL PROTECTED] inside of the FormMail.conf file. So this means you can hide the email address in the configuration file without it being seen in the page source. How do you accomplish the same with Mail()? i.e. hiding the email howard grämer New York City [EMAIL PROTECTED] From: Kim Steinhaug [EMAIL PROTECTED] Reply-To: Kim Steinhaug [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: send email Date: Tue, 25 Nov 2003 19:57:44 +0100 Well this shouldnt be any problem. I suspect you dont know how to set up the email routine since your asking. All you need to do is insert a sendmail script together with the update of the mySQL database. You could use PHPs internal functions for this, but Ill recommend you using PHPmailer which is heavily documentet with tons of examples on how to use. The PHPmailer is located at sourceforge and you should find it right away. It has to be the most elegant way I know of sending emails from PHP scripts. And as a bonus, the PHPmailer is under active development so you will most likely never run into problems using it, :) -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Redhat [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have created a simple form that dumps input information into a mysql database. The person that I created it for said it would be nice if it would also notify him by email that an entry was added to the database. I have no idea where to begin with that - any ideas? thanks, DF _ online games and music with a high-speed Internet connection! Prices start at less than $1 a day average. https://broadband.msn.com (Prices may vary by service area.) -- 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 Issue
check your apache httpd.conf (or iis configuration or whatever your webserver is) see if you told it to parse php scripts before presenting it to the web. *** LoadModule php4_module c:/php/sapi/php4apache2.dll AddType application/x-httpd-php .php *** or install PHP or name your file .PHP (if type added is .php or start your script with ? [PHP] and end it with ? Jack -Original Message- From: Michael Cupp, Jr. [mailto:[EMAIL PROTECTED] Sent: vrijdag 3 oktober 2003 23:29 To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP Issue I'm trying to 'run' a php pgoram by loading it into my browser, but instead of running, it only displays it to me - how can I fix this? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP 5 and MySQL
Hi, I installed Apache/2.0.47 (Unix) PHP/5.0.0b1 pretty much the same way I installed version 4.3.3 on this apache and both work fine with Mysql straight from the start. This is on Linux and I did compile features into Apache *** MySQL Support enabled Active Persistent Links 0 Active Links 0 Client API version 4.1.0-alpha MYSQL_MODULE_TYPE external MYSQL_SOCKET /tmp/mysql.sock MYSQL_INCLUDE -I/usr/local/mysql/include MYSQL_LIBS -L/usr/local/mysql/lib -lmysqlclient Jack -Original Message- From: John Smith [mailto:[EMAIL PROTECTED] Sent: woensdag 1 oktober 2003 19:08 To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP 5 and MySQL Hello all: This may be a stupid question, but I am having trouble running MySQL on PHP 5. It seems as though the MySQL functionality is not loaded by default. When running 4.3.3 and then showing phpinfo() I receive information containing the fact that the MySQL module has been loaded, but 5.0 does not show this. Is there a way to activate it? Thanks, -- John Smith -- 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] Selecting data from multiple tables
Hi You did not mention your DB , but following syntax should get you on your way select tbl1.user_id , tbl1.username , tbl2.age , tbl3.town , tbl3.country fromtbl1 , tbl2 , tbl3 where tbl1.user_id=tbl2.user_id and tbl1.user_id=tbl2.user_id and tbl2.user_id=tbl3.user_id (not neccessary but sometimes better performance) and tbl2.age=30 and tbl3.country='UNITED KINGDOM' Jack -Original Message- From: Awlad Hussain [mailto:[EMAIL PROTECTED] Sent: zaterdag 27 september 2003 15:58 To: [EMAIL PROTECTED] Subject: [PHP-DB] Selecting data from multiple tables I have three tables as shown below: tbl1 --- user_id username password .. .. tbl2 -- user_id age (date) tbl3 --- user_id town country How can i construct sql query for example to select data from all three tables where age is 30 and country is United Kingdom? Many Thanks in Advance. AH -- 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] Connect to Oracle DB
Hi I don't know how this shared library works, but to the best of my knowledge you'll always need oracle client software (SQL*Net) installed on the php server to connect to an oracle database . Please correct me if I'm wrong and point me to the docs. Tia Jack -Original Message- From: Martin Marques [mailto:[EMAIL PROTECTED] Sent: vrijdag 12 september 2003 18:15 To: [EMAIL PROTECTED]; php-db Subject: Re: [PHP-DB] Connect to Oracle DB El Vie 12 Sep 2003 15:52, Frederico Madeia escribi: Dear friends, How i connect one server running PHP(linux) to other server running Oracle(linux) ?? when i tryed to connect with ora_logon, the server return me: Call to undefined function: ora_logon(). In php.net describe some functions to connect to oracle,. but how i make to do work ??? I must install oracle on same server that runing php ?? 1) Oracle and PHP can be on different servers (in some cases it's better to have them separeted). 2) they don't even have to be on the same OS, even though it's a good idea. 3) Your erro is due to the fact that you don't have an oracle-featured PHP installed, so you have to recompile PHP with the --with-oracle option, or try to get a shared library for oracle support for your PHP version. -- Porqu usar una base de datos relacional cualquiera, si pods usar PostgreSQL? - Martn Marqus |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral - -- 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] How to insert date into date field
Hi I have a date that is formatted in the following way day(00-31)/Mon(Jan-Dec)/year(2003):hour(00-23):minute(00-59):sec(00-59) I want to load this into mysql table (date column) In oracle I can just use the to_date function but all I find about MYSQL seems to want the date in a specific format beforehand. Any help?? TIA JAck -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] How to insert date into date field
load my apache access log into a table (this is formatted wrong) I now use a workaround by adding the date that I enter the records into the table as well. I lose the timestamp but that's ok for now. I then wrote an update statement to convert the old data to the correct date and just make sure that just before midnight every day I load the data. I'll look at my PHP insert script one day to see if I can easily change this to pre format the date field . Jack -Original Message- From: Jennifer Goodie [mailto:[EMAIL PROTECTED] Sent: dinsdag 26 augustus 2003 1:13 To: Jack van Zanen; Php-Db Subject: RE: [PHP-DB] How to insert date into date field I have a date that is formatted in the following way day(00-31)/Mon(Jan-Dec)/year(2003):hour(00-23):minute(00-59):sec(00-59) I want to load this into mysql table (date column) In oracle I can just use the to_date function but all I find about MYSQL seems to want the date in a specific format beforehand. If you are using PHP to insert it you can just format it before sticking it in. It gets a little more complicated if you are loading it in via LOAD DATA INFILE or something like that. What exactly are you attempting to do? -- 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] MYSQL 4.1 derived tables and PHP
Hi List, I have installed MYSQL 4.1 with support for derived tables. If I query Mysql with a query that has a subquery in the from clause it works fine. If I now load this query in PHP I get invalid resource error. If I change the select for another select w/o the subquery it works fine (So my php script must be correct). Does PHP do syntax checking before sending the query to mysql? Any other solution? I have tried PHP 4.3.2/4.3.3 5.0 TIA Jack -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Adding MySQL support to PHP - libmysqlclient.so version problem
I need MySQL support from PHP to support the HORDE/IMP webmail package. I just installed RedHat 9, and this included PHP 4.2.2-17. According to the PHP test.php page, MySQL support was configured: --with-mysql=shared,/usr However, later in the test.php page, there is no section on MySQL. (Furthermore, the HORDE test.php says that PHP does not have MySQL support.) The MySQL version I'm using is 4.0.13-0. I realized that I needed php-mysql. Installing that binary rpm: libmysqlclient.so.10 is needed by php-mysql-4.2.2-17 So I got MySQL-shared_4.0.13-0, matching the version number of my other MySQL RPMs. But that contains /usr/lib/libmysqlclient.so.12, not the .10 version. How can I get mysql support in php? I'm hoping to avoid ripping out mysql and php and building everything from source. Jack Orenstein -- This is not a disclaimer -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Adding MySQL support to PHP - libmysqlclient.so versionproblem
Doug Thompson wrote: This is in the archives, but it was faster to find it in my stack of saved stuff: quote For those who installed RH 8.0 and went threw the same php/mysql woes you just have to go to http://rpmfind.net/linux/rpm2html/search.php?query=php-mysql And install the 8.0.5 (psyche?) or 8.0.7 php-mysql rpm. end quote This doesn't work for me. I have rh9 and the PHP any MySQL versions it installed appear to be incompatible with the 8.0.7 php-mysql: error: Failed dependencies: php = 4.2.2-8.0.7 is needed by php-mysql-4.2.2-8.0.7 libmysqlclient.so.10 is needed by php-mysql-4.2.2-8.0.7 Jack Orenstein -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Will PHP work with IBM DB2 dbms?
Can anyone tell me if I can use PHP with a IBM DB2 database management system, running on a AIX Unix server? Thanks Jack Schroeder -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How to Check Directory exist in Specific Folder
Dear all Does php have any script which can check if a directory exist in specific folder? Thx a lot Jack -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How to Show my Own Error Message Instead of Mysql Error?
Dear all i made a Registration Form for user to input their Data, but i also had some Field Check before the data can be insert to the Mysql_Database! I had a question here, sometime the mysql shows the error : Duplicate Key for xxx I know what is this about, reguarding to my Registration Form, it mean the Login Name is Duplicated! But i want to show my own message to the user for this error instead the Mysql Error! It is meanness to show User the Mysql Error, cause they won't understand it!!! Could Someone pls tell me how i can do this? -- Thx a lot! Jack [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date Comparsion
Dear all I had a form which let user to input the leave_from and leave_to date into, the format of the date that user input is -mm-dd. Now i want to compare the leave_from and leave_to date to find out the number of days between! What should i do or any function in php can provide this operation? -- Thx a lot! Jack [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How to convert Date to UnixTimeStamp
Dear all I had a table which store the date input by user, eg : 2001-12-31 How i can convert it back to Unix time Stamp? I got to do so for comparsion of date! Thx a lot! Jack -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Have Problem on Checking condition before insert to Mysql Table
Dear all I had a table which store the user's Leave records. There ar two field in table that i had picked for the checking Process. 1: Leave_From, 2:Leave_To. What i want to check is either Leave_From or Leave_To will not overlap between the Records in Database. I know it quit hard to understand what i want to do, so here is an example : Existing Records in Table: NameStaff CodeLeave_FromLeave_ToBackup_Staff JACK1232002-01-152002-01-17Someone User Input: NameStaff CodeLeave_FromLeave_ToBackup_Staff May2342002-01-162002-01-18Someone As you look at the Record input by user, you can find out that there is an overlap Entry on User Input's Leave_From field. It is in between the record in Existing Record's Date. 2002-01-15 - 2002-01-16 - 2002-01-17 I want to stop any record like this case insert to my table! Does anyone know how to Prevent it? -- Thx a lot! Jack [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to Compare Date
could you tell me how i can covert it to UnixTimeStamp Format? Thx a lot Jack - Original Message - From: Jason Wong [EMAIL PROTECTED] Newsgroups: php.db To: [EMAIL PROTECTED] Sent: Thursday, May 30, 2002 8:32 PM Subject: Re: [PHP-DB] How to Compare Date On Thursday 30 May 2002 20:25, Jack wrote: Dear all I had a Input form for user to input the Leave Record, I want to do some check before the record can insert into database! Here is the problem i had when checking the Leave From Date and Leave To Date. I want to prevent any Leave To Date which is earlier then Leave From Date. how i can do the comparsion? I had tried to use the following script but it doesn't work! ? $a=$leave_form $b=$leave_to if ($a$b) { insert statement } ? It doesn't work since i use the Operator! Does anyone know how i can perform this comparsion? Convert both dates to a UNIXTIMESTAMP then do the comparison. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Politics makes strange bedfellows, and journalism makes strange politics. -- Amy Gorin */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem on Load Data into Specific Fields of a table?
Dear all Two Question : 1. I know that the 'LOAD DATA' command loads a bulk of data into a table, but what happen if i only want to load the data into specifc fields on a table instead of whole table. eg. Let say i had a file with 3 column of data, and i want to load these data into a 'ABC' table's field 3 to 5 and leave field 1 2 as it was! 2. I copied a file into server's root directory, and i was trying to load that file's data to table which i had failed using the following command in MYSQL: LOAD DATA infile 'c:\hkd_rate.csv' into table hkd_deposit1 fields terminated by ',' It said couldn't find the file! but if i put the file into the data directory of mysql, then it can find it! So what should i do if i want mysql will able to find that file from root directory? -- Thx a lot! Jack [EMAIL PROTECTED] -- Thx a lot! Jack [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Question about Load Data to mysql through php
Dear all i'm a newbie in mysql, but there is one question about LOAD Data command in mysql, let say if i had a CSV file in client side and i want to load this file's data into particular table , so do i need to copy this CSV file into Web server side where the Mysql is or i will be able to load it from the client side? Why i asking this, is i had a page that will load the csv file's data into mysql's table using php script, but when i execute this page from client side, it doesn't load the data into mysql, and there is no message saying anythin(as i don't know how to show the error message from mysql at php script!!). I had tried to use MyCC(a client program for Mysql) in client side to load the data into mysql, it works with no problem! Don't know what i had done wrong! Here is the php script at my page : ? include 'phpstudy/constant.inc'; $link=mysql_pconnect(HOST,USER,PASSWD); mysql_select_db(DBNAME,$link); print ($select); if ($select ==HKD RATE) { $importquery= LOAD DATA LOCAL INFILE 'C:/Documents and Settings/jack/Desktop/Web/test/hkd_rate.csv' into hkd_depsit1 fields terminated by ','; $resultimportquery=mysql_query($importquery,$link); print ($result); } ? -- Thx a lot! Jack [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Question about Load Data to mysql through php
Dear Jason Thx for the reply, but do you know where i should copy that file to in serverside? is it got to be the same directory of mysql? Thx a lot! Jack [EMAIL PROTECTED] - Original Message - From: Jason Wong [EMAIL PROTECTED] Newsgroups: php.db To: [EMAIL PROTECTED] Sent: Tuesday, April 30, 2002 2:45 PM Subject: Re: [PHP-DB] Question about Load Data to mysql through php On Tuesday 30 April 2002 14:33, Jack wrote: Dear all i'm a newbie in mysql, but there is one question about LOAD Data command in mysql, let say if i had a CSV file in client side and i want to load this file's data into particular table , so do i need to copy this CSV file into Web server side where the Mysql is or i will be able to load it from the client side? Yes, you would need a copy of CSV file on the server first. There are many ways to get it there: 1) ftp 2) scp 3) write a simple upload page in php etc. Why i asking this, is i had a page that will load the csv file's data into mysql's table using php script, but when i execute this page from client side, it doesn't load the data into mysql, and there is no message saying anythin(as i don't know how to show the error message from mysql at php script!!). Someone has previously posted the required code in response to your earlier post. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Cohen's Law: There is no bottom to worse. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Can't Load Data into Mysql Using PHP
Dear all I had a problem to get the php to load a csv file into mysql. I had a csv file which located at my HDD, and i had tried to Import the data from this CSV file into mysql using MYCC which is a console program for mysql, it successfully load the data into mysql table. Now i try to setup my webpage, which tried to perform same task is to load that csv file's data into mysql table, but it won't work!! don't know why!! here is my php code. ? include 'phpstudy/constant.inc'; $link=mysql_pconnect(HOST,USER,PASSWD); mysql_select_db(DBNAME,$link); print ($select); if ($select ==HKD RATE) { $importquery= LOAD DATA LOCAL INFILE 'C:/Documents and Settings/jack/Desktop/Web/test/hkd_rate.csv' into hkd_depsit1 fields terminated by ',' ; $resultimportquery=mysql_query($importquery,$link); print ($result); } ? when i run this script, it doesn't load the data into mysql! but as i said before, using the same query in MYCC, i can successfully load the data into Mysql database. Could someone pls tell me what mistake i had made? -- Thx a lot! Jack [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php and mysql security problem
Dear all I had a security problem with my homepage. I'm using the IIS 4 to host my webpage, and i got the php to run as the script of the webpage and the database i'm using for the database is mysql. Here is my question : There is a table in mysql which will let user to input some records to, then the user will update and retreive the records. But what i to do is limit the user update to the record which the user should be. I mean when user1 had insert a record into table, and he found out that there is some update need to do for the record he just inset, so he update that record. but i don't want other people can update his record. Is there also possible for php to grab the username and password from the window base which logged on to a Domain and pass it to MYSQL!! Thx Jack [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Use the User Input Critia as part of Query! (Mysql)
Dear all I had a form which ask user to input the Staff Number to be as part of the query, but when i execute it, it seems not working at all here is what i wrote in php The user input box is : $StaffNum $query=select name,department,Leave_From,Leave_To,Leave_Total,Reason from leaverequest where Staff_Number=?print($StaffNum);? and authorized is null; But said there is error on this line, which is what i expected!! So could anyone pls tell me how i can get the varaible into part of the Query of Mysql? Thx jack [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Could get all data from MYSQL using Mysql_fetch_array!!
Dear all I was trying to fetch all the data from one of my table leaverequest, but i couldn't fetch all the data if i use the * . here is my program, this one is only fetch the Reason field, but what i want is all the data. ? $dblink=mysql_pconnect(microsoft,console,edshk); mysql_select_db(nedcorhk,$dblink); $query = select * from leaverequest; $result=mysql_query($query,$dblink); while ($row= mysql_fetch_array($result,MYSQL_ASSOC)) { print ({$row[Reason]}); } ? But can i do it like that way to get all the data? (Showing below) : ? $dblink=mysql_pconnect(microsoft,console,edshk); mysql_select_db(nedcorhk,$dblink); $query = select * from leaverequest; $result=mysql_query($query,$dblink); while ($row= mysql_fetch_array($result,MYSQL_ASSOC)) { print ({$row[*]}); } ? Pls help me!! Thx jack [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Couldn't get all data using the mysql_fetch_array function, Pls Help!!!!
Dear all I was trying to fetch all the data from one of my table leaverequest, but i couldn't fetch all the data if i use the * . here is my program, this one is only fetch the Reason field, but what i want is all the data. ? $dblink=mysql_pconnect(microsoft,console,edshk); mysql_select_db(nedcorhk,$dblink); $query = select * from leaverequest; $result=mysql_query($query,$dblink); while ($row= mysql_fetch_array($result,MYSQL_ASSOC)) { print ({$row[Reason]}); } ? But can i do it like that way to get all the data? (Showing below) : ? $dblink=mysql_pconnect(microsoft,console,edshk); mysql_select_db(nedcorhk,$dblink); $query = select * from leaverequest; $result=mysql_query($query,$dblink); while ($row= mysql_fetch_array($result,MYSQL_ASSOC)) { print ({$row[*]}); } ? Pls help me!! Thx jack [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] br appear in Text file
Dear all I'm writing a script which will greb the data from a user input form into a text file (txt file), but the problem is that when the data had passed to the txt file, there will be some thing like the br and black square appear inside the file. This is affecting to display the data from that txt file to the text box in (input box). Is there anyway that i can do to avoid grebing the br from txt file to my input box's value? or anyway that i can delete the br when the data is greb from input box to txt file?? Thanks a lot Jack [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Multi-Task on PHP by submitting a form!
Dear all I was trying to get a user input form to insert to a mysql_database and e-mail to me! Is it possible to make php perform two task in one single submit button? The form will post the input -- mail.php. In the mail.php, i was thinking to add another process just after the mail process had finish, which will insert the data from the from to mysql_database. Thx Jack [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Date format in MSSQL
How I can format date in php query from MSSQL? Jack -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] ODBC returns correct # of rows, but no data?
I have a MSSQL server running on WinNT, and I am trying to issue queries to it from my Linux 2.2.17 system using ODBC. I have installed unixODBC and the FreeTDS driver, and with this combination I am able to send queries from a command line client succesfully. In particular, when I execute the query in the PHP script below, I get exactly 593 rows, as expected. When I execute the script below, I count the number of rows inside the loop, and print it out after displaying the HTML table containing all of the rows. The number of rows is 593, as expected. However, the table is blank! No data was printed! Viewing the source shows 593 copies of: TR TD/TD TD/TD /TR What gives? The query is obviously executing, and is returning the right number of rows, but it isn't giving me the row data. To make things worse, about 1 in 5 runs of this script returns Document contains no data and the following line in the error_log: [Mon May 14 12:24:16 2001] [notice] child pid 14627 exit signal Segmentation fault (11) FATAL: emalloc(): Unable to allocate 137579345 bytes Here is the script. It is a simple script to test the ODBC functions. It executes a two-column SELECT and displays the result in a table. It does not seem to matter whether I pass the field names or the column position to the odbc_result() function. Both return blank (). ? $db = odbc_connect(TEST,,); if(!$db) { echo odbc_connect() failed\n; exit; } $handle = odbc_prepare($db,SELECT acctid,company FROM account); if(!$handle) { echo odbc_prepare() failed\n; exit; } if(!odbc_execute($handle)) { echo odbc_execute() failed\n; exit; } ? TABLE BORDER !-- This row comes out blank, also. -- TR TD? echo htmlspecialchars($c1 = odbc_field_name($handle,1)) ?/TD TD? echo htmlspecialchars($c2 = odbc_field_name($handle,2)) ?/TD /TR ? } while(odbc_fetch_row($handle)) { $c++; $k = odbc_result($handle,1); $v = odbc_result($handle,2); ? TR TD? echo htmlspecialchars($k) ?/TD TD? echo htmlspecialchars($v) ?/TD /TR ? } echo /TABLE\n; odbc_free_result($handle); odbc_close($db); ? HR ? echo $c ? rows. PGP signature
[PHP-DB] Re: [PHP] How can this be done?
http://www.php.net/addslashes -jack Subodh Gupta wrote: Hi All, I created a table using the create command. create table trivia ( entry_id integer not null auto_increment, trivia text null ); Now I have a fle tvia.txt, the content of which are as follows: The average person's left hand does 56% of the typing. The longest one-syllable word in the English language is screeched. All of the clocks in the movie Pulp Fiction are stuck on 4:20. No word in the English language rhymes with month, orange, silver, or purple. I want to insert each line of the file in a new row in the table. I wrote the following code for it. ?php include db.php; dbconnect(guestbook2k); $fcontents=file(tvia.txt); while (list ($line_num, $line) = each ($fcontents)) { $query=insert into trivia (trivia) values ('$line'); $result = mysql_query($query) or die(Query failed: .lierrorno=.mysql_errno() .lierror=.mysql_error() .liquery=.$query ); echo bLine $line_num:/b . $line . br\n; } ? I got the following error. Query failed: errorno=1064 error=You have an error in your SQL syntax near 's left hand does 56% of the typing. ')' at line 1 query=insert into trivia (trivia) values ('The average person's left hand does 56% of the typing. ') Now I know that I got the error because there was ( ' ) in the first line. So how do I prevent this. Or in other words insert into the table text containing ( ' ) and ( ) or for that matter any metacharacter. Thank You in Advance. Subodh Gupta I have learned, Joy is not in things, it is in us. You will ultimately be known by what you give and not what you get. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: [PHP] RE: [PHP-DB] Login System with access levels
Just a note...you can hash the password in the database. Rick Emery wrote: First, I would NOT store passwords in a database. Rather, I'd store a hash based upon the password and username. Storing a password is dangerous as regards security. Second, if you're asking for syntax on how to add the security level column: ALTER TABLE mytable ADD access tinyint unsigned not null default "0"; This will allow you to assigned security levels from 0 to 255. You would set 0 as the lowest level and 255 (admin) as the highest. While you're at it, add the has security hash entry (discussed above): ALTER TABLE mytable ADD md5hash char(32) not null default ""; Hashes are always 32 characters. Finally, as far as a query: SELECT * FROM mytable WHERE access = $level; This will permit the searcher to locate anything whereby the level is at $level or lower. -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Friday, March 16, 2001 1:28 PM To: PHP General Mailing List; PHP DB Mailing List Subject: [PHP-DB] Login System with access levels Hi, I've got a db with a username and password in it. I can let people log in, like SELECT * FROM table WHERE username = username AND password = password. But how can I add an access level column so that I can have different levels of security. So admin's can read everything, but users can only read certain sections. How could I add to my db and structure a query? Any ideas would be good, Cheers, Jord -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- ___ Jack Sasportas Innovative Internet Solutions Phone 305.665.2500 Fax 305.665.2551 www.innovativeinternet.com www.web56.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]