Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Jack van Zanen
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

2011-10-10 Thread Jack van Zanen
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

2009-12-13 Thread Jack van Zanen
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

2009-10-15 Thread Jack van Zanen
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

2009-09-12 Thread Jack van Zanen
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

2009-09-12 Thread Jack van Zanen
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?

2009-08-03 Thread Jack van Zanen
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?

2009-08-02 Thread Jack van Zanen
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

2009-07-16 Thread Jack van Zanen
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

2009-07-16 Thread Jack van Zanen
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)

2009-07-16 Thread Jack van Zanen
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

2009-04-08 Thread Jack van Zanen
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


Re: [PHP-DB] Bounty for PHP DB project

2009-03-22 Thread Jack van Zanen
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

2008-12-28 Thread Jack van Zanen
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.

2008-12-10 Thread Jack van Zanen
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] MySQL Query Timeout program in PHP

2008-10-15 Thread Jack van Zanen
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

2008-10-02 Thread Jack van Zanen
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...)

2008-09-27 Thread Jack van Zanen
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

2008-09-25 Thread Jack van Zanen
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

2008-09-25 Thread Jack van Zanen
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?

2008-09-22 Thread Jack van Zanen
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.

2008-09-19 Thread Jack van Zanen
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

2008-09-04 Thread Jack van Zanen
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

2008-09-01 Thread Jack van Zanen
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

2008-09-01 Thread Jack van Zanen
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

2008-09-01 Thread Jack van Zanen
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

2008-08-31 Thread Jack van Zanen
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

2008-08-26 Thread Jack van Zanen
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

2008-08-26 Thread Jack van Zanen
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


RE: [PHP-DB] Re: send email

2003-11-25 Thread Jack van Zanen
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

2003-10-03 Thread Jack van Zanen
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

2003-10-01 Thread Jack van Zanen
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

2003-09-27 Thread Jack van Zanen
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

2003-09-13 Thread Jack van Zanen
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

2003-08-26 Thread Jack van Zanen
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

2003-08-26 Thread Jack van Zanen
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

2003-08-22 Thread Jack van Zanen
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