Re: [PHP-DB] Problem with query

2013-06-25 Thread Karl DeSaulniers
Im going to play devils advocate here and say, why is it the one who's helping 
that needs to be polite and respectful? Isn't it also the newbies 
responsibility to respect and be polite to those taking time out of their day 
to help them and not be so stubborn as to not take the advice given which has 
been the example given here by Ethan? Ethan has been given great advice and 
should be taking that advice and looking things up and learning, not asking 
Newbie confused, please explain?. It seems to me that the Help is being 
taken advantage of here and used as a crutch to get the work done that Ethan 
has taken upon himself even thought he knows he knows very little about 
programming in PHP. And that is PHP not PhD. But all that aside as you can see, 
the same people who Ethan has somewhat ignored their advice are still going 
against their better judgement to go out of their way to help.. again. Just how 
much help should be given before you realize the horse is just not drinking the 
water? I am all for Ethan getting help from the list and I don't want to 
chastise, but come on, someone with a PhD should know better and should know 
even better then most on how to listen and learn. Hence the PhD. You don't get 
one of those by doing what Ethan is doing. If he did that to his professors, he 
would have failed. Just saying.

Best,
Karl


On Jun 25, 2013, at 1:32 AM, OJFR wrote:

 Yeah, Jim, please explain what u mean by Per the manual, associative arrays
 using string indices should always use ' ' around them.  They work (as
 mentioned in the manual) but are wrong. As long as I remember  I could use
 associative arrays in that way (ex. $_SESSION['Cust_Num']). There's another
 way to do that using string indices? Why do you say it's wrong? It's
 obsolete?
 
 I would like to make a call to all the members of this mailing list:
 knowledge is a wonderful gift so, why we don't share it politely and
 efficiency. Jim, I will take you as an example. You start saying  Against
 my better judgement, here I go again. If it's against your better judgment
 please don't go anywhere, your conscience is a good adviser. After that you
 talked a little about standards and some manual. If you are not happy to
 help people who make some mistakes regarding to programming standards, you
 should inform them where they can find the glorious manual and what is the
 correct syntax to do what people need to do. This is a better way to show to
 others what you know in a humble way but I suppose that wasn't what you were
 trying to do. I consider this list is to HELP others and share what we know.
 Never break the silence if it's not to make it better.
 
 Ethan, I will check your problem and I'll write you back as soon as I can
 'cause right now I don't have anything installed in my computer. I'll try to
 do it tomorrow, ok? Be nice and stay well!!!
 
 Osain.
 
 -Mensaje original-
 De: Ethan Rosenberg, PhD [mailto:erosenb...@hygeiabiomedical.com] 
 Enviado el: domingo, junio 23, 2013 4:38 PM
 Para: php-db@lists.php.net; Jim Giner
 Asunto: [PHP-DB] Re: Problem with query
 
 On 6/23/2013 2:31 PM, Ethan Rosenberg, PhD wrote:
 Dear List -
 
 There is an error in my query, and I cannot find it.
 
 This fails:
 
 $_SESSION['Cust_Num'] = $_REQUEST['cnum']; $_SESSION['CustNum'] = 
 $_REQUEST['cnum'];
 
 echo sessionbr /; //this has the proper values print_r($_SESSION);
 
 $sql10 = select Balance, Payments, Charges, Date from Charges where 
 Cust_Num = $_SESSION[Cust_Num] order by Date; echo $sql10; //echos 
 the correct query
 $result10 = mysqli_query($cxn, $sql10); var_dump($result1); // this 
 returns NULL
 
 Against my better judgement, here I go again.
 
 Is this the actual code you executed, or is it once again a typeover?
 
 Your 1st error is in these two lines:
 $result10 = mysqli_query($cxn, $sql10); var_dump($result1); // this 
 returns NULL
 
 Yes your dump returns null.  And always will.
 
 
 Any further errors might be related to your non-standard syntax for the
 session variable.  Per the manual, associative arrays using string indices
 should always use ' ' around them.  They work (as mentioned in the manual)
 but are wrong.
 ===
 Jim -
 
 
 Is this the actual code you executed, or is it once again a typeover?
 
   The actual code
 
 Any further errors might be related to your non-standard syntax for the
 session variable.  Per the manual, associative arrays using string indices
 should always use ' ' around them.  They work (as mentioned in the manual)
 but are wrong.
 
   Newbie is confused.
 
   Please explain.
 
 TIA
 
 Ethan
 
 --
 PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit:
 http://www.php.net/unsub.php
 
 
 --
 
 Este mensaje le ha llegado mediante el servicio de correo electronico que 
 ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
 Nacional de Salud. La persona que envia este correo asume el compromiso de 
 usar el servicio a tales fines y 

Re: [PHP-DB] Problem with query

2013-06-23 Thread Matijn Woudt
On Sun, Jun 23, 2013 at 8:31 PM, Ethan Rosenberg, PhD 
erosenb...@hygeiabiomedical.com wrote:

 Dear List -

 There is an error in my query, and I cannot find it.

 This fails:

 $_SESSION['Cust_Num'] = $_REQUEST['cnum'];
 $_SESSION['CustNum'] = $_REQUEST['cnum'];

 echo sessionbr /; //this has the proper values
 print_r($_SESSION);

 $sql10 = select Balance, Payments, Charges, Date from Charges where
 Cust_Num = $_SESSION[Cust_Num] order by Date;
 echo $sql10; //echos the correct query
 $result10 = mysqli_query($cxn, $sql10);
 var_dump($result1); // this returns NULL
 echo centerstrongCurrent Results/strong/center;
 echo center;
 echo table border='4' cellpadding='5' cellspacing='55' rules='all'
 frame='box';
 echo tr class='heading';
 echo thBalance/th;
 echo thPayments/th;
 echo thCharges/th;
 echo thDate/th;
 echo /tr;
 echo row1br /;


$row10 is undefined here, so:
$row10 = mysqli_fetch_row($result10); ?

I would suggest using
while (($row1 = mysqli_fetch_row($result1))!= 0 ) { ... }

instead of
do { ... } while (($row1 = mysqli_fetch_row($result1))!= 0 );

This avoids the need of the extra mysqli_fetch_row before the do-while loop.

- Matijn


Re: [PHP-DB] Problem wkith Query

2013-06-23 Thread Ethan Rosenberg, PhD





On 23 June 2013 21:37, Ethan Rosenberg, PhD 
erosenb...@hygeiabiomedical.com wrote:


On 6/23/2013 2:31 PM, Ethan Rosenberg, PhD wrote:

Dear List -

There is an error in my query, and I cannot find it.

This fails:

$_SESSION['Cust_Num'] = $_REQUEST['cnum'];
$_SESSION['CustNum'] = $_REQUEST['cnum'];

echo sessionbr /; //this has the proper values
print_r($_SESSION);

$sql10 = select Balance, Payments, Charges, Date from Charges 
where

Cust_Num = $_SESSION[Cust_Num] order by Date;
echo $sql10; //echos the correct query
$result10 = mysqli_query($cxn, $sql10);
var_dump($result1); // this returns NULL


Against my better judgement, here I go again.

Is this the actual code you executed, or is it once again a typeover?

Your 1st error is in these two lines:

$result10 = mysqli_query($cxn, $sql10);

var_dump($result1); // this returns NULL


Yes your dump returns null.  And always will.


Any further errors might be related to your non-standard syntax for 
the session variable.  Per the manual, associative arrays using string 
indices should always use ' ' around them.  They work (as mentioned in 
the manual) but are wrong.

===
Jim -



Is this the actual code you executed, or is it once again a typeover?

The actual code


Any further errors might be related to your non-standard syntax for 
the session variable.  Per the manual, associative arrays using string 
indices should always use ' ' around them.  They work (as mentioned in 
the manual) but are wrong.


Newbie is confused.

Please explain.


Try ...

 $sql10 = select Balance, Payments, Charges, Date from Charges where 
Cust_Num = {$_SESSION['Cust_Num']} order by Date;



--
Richard Quadling
Twitter : @RQuadling
EE : http://e-e.com/M_248814.html
Zend : http://bit.ly/9O8vFY
=
Tried it. No luck

Ethan

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem wkith Query

2013-06-23 Thread Richard Quadling
Turn on error reporting/logging/displaying and what errors are you getting?

And as you said ...

$result10 = mysqli_query($cxn, $sql10);
var_dump($result1); // this returns NULL

is your actual code, maybe ...

?php
$a = 'set variable a to this message';
var_dump($b);
?

gives you a better clue?


On 23 June 2013 23:06, Ethan Rosenberg, PhD erosenb...@hygeiabiomedical.com
 wrote:





 On 23 June 2013 21:37, Ethan Rosenberg, PhD erosenberg@hygeiabiomedical.*
 *com erosenb...@hygeiabiomedical.com wrote:

 On 6/23/2013 2:31 PM, Ethan Rosenberg, PhD wrote:

 Dear List -

 There is an error in my query, and I cannot find it.

 This fails:

 $_SESSION['Cust_Num'] = $_REQUEST['cnum'];
 $_SESSION['CustNum'] = $_REQUEST['cnum'];

 echo sessionbr /; //this has the proper values
 print_r($_SESSION);

 $sql10 = select Balance, Payments, Charges, Date from Charges
 where
 Cust_Num = $_SESSION[Cust_Num] order by Date;
 echo $sql10; //echos the correct query
 $result10 = mysqli_query($cxn, $sql10);
 var_dump($result1); // this returns NULL


 Against my better judgement, here I go again.

 Is this the actual code you executed, or is it once again a typeover?

 Your 1st error is in these two lines:

 $result10 = mysqli_query($cxn, $sql10);

 var_dump($result1); // this returns NULL


 Yes your dump returns null.  And always will.


 Any further errors might be related to your non-standard syntax for
 the session variable.  Per the manual, associative arrays using string
 indices should always use ' ' around them.  They work (as mentioned in the
 manual) but are wrong.
 ===
 Jim -



 Is this the actual code you executed, or is it once again a typeover?

 The actual code


 Any further errors might be related to your non-standard syntax for
 the session variable.  Per the manual, associative arrays using string
 indices should always use ' ' around them.  They work (as mentioned in the
 manual) but are wrong.

 Newbie is confused.

 Please explain.


 Try ...

  $sql10 = select Balance, Payments, Charges, Date from Charges where
 Cust_Num = {$_SESSION['Cust_Num']} order by Date;


 --
 Richard Quadling
 Twitter : @RQuadling
 EE : http://e-e.com/M_248814.html
 Zend : http://bit.ly/9O8vFY
 =
 Tried it. No luck

 Ethan




-- 
Richard Quadling
Twitter : @RQuadling
EE : http://e-e.com/M_248814.html
Zend : http://bit.ly/9O8vFY


Re: [PHP-DB] Problem w/query - again

2012-02-09 Thread Amit Tandon
Dear Ethan

It seems you are trying to build a query.But you are not getting field
names. If you required field names then change the following line to

foreach ( $allowed_fields AS $field = $_POST['field'])
to
foreach ( $allowed_fields AS $field)

This would convert the variable field to value. In yoyr line the variable
field is treated as array index

regds
amit

The difference between fiction and reality? Fiction has to make sense.


On Fri, Feb 10, 2012 at 9:40 AM, Ethan Rosenberg eth...@earthlink.netwrote:

 Dear list -

 This did not seem to post, so I am sending it again.

 If it did post, and I missed it, my apologies.

 Ethan
 
 Dear list -

 I have the following code:

 $query = select * from Intake3 where  1;

 $allowed_fields = array('Site', 'MedRec', 'Fname', 'Lname',
'Phone', 'Sex', 'Height');

 foreach ( $allowed_fields AS $field = $_POST['field'])
 {
if ( ! empty( $_POST['field'] ) )
{
$query .=  AND '$field' = '$_POST[$field]' ;
echo $query;
}
 }

 This is the value of $_POST:


  Array
 (
[Site] = AA
[MedRec] = 1
[Fname] =
[Lname] =
[Phone] =
[Height] =
[welcome_already_seen] = already_seen
 )

 I receive the following errors on run:



  Notice: Undefined offset: 0 in /var/www/srchrhsptl4.php on line 135
 select * from Intake3 where  1 AND '0' = ''
 Notice: Undefined offset: 1 in /var/www/srchrhsptl4.php on line 135
 select * from Intake3 where  1 AND '0' = ''  AND '1' = ''
 Notice: Undefined offset: 2 in /var/www/srchrhsptl4.php on line 135
 select * from Intake3 where  1 AND '0' = ''  AND '1' = ''  AND '2' = ''

 Advice and help please.

 Thanks.


 Ethan





 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Problem w/query - again

2012-02-09 Thread Ethan Rosenberg

At 12:13 AM 2/10/2012, Amit Tandon wrote:

Dear Ethan

It seems you are trying to build a query.But you are not getting field
names. If you required field names then change the following line to

foreach ( $allowed_fields AS $field = $_POST['field'])
to
foreach ( $allowed_fields AS $field)

This would convert the variable field to value. In yoyr line the variable
field is treated as array index

regds
amit

The difference between fiction and reality? Fiction has to make sense.

snip

 Advice and help please.

 Thanks.


 Ethan
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Amit -

Thanks.

Tried it.  Still does not work.

This is the query I get:

select * from Intake3 where  1

Ethan 




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem w/query - again

2012-02-09 Thread Amit Tandon
Dear Ethan

The line you are getting is because the $_POST[fieldname] is blank. So for
the following line
 if ( ! empty( $_POST['field'] ) )
change it to
 if ( ! empty( $_POST[$field] ) )

Your line : Program is searxchinbg for variable name field
New line : The Program is seacging for varable stored in $field. Rember to
use double quotes

And to verify the value echo $_POST[$field] before your if line i.e.
 if ( ! empty( $_POST[$field] ) )


regds
amit

The difference between fiction and reality? Fiction has to make sense.


On Fri, Feb 10, 2012 at 11:04 AM, Ethan Rosenberg eth...@earthlink.netwrote:

 At 12:13 AM 2/10/2012, Amit Tandon wrote:

 Dear Ethan

 It seems you are trying to build a query.But you are not getting field
 names. If you required field names then change the following line to

 foreach ( $allowed_fields AS $field = $_POST['field'])
 to
 foreach ( $allowed_fields AS $field)

 This would convert the variable field to value. In yoyr line the variable
 field is treated as array index
 
 regds
 amit

 The difference between fiction and reality? Fiction has to make sense.

 snip

 
  Advice and help please.
 
  Thanks.
 
 
  Ethan
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 Amit -

 Thanks.

 Tried it.  Still does not work.

 This is the query I get:


 select * from Intake3 where  1

 Ethan




Re: [PHP-DB] Problem w/query - again

2012-02-09 Thread Ethan Rosenberg

At 12:48 AM 2/10/2012, Amit Tandon wrote:

Dear Ethan

The line you are getting is because the 
$_POST[fieldname] is blank. So for the following line

 if ( ! empty( $_POST['field'] ) )
change it to
 if ( ! empty( $_POST[$field] ) )

Your line : Program is searxchinbg for variable name field
New line : The Program is seacging for varable 
stored in $field. Rember to use double quotes


And to verify the value echo $_POST[$field] before your if line i.e.
 if ( ! empty( $_POST[$field] ) )
   Â

regds
amit

The difference between fiction and reality? Fiction has to make sense.


On Fri, Feb 10, 2012 at 11:04 AM, Ethan 
Rosenberg mailto:eth...@earthlink.neteth...@earthlink.net wrote:

At 12:13 AM 2/10/2012, Amit Tandon wrote:
Dear Ethan

It seems you are trying to build a query.But you are not getting field
names. If you required field names then change the following line to

foreach ( $allowed_fields AS $field = $_POST['field'])
to
foreach ( $allowed_fields AS $field)

This would convert the variable field to value. In yoyr line the variable
field is treated as array index

regds
amit

The difference between fiction and reality? Fiction has to make sense.

snip


 Advice and help please.

 Thanks.


 Ethan
 PHP Database Mailing List (http://www.php.net/http://www.php.net/)
 To unsubscribe, visit: 
http://www.php.net/unsub.phphttp://www.php.net/unsub.php



Amit -

Thanks.

Tried your edit.  Still does not work.

Ethan






Amit -

Thanks.

Tried it. Â Still does not work.

This is the query I get:


select * from Intake3 where  1

Ethan





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem w/query - again - CORRECTION

2012-02-09 Thread Ethan Rosenberg

At 12:48 AM 2/10/2012, Amit Tandon wrote:

Dear Ethan

The line you are getting is because the 
$_POST[fieldname] is blank. So for the following line

 if ( ! empty( $_POST['field'] ) )
change it to
 if ( ! empty( $_POST[$field] ) )

Your line : Program is searxchinbg for variable name field
New line : The Program is seacging for varable 
stored in $field. Rember to use double quotes


And to verify the value echo $_POST[$field] before your if line i.e.
 if ( ! empty( $_POST[$field] ) )
   Â

regds
amit

The difference between fiction and reality? Fiction has to make sense.


On Fri, Feb 10, 2012 at 11:04 AM, Ethan 
Rosenberg mailto:eth...@earthlink.neteth...@earthlink.net wrote:

At 12:13 AM 2/10/2012, Amit Tandon wrote:
Dear Ethan
It seems you are trying to build a query.But you are not getting field
names. If you required field names then change the following line to
foreach ( $allowed_fields AS $field = $_POST['field'])
to
foreach ( $allowed_fields AS $field)
This would convert the variable field to value. In yoyr line the variable
field is treated as array index

regds
amit
The difference between fiction and reality? Fiction has to make sense.
snip

 Advice and help please.

 Thanks.


 Ethan
 PHP Database Mailing List (http://www.php.net/http://www.php.net/)
 To unsubscribe, visit: 
http://www.php.net/unsub.phphttp://www.php.net/unsub.php



Amit -

Thanks.

Tried your edit.  Still does not work.

Ethan






Amit -
Thanks.
Tried it. Â Still does not work.
This is the query I get:

select * from Intake3 where  1

Ethan

- Amit -

SORRY.

Works Perfectly

I had commented out my output routine!!

Ethan 




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with mysql and php

2011-11-29 Thread Tamara Temple
Jason Pruim li...@pruimphotography.com wrote:

 Given the following 2 queries:
 
 SELECT DISTINCT areacode FROM main WHERE state = '{$query_exploded[0]}';
 
 SELECT DISTINCT areacode FROM main;
 
 The second displays ALOT faster Like by minutes... the first one is what 
 I really want though Currently working with a dataset of 89 million 
 records, will be expanding that to many many more times that... To the tune 
 of possibly a couple billion records...
 
 Any ideas? :)

make state an index into the table.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with mysql and php

2011-11-29 Thread Dan Rowe
Try running this : http://mysqltuner.pl/mysqltuner.pl

If the server has been up for over 24hrs it gives a lot of good insight and
things to try tuning wise as a starting point. It'll uncover a lot of
common configuration issues or MySQL server level bottlenecks.

-Dan

(apologizes for the top post from the mobile)
On Nov 29, 2011 5:33 PM, Tamara Temple tamouse.li...@tamaratemple.com
wrote:

 Jason Pruim li...@pruimphotography.com wrote:

  Given the following 2 queries:
 
  SELECT DISTINCT areacode FROM main WHERE state =
 '{$query_exploded[0]}';
 
  SELECT DISTINCT areacode FROM main;
 
  The second displays ALOT faster Like by minutes... the first one is
 what I really want though Currently working with a dataset of 89
 million records, will be expanding that to many many more times that... To
 the tune of possibly a couple billion records...
 
  Any ideas? :)

 make state an index into the table.

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Problem with mysql and php

2011-11-29 Thread Jim Giner
Didn't the OP begin this very same subject a month ago? 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Problem with mysql and php

2011-11-29 Thread Amos Jean-Baptiste



 From: joker_mos...@hotmail.com
 To: phps...@gmail.com
 Date: Tue, 29 Nov 2011 23:07:13 -0500
 CC: phildob...@gmail.com; php-db@lists.php.net
 Subject: Re: [PHP-DB] Problem with mysql and php
 
 
 
 Le 2011-11-28 à 22:38, Bastien Koert phps...@gmail.com a écrit :
 
  On Mon, Nov 28, 2011 at 9:19 PM, Phil Dobbin phildob...@gmail.com  
  wrote:
  On 29/11/11 02:08, Jason Pruim pru...@gmail.com wrote:
 
  PostgreSQL?
 
  ;-)...
 
  In all seriousness... Would it help or change it in anyway? :)
 
  I am free to use what I want (I believe) on this project...
 
  It's well worth looking into. Postgres can handle far bigger db's  
  much
  quicker than MySQL but the downside is that it's a very steep  
  learning curve
  after coming from mysql.
 
  It's relatively easy to install  there are the drivers of course  
  for PHP
  but it'll take up a lot of your time to learn it to the extent of  
  being
  confident with it in my experience.
 
  Good luck,
 
  Cheers,
 
 Phil...
  --
  Nothing to see here... move along, move along
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
  jason,
 
  Assuming you have indexes on the data properly, have you looked into
  the mysql settings to ensure that you have the ones for large or xl
  datasets? There are a number of settings for buffers and sort spaces
  that can tune the database for performance
 
  http://www.mysqlperformanceblog.com/2006/06/09/why-mysql-could-be-slow-with-large-tables/
 
  Also, what kind of hard ware are you using? Does the db server have
  oodles (yeah that techie term) of RAM?
 
  Have you looked into creating views for each state? If the db has a
  fairly static dataset (only adding not much updating) then you create
  those views so that you are then doing a single select against a
  pre-processed dataset.
 
  More tuning can be done by sharding the data across different
  diskdrives to aid i/o.
 
  A great book on mysql performance is High Peformance MySQL
  http://www.amazon.com/dp/0596101716?tag=xaprb-20 which is chockful of
  great options and info about gaining performance.
 
 
 
  -- 
 
  Bastien
 
  Cat, the other other white meat
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 You can try nosql :)
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
You can try nosql :)
  

Re: [PHP-DB] Problem with mysql and php

2011-11-29 Thread Jason Pruim
Jim,

Similar yes... But this was specifically about replacing distinct with 
something since it was taking WAY to long... 

But it did evolve into a very similar conversation :)


Jason Pruim
pru...@gmail.com


On Nov 29, 2011, at 6:25 PM, Jim Giner wrote:

 Didn't the OP begin this very same subject a month ago? 
 
 
 
 -- 
 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] Problem with mysql and php

2011-11-28 Thread Phil Dobbin
On 29/11/11 01:38, Jason Pruim li...@pruimphotography.com wrote:

 Given the following 2 queries:
 
 SELECT DISTINCT areacode FROM main WHERE state = '{$query_exploded[0]}';
 
 SELECT DISTINCT areacode FROM main;
 
 The second displays ALOT faster Like by minutes... the first one is what I
 really want though Currently working with a dataset of 89 million records,
 will be expanding that to many many more times that... To the tune of possibly
 a couple billion records...
 
 Any ideas? :)

PostgreSQL?

;-)...

Cheers,

Phil...

-- 
Nothing to see here... move along, move along


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with mysql and php

2011-11-28 Thread Jason Pruim

Jason Pruim
pru...@gmail.com


On Nov 28, 2011, at 8:58 PM, Phil Dobbin wrote:

 On 29/11/11 01:38, Jason Pruim li...@pruimphotography.com wrote:
 
 Given the following 2 queries:
 
 SELECT DISTINCT areacode FROM main WHERE state = '{$query_exploded[0]}';
 
 SELECT DISTINCT areacode FROM main;
 
 The second displays ALOT faster Like by minutes... the first one is what 
 I
 really want though Currently working with a dataset of 89 million 
 records,
 will be expanding that to many many more times that... To the tune of 
 possibly
 a couple billion records...
 
 Any ideas? :)
 
 PostgreSQL?
 
 ;-)...

In all seriousness... Would it help or change it in anyway? :)

I am free to use what I want (I believe) on this project... 




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with mysql and php

2011-11-28 Thread Phil Dobbin
On 29/11/11 02:08, Jason Pruim pru...@gmail.com wrote:

 PostgreSQL?
 
 ;-)...
 
 In all seriousness... Would it help or change it in anyway? :)
 
 I am free to use what I want (I believe) on this project...

It's well worth looking into. Postgres can handle far bigger db's much
quicker than MySQL but the downside is that it's a very steep learning curve
after coming from mysql.

It's relatively easy to install  there are the drivers of course for PHP
but it'll take up a lot of your time to learn it to the extent of being
confident with it in my experience.

Good luck,

Cheers,

Phil...
-- 
Nothing to see here... move along, move along


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with mysql and php

2011-11-28 Thread Bastien Koert
On Mon, Nov 28, 2011 at 9:19 PM, Phil Dobbin phildob...@gmail.com wrote:
 On 29/11/11 02:08, Jason Pruim pru...@gmail.com wrote:

 PostgreSQL?

 ;-)...

 In all seriousness... Would it help or change it in anyway? :)

 I am free to use what I want (I believe) on this project...

 It's well worth looking into. Postgres can handle far bigger db's much
 quicker than MySQL but the downside is that it's a very steep learning curve
 after coming from mysql.

 It's relatively easy to install  there are the drivers of course for PHP
 but it'll take up a lot of your time to learn it to the extent of being
 confident with it in my experience.

 Good luck,

 Cheers,

    Phil...
 --
 Nothing to see here... move along, move along


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



jason,

Assuming you have indexes on the data properly, have you looked into
the mysql settings to ensure that you have the ones for large or xl
datasets? There are a number of settings for buffers and sort spaces
that can tune the database for performance

http://www.mysqlperformanceblog.com/2006/06/09/why-mysql-could-be-slow-with-large-tables/

Also, what kind of hard ware are you using? Does the db server have
oodles (yeah that techie term) of RAM?

Have you looked into creating views for each state? If the db has a
fairly static dataset (only adding not much updating) then you create
those views so that you are then doing a single select against a
pre-processed dataset.

More tuning can be done by sharding the data across different
diskdrives to aid i/o.

A great book on mysql performance is High Peformance MySQL
http://www.amazon.com/dp/0596101716?tag=xaprb-20 which is chockful of
great options and info about gaining performance.



-- 

Bastien

Cat, the other other white meat

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with mysql and php

2011-11-28 Thread Amos Jean-Baptiste



Le 2011-11-28 à 22:38, Bastien Koert phps...@gmail.com a écrit :

On Mon, Nov 28, 2011 at 9:19 PM, Phil Dobbin phildob...@gmail.com  
wrote:

On 29/11/11 02:08, Jason Pruim pru...@gmail.com wrote:


PostgreSQL?

;-)...


In all seriousness... Would it help or change it in anyway? :)

I am free to use what I want (I believe) on this project...


It's well worth looking into. Postgres can handle far bigger db's  
much
quicker than MySQL but the downside is that it's a very steep  
learning curve

after coming from mysql.

It's relatively easy to install  there are the drivers of course  
for PHP
but it'll take up a lot of your time to learn it to the extent of  
being

confident with it in my experience.

Good luck,

Cheers,

   Phil...
--
Nothing to see here... move along, move along


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




jason,

Assuming you have indexes on the data properly, have you looked into
the mysql settings to ensure that you have the ones for large or xl
datasets? There are a number of settings for buffers and sort spaces
that can tune the database for performance

http://www.mysqlperformanceblog.com/2006/06/09/why-mysql-could-be-slow-with-large-tables/

Also, what kind of hard ware are you using? Does the db server have
oodles (yeah that techie term) of RAM?

Have you looked into creating views for each state? If the db has a
fairly static dataset (only adding not much updating) then you create
those views so that you are then doing a single select against a
pre-processed dataset.

More tuning can be done by sharding the data across different
diskdrives to aid i/o.

A great book on mysql performance is High Peformance MySQL
http://www.amazon.com/dp/0596101716?tag=xaprb-20 which is chockful of
great options and info about gaining performance.



--

Bastien

Cat, the other other white meat

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




You can try nosql :)
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] problem in connecting to mysql from php

2011-06-14 Thread Niel Archer

 Hello everyone,
 
 I am in the process of learning php and I was trying to connect to a mysql
 database on my own computer(localhost). I have done the following as
 prerequisites:
 
 copied the dll files in system32
 removed the semicolon(;) from extension=php_mysqli.dll

You should NOT need to move the .dll at all. There is a
setting in the ini which tells PHP where to look for extensions and that
should have pointed to the original location. Hence, removing the
semicolon should be the only part necessary.

 In spite of doing the above when I try to run the following :
 
 ?php
 $db = new MySQLi('localhost', 'root', 'Password123', 'test');
 $sql = 'SELECT * FROM a123';
 $result = $db-query($sql);
 
 while($row = $result-fetch_object()) {
 echo 'div' . $row-name . '/div';
 }
 
 $db-close();
 ?
 
 I get the error: *Fatal error*: Class 'MySQLi' not found in *C:\Program
 Files\Apache Software Foundation\Apache2.2\htdocs\a.php* on line *2
 
 *Please guide me as to how can I get rid of this error?
 
 Regards,
 Kushal



--
Niel Archer
niel.archer (at) blueyonder.co.uk


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] problem in connecting to mysql from php

2011-06-14 Thread Abah Joseph
create a file with phpinfo() and make sure mysqli is listed in the loaded
modules

On Tue, Jun 14, 2011 at 12:07 PM, Niel Archer n...@chance.now wrote:


  Hello everyone,
 
  I am in the process of learning php and I was trying to connect to a
 mysql
  database on my own computer(localhost). I have done the following as
  prerequisites:
 
  copied the dll files in system32
  removed the semicolon(;) from extension=php_mysqli.dll

 You should NOT need to move the .dll at all. There is a
 setting in the ini which tells PHP where to look for extensions and that
 should have pointed to the original location. Hence, removing the
 semicolon should be the only part necessary.

  In spite of doing the above when I try to run the following :
 
  ?php
  $db = new MySQLi('localhost', 'root', 'Password123', 'test');
  $sql = 'SELECT * FROM a123';
  $result = $db-query($sql);
 
  while($row = $result-fetch_object()) {
  echo 'div' . $row-name . '/div';
  }
 
  $db-close();
  ?
 
  I get the error: *Fatal error*: Class 'MySQLi' not found in *C:\Program
  Files\Apache Software Foundation\Apache2.2\htdocs\a.php* on line *2
 
  *Please guide me as to how can I get rid of this error?
 
  Regards,
  Kushal



 --
 Niel Archer
 niel.archer (at) blueyonder.co.uk


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
*Share with free mind!*
Join I.T professionals on http://www.tuwana.com
For Web development and design http://abahjoseph.com
Follow me on Twitter http://twitter.com/freefazee
Mobile: *+2348066100671*


Re: [PHP-DB] problem in connecting to mysql from php

2011-06-13 Thread C0mf0rtably Numb
Okay. I tried using that too. If I run this:
?php
$link = mysql_connect('localhost', 'root',

'Password123');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?

I get the error: *Fatal error*: Call to undefined function mysql_connect()
in *C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\a.php* on
line *2

*I think there is something wrong with my configuration.

On Mon, Jun 13, 2011 at 6:00 PM, mrfroasty mrfroa...@gmail.com wrote:

 Your error message is about class not found.That means there is no class
 named MySQLi.Please use a textbook with online manual
 http://www.php.net/manual/en/ref.mysql.php

 On 06/13/2011 02:08 PM, C0mf0rtably Numb wrote:
  Hello everyone,
 
  I am in the process of learning php and I was trying to connect to a
 mysql
  database on my own computer(localhost). I have done the following as
  prerequisites:
 
  copied the dll files in system32
  removed the semicolon(;) from extension=php_mysqli.dll
 
  In spite of doing the above when I try to run the following :
 
  ?php
  $db = new MySQLi('localhost', 'root', 'Password123', 'test');
  $sql = 'SELECT * FROM a123';
  $result = $db-query($sql);
 
  while($row = $result-fetch_object()) {
  echo 'div' . $row-name . '/div';
  }
 
  $db-close();
  ?
 
  I get the error: *Fatal error*: Class 'MySQLi' not found in *C:\Program
  Files\Apache Software Foundation\Apache2.2\htdocs\a.php* on line *2
 
  *Please guide me as to how can I get rid of this error?
 
  Regards,
  Kushal
 


 --
 Extra details:
 OSS:Gentoo Linux
 profile:x86
 Hardware:msi geforce 8600GT asus p5k-se
 location:/home/muhsin
 language(s):C/C++,PHP,SQL,HTML
 Typo:40WPM
 url:http://www.mzalendo.net
 url:http://www.zanbytes.com






Re: [PHP-DB] problem in connecting to mysql from php

2011-06-13 Thread Richard Quadling
On 13 June 2011 13:26, C0mf0rtably Numb 08.kus...@gmail.com wrote:
 Okay. I tried using that too. If I run this:
 ?php
 $link = mysql_connect('localhost', 'root',

 'Password123');
 if (!$link) {
    die('Could not connect: ' . mysql_error());
 }
 echo 'Connected successfully';
 mysql_close($link);
 ?

 I get the error: *Fatal error*: Call to undefined function mysql_connect()
 in *C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\a.php* on
 line *2

 *I think there is something wrong with my configuration.

 On Mon, Jun 13, 2011 at 6:00 PM, mrfroasty mrfroa...@gmail.com wrote:

 Your error message is about class not found.That means there is no class
 named MySQLi.Please use a textbook with online manual
 http://www.php.net/manual/en/ref.mysql.php

 On 06/13/2011 02:08 PM, C0mf0rtably Numb wrote:
  Hello everyone,
 
  I am in the process of learning php and I was trying to connect to a
 mysql
  database on my own computer(localhost). I have done the following as
  prerequisites:
 
  copied the dll files in system32
  removed the semicolon(;) from extension=php_mysqli.dll
 
  In spite of doing the above when I try to run the following :
 
  ?php
  $db = new MySQLi('localhost', 'root', 'Password123', 'test');
  $sql = 'SELECT * FROM a123';
  $result = $db-query($sql);
 
  while($row = $result-fetch_object()) {
      echo 'div' . $row-name . '/div';
  }
 
  $db-close();
  ?
 
  I get the error: *Fatal error*: Class 'MySQLi' not found in *C:\Program
  Files\Apache Software Foundation\Apache2.2\htdocs\a.php* on line *2
 
  *Please guide me as to how can I get rid of this error?
 
  Regards,
  Kushal
 


 --
 Extra details:
 OSS:Gentoo Linux
 profile:x86
 Hardware:msi geforce 8600GT asus p5k-se
 location:/home/muhsin
 language(s):C/C++,PHP,SQL,HTML
 Typo:40WPM
 url:http://www.mzalendo.net
 url:http://www.zanbytes.com






Copying the files to windows\system ... what files? Where were you
told to do this?

Normally the extension files you need for PHP are in C:\PHP5\ext (or PHPx).

I've never copied a single file into my Windows folder for PHP.



-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with pg_prepare - PostgresSQL

2010-04-26 Thread Chris

Giancarlo Boaron wrote:

Hi all.

I'm receiving the following message when I try to use
pg_prepare() function:

Call to undefined function pg_prepare().

My application works very well with others pg_*
commands...


What version of php do you have?

This came in with 5.1.0 according to the manual.

--
Postgresql  php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with PDO Mysql and FETCH::ASSOC

2009-03-20 Thread Thodoris



Hello,

I am using the following code to perform queries on a MySQL database:

$dbh = new 
PDO($GLOBALS['database'],$GLOBALS['username'],$GLOBALS['password']);

$dbh-setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$dbh-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$query = $dbh-prepare(SELECT * FROM log);
$query-execute();
$results = $query-fetchALL(PDO::FETCH_ASSOC);
$dbh = null;

If I perform this query in MySQL, I get:

mysql select * from log;
+-++---+--+++ 

| type| date   | client_id | model_id | 
request| message|
+-++---+--+++ 

| message | 1.2375e+09 | domain.18052  |  | 
client_start   | started client |


However, if I perform this query with the PHP code above, I get:

Array ( [type] = error [date] = 1.2375e+09 [log] = [distributed] = 
client_start [def] = started client) )


which is clearly wrong. 'distributed' is actually the name of the 
database, so I don't really know what it is doing as a key in the 
above result.


If I use PDO::FETCH_BOTH instead of PDO::FETCH_ASSOC, I get

Array ( [type] = message [0] = message [date] = 1.2375e+09 [1] = 
1.2375e+09 [log] = [2] = domain.18052 [3] = [distributed] = 
client_start [4] = client_start [def] = started client [5] = 
started client )


which *does* contain the correct values with the numerical keys. 
Before using MySQL, I was using SQLite, and this problem did not occur.


The description of the table is:

mysql describe log;
+---+--+--+-+-+---+
| Field | Type | Null | Key | Default | Extra |
+---+--+--+-+-+---+
| type  | char(10) | YES  | | NULL|   |
| date  | float| YES  | | NULL|   |
| client_id | char(50) | YES  | | NULL|   |
| model_id  | char(50) | YES  | | NULL|   |
| request   | char(20) | YES  | | NULL|   |
| message   | char(50) | YES  | | NULL|   |
+---+--+--+-+-+---+
6 rows in set (0.00 sec)

Does anyone have any ideas as to what I might be doing wrong?

Thanks for any help!

Thomas



First of all check if you are actually connecting to the same database 
both times.


Start with printing $GLOBALS['database'] and see if it connects where 
you really want.


You mentioned a field def while printing the query's output which 
obviously is not included in the table's description. Have you changed 
the schema in the meantime?


--
Thodoris


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with PDO Mysql and FETCH::ASSOC

2009-03-20 Thread Thomas Robitaille

Does anyone have any ideas as to what I might be doing wrong?

Thanks for any help!

Thomas



First of all check if you are actually connecting to the same  
database both times.


Start with printing $GLOBALS['database'] and see if it connects  
where you really want.


You mentioned a field def while printing the query's output which  
obviously is not included in the table's description. Have you  
changed the schema in the meantime?


Thanks for your suggestions.

I've managed to fix the issue by switching to a 32-bit installation of  
MySQL and Apache. The problem appeared to be due to the 64-bit  
versions somehow.


Thomas

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with PDO Mysql and FETCH::ASSOC

2009-03-20 Thread Christopher Jones



Thomas Robitaille wrote:
I've managed to fix the issue by switching to a 32-bit installation of 
MySQL and Apache. The problem appeared to be due to the 64-bit versions 
somehow.


If you think there's a bug (and you tested the latest version of PHP),
please report the problem at http://bugs.php.net/

Chris

--
Email: christopher.jo...@oracle.com  Tel: +1 650 506 8630
Twitter:  http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/UGPOM

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with PDO exceptions

2009-03-07 Thread Kesavan Rengarajan
I think it is a bug. I have seen this happening at work (PDO not  
throwing exception when executing a query on a non existing table)


News on iPhone: http://trk7.com/mob

On 08/03/2009, at 6:44 AM, Daniel Carrera  
daniel.carr...@theingots.org wrote:



Hello,

I have MySQL 5.1 and PHP 5.2. For some reason PDO is not throwing  
exceptions when I give it a broken SQL query. For example:


try {
   $stmt = $db-prepare(SELECT * FROM foobar WHERE 1);
} catch(PDOException $e) {
   error($e-getMessage());
}

In this example there is no table called 'foobar', so this should  
give an error. Yet, it doesn't.



Any ideas why that would happen? Possible causes I can think of:
1) PDO decide to emulate prepared statements.
2) PDO has some sort of errors off setting.
3) My try-catch statement is wrong.


I doubt it's (1) because I have MySQL 5.1 and PDO is only supposed  
to emulate prepared statements for MySQL versions prior to 4.1. And  
phpinfo says that I'm running pdo_mysql version 5.1.30.


Btw, $db-exec() and $db-query() also fail to produce an error when  
I give them a broken query. That's another reason why I think that  
the problem is elsewhere.


Any ideas?

Thank you very much for your help.

Best,
Daniel.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with PDO exceptions

2009-03-07 Thread Zoltan Ormandi

Hi,

Did you set the value of the |PDO::ATTR_ERRMODE| attribute to 
|PDO::ERRMODE_EXCEPTION|?


Btw, I don't think ||prepare would throw an exception even for a 
malformed query, but ||execute definitely should.


Regards,
Z



Re: [PHP-DB] Problem with PDO exceptions

2009-03-07 Thread kesavan trichy rengarajan
yup, I have set the  |PDO::ATTR_ERRMODE| attribute to
|PDO::ERRMODE_EXCEPTION|
and I am still not getting an exception!

My Code is something like this:
$query = $db-prepare($sql);
$query-execute($bind);
$row = $query-fetch(PDO::FETCH_ASSOC);

wher $db is the PDO obj and $sql is the sql query and $bind is the bound
parameter

On Sun, Mar 8, 2009 at 5:35 PM, Zoltan Ormandi ormandi.zol...@webfunteam.hu
wrote:
 Hi,

 Did you set the value of the |PDO::ATTR_ERRMODE| attribute to
 |PDO::ERRMODE_EXCEPTION|?

 Btw, I don't think ||prepare would throw an exception even for a malformed
 query, but ||execute definitely should.

 Regards,
 Z




Re: [PHP-DB] Problem with PDO exceptions

2009-03-07 Thread kesavan trichy rengarajan
I am sorry, setting |PDO::ATTR_ERRMODE| attribute to
|PDO::ERRMODE_EXCEPTION|  *does* throw an Exception when the table cannot be
found. Stupid me; I was trying to catch Exception rather than a
PDOException.

On Sun, Mar 8, 2009 at 6:03 PM, kesavan trichy rengarajan k...@trk7.comwrote:

 yup, I have set the  |PDO::ATTR_ERRMODE| attribute to
 |PDO::ERRMODE_EXCEPTION|
 and I am still not getting an exception!

 My Code is something like this:
 $query = $db-prepare($sql);
 $query-execute($bind);
 $row = $query-fetch(PDO::FETCH_ASSOC);

 wher $db is the PDO obj and $sql is the sql query and $bind is the bound
 parameter


 On Sun, Mar 8, 2009 at 5:35 PM, Zoltan Ormandi 
 ormandi.zol...@webfunteam.hu wrote:
  Hi,
 
  Did you set the value of the |PDO::ATTR_ERRMODE| attribute to
  |PDO::ERRMODE_EXCEPTION|?
 
  Btw, I don't think ||prepare would throw an exception even for a
 malformed
  query, but ||execute definitely should.
 
  Regards,
  Z
 
 




Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Evert Lammerts
 $list-render( $db, $start, COUNT );

Send the code of this function and tell me the value of COUNT.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Evert Lammerts
Can you send over the function ProfileList::render? And you should
make sure that whenever the render() function of one of ProfileList's
subclasses is called, the value of $count is 30... It seems the most
likely source of your problem to me. To check the value of $count you
can do and echo $count; or var_dump($count); in the
ProfileList::render() function.

Make sure to always include the list in your replies. This way people
can reuse solutions from the archives.

Evert

On Sun, Aug 31, 2008 at 11:21 AM, Gav [EMAIL PROTECTED] wrote:
 Hi All,

 I moved a site across from one server to another, and now there is one thing
 no longer working properly that worked fine on the other. It may turn out to
 be a PHP4 to PHP5 problem, dont know as I cant access now what the other
 server had.

 Certain pages on the website were able to render a list of 30 items, since
 the move it now only renders the first item only.

 I'm sure you want some code, but before I give that can we determine if I'm
 on the right list - the function does pull items from a database so it is
 sort of related, though I'm not sure it is  a db problem.

 In the php output page we have

 $list-render( $db, $start, COUNT );

 Not sure if that is a clue or not, anyway let me know if you me to post all
 the related classes and functions.

 Cheers

 Gav...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Gav
On Sun, Aug 31, 2008 at 8:09 PM, Evert Lammerts [EMAIL PROTECTED]wrote:

 Can you send over the function ProfileList::render? And you should
 make sure that whenever the render() function of one of ProfileList's
 subclasses is called, the value of $count is 30... It seems the most
 likely source of your problem to me. To check the value of $count you
 can do and echo $count; or var_dump($count); in the
 ProfileList::render() function.


Hmm, I'm no guru but I thought it may have been some incompatibility I'd
need to change so it worked on a newer PHP than was on the old server. This
code has remained unchanged and working perfect for at least 3 years that I
know of. I never changed a single byte of it when moving servers except the
new db connection parameters.

COUNT and $count look like they have different roles to me, COUNT is the
amount of designers to be listed per page, $count is the number of designers
to be listed altogether, so 150 designers would give me 5 pages of 30
designers.

Anyway, I did not write the code and I don't pretend to understand all of
it, so I'm including most of the file here so you can pick what you need :)

Note that that RegionSelector() and SpecSelector() work fine.
And that AllProfiles() , ProfilesByRegion() and ProfilesBySpec() are the
ones that now do not work any more - these three that do not work are part
of the ProfileList Class, so I thought it would be something in this class
as they are all common to it. I had also read the the re-use of $this had
changed in PHP5.2+ but I can not work out if this (npi) would apply in this
case.




 Make sure to always include the list in your replies. This way people
 can reuse solutions from the archives.


Sorry about that, most lists I'm subscribed to have reply-all set
automatically.

Here the code :-

// Number of designers to display per page on the list.php page.
define( COUNT, 30 );

// Makes DB present for ALL client scripts / pages.
// This is a global scope variable.  To minimize memory
// usage the $db variable is passed by reference, and not
// copyied for each function or object.
$db = new db( DBUSER, DBPASS, DBNAME );

// The RegionMultiSelector class creates the form conponent
// responsible for the input of the designers regions.
// Appears on the Get Listed page.
class RegionMultiSelector
{
var $html;
function RegionMultiSelector( $db )
{
// Create query to get all regions in regions database table.
$q = SELECT id, name FROM regions;
// Run the query on the database.
$db-runquery( $q );
// Start collecting HTML.
$h = select .BC. name=\regions[]\ multiple=\multiple\
size=\7\\n;
// For each row in the results print the region
while( $row = $db-getrow() )
{
$h.=\t\toption value=\$row-name\$row-name/option\n;
}
$h.=/select\n;
$this-html = $h;
}
function render()
{
print $this-html;
}
}

// The RegionSelector is a drop down list for selecting singular
// regions.  For purposes of filtering lists etc.
class RegionSelector extends DropNav
{
function RegionSelector( $db )
{
$q = SELECT id, name FROM regions;
$db-runquery( $q );
$this-addItem( , Please select... );
while( $row = $db-getrow() )
{
$this-addItem( $PHP_SELF.?region=.$row-id, $row-name );
}
}
function renderBody()
{
print h5 .BBC.Select developers based on region./h5;
print div .BC.;
DropNav::renderBody();
print /div;
}
}

// The SpecSelector is a drop down list for selecting singular
// specialities.  For purposes of filtering lists etc.
class SpecSelector extends DropNav
{
function SpecSelector( $db )
{
$q = SELECT id, name FROM specialities;
$db-runquery( $q );
$this-addItem( , Please select... );

while( $row = $db-getrow() )
{
$this-addItem( $PHP_SELF.?spec=.$row-id, $row-name );
}
}
function renderBody()
{
print h5 .BBC.Select developers based on Speciality./h5;
print div .BC.;
DropNav::renderBody();
print /div;
}
}

// The Profile List is the base class for all Profile lists.
// Subclasses must at least define the query
class ProfileList
{
var $query;
var $des;
var $lastcount;
// Render the Brief HomePage list
// $db is a reference to the database object created for the page.
function render( $db, $start=0, $count=1024 )
{
if ( ( $this-query== ) or ( ! $this-query ))
print pHey, you! You forgot to define a query in my subclass:
Yours iProfileList/i/p;
$q = $this-query;
$q = $q. LIMIT $start, $count ;
// print h1Query: $q/h1;
$db-runquery( $q );
$this-lastcount = $db-numrows;
if ( $db-numrows  0 )
{
$this-setView();

// Loop through each designer in the 

Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Evert Lammerts
The code you've sent seems to be fine, and if I check your website it
does everything it should do in terms of filtering - if I select
Tayside as a region I get a development company with the region set to
Tayside. It seems to me that this means the problem is not in one of
the subclasses of ProfileList, so not a compatibility issue on that
level ($this-query works fine).

 while( $row = $db-getrow() )
seems to stop after one loop. This is either because there are no more
results - the query is limited to 1, so $count=1 - or because
$db-getRow generates an error.

 COUNT and $count look like they have different roles to me, COUNT is the 
 amount of
 designers to be listed per page, $count is the number of designers to be 
 listed altogether,
 so 150 designers would give me 5 pages of 30 designers.

In ProfileList::render the query is appended with LIMIT $start,
$count, and the results of the query all seem to be rendered. This
probably means that $count and COUNT should have the same value - 30 -
and that the render function is initially called with the global
variable COUNT as parameter.

To check what goes wrong you first need to set error_reporting to
E_ALL in php.ini and restart your webserver, or add the line
error_reporting(E_ALL); at the beginning of you code. After that you
need to print the query from ProfileList::render. Can you adjust the
function and add var_dump($q); after the line $q = $q. LIMIT $start,
$count ;?

Evert

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Evert Lammerts
You don't need to print the query anymore - I already did that. You
need to change your code because right now it is open for SQL
injection attacks: I added some SQL to the url and generated an SQL
error (http://www.iwdp.co.uk/list.php?region=1start=30,2). When you
retrieve start, e.g. $_GET['start'], do a check to make sure the value
is an integer.

The good news is that the query looks fine:
SELECT d.id AS id FROM designers d, designer_regions dr WHERE
dr.region_id=1 AND dr.designer_id=d.id AND d.view=1 ORDER BY d.id ASC
LIMIT 0, 30;

Can you run this query directly on the database and see what the result is?

Also check if you get an error after setting error_reporting to E_ALL.

On Sun, Aug 31, 2008 at 1:16 PM, Evert Lammerts
[EMAIL PROTECTED] wrote:
 The code you've sent seems to be fine, and if I check your website it
 does everything it should do in terms of filtering - if I select
 Tayside as a region I get a development company with the region set to
 Tayside. It seems to me that this means the problem is not in one of
 the subclasses of ProfileList, so not a compatibility issue on that
 level ($this-query works fine).

 while( $row = $db-getrow() )
 seems to stop after one loop. This is either because there are no more
 results - the query is limited to 1, so $count=1 - or because
 $db-getRow generates an error.

 COUNT and $count look like they have different roles to me, COUNT is the 
 amount of
 designers to be listed per page, $count is the number of designers to be 
 listed altogether,
 so 150 designers would give me 5 pages of 30 designers.

 In ProfileList::render the query is appended with LIMIT $start,
 $count, and the results of the query all seem to be rendered. This
 probably means that $count and COUNT should have the same value - 30 -
 and that the render function is initially called with the global
 variable COUNT as parameter.

 To check what goes wrong you first need to set error_reporting to
 E_ALL in php.ini and restart your webserver, or add the line
 error_reporting(E_ALL); at the beginning of you code. After that you
 need to print the query from ProfileList::render. Can you adjust the
 function and add var_dump($q); after the line $q = $q. LIMIT $start,
 $count ;?

 Evert


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Gav
On Sun, Aug 31, 2008 at 9:27 PM, Evert Lammerts [EMAIL PROTECTED]wrote:

 You don't need to print the query anymore - I already did that. You
 need to change your code because right now it is open for SQL
 injection attacks: I added some SQL to the url and generated an SQL
 error (http://www.iwdp.co.uk/list.php?region=1start=30,2). When you
 retrieve start, e.g. $_GET['start'], do a check to make sure the value
 is an integer.

 The good news is that the query looks fine:
 SELECT d.id AS id FROM designers d, designer_regions dr WHERE
 dr.region_id=1 AND dr.designer_id=d.id AND d.view=1 ORDER BY d.id ASC
 LIMIT 0, 30;

 Can you run this query directly on the database and see what the result is?


*SQL query:* SELECT d.id AS id FROM designers d, designer_regions dr WHERE
dr.region_id=1 AND dr.designer_id=d.id AND d.view=1 ORDER BY d.id ASC LIMIT
0, 30;
*Rows:* 30  id  2  4  5  11  43  63  86  99  117  119  158  165  233  272
290  305  328  335  363  396  414  425  430  436  459  489  490  518  536
554



 Also check if you get an error after setting error_reporting to E_ALL.


 Yup, I left it up there at http://www.iwdp.co.uk/list.php

The PHP_SELF being referred to as undefined is in the included file
generic.php  :-

class DropNav
{
var $items =array();
var $head;
var $body;

// CONSTRUCTOR
function DropNav()
{
}

// PUBLIC
function renderHead()
{
$this-buildHTML();
print $this-head;
}

// PUBLIC
function renderBody()
{
$this-buildHTML();
print $this-body;
}

// PUBLIC
function addItem( $url, $desc )
{
$this-items[] = array( url = $url, desc=$desc );
}

// PRIVATE
function buildHTML()
{
global $PHP_SELF;
$this-body = form action=\$PHP_SELF\\n;
$this-body .= \tpselect name=\newLocation\
onchange=\jumpPage(this.form.newLocation)\\n;
foreach ( $this-items as $item )
{
$this-body .=\t\toption value=\.$item[url].\;
$this-body .= $item[desc];
$this-body .=/option\n;
}

$this-body .= \t/select/p\n/form\n;

$this-head = script type=\text/javascript\\n;
$this-head .= !--
function jumpPage( newLoc )
{
newPage = newLoc.options[newLoc.selectedIndex].value;
if ( newPage != \\ )
{
window.location.href=newPage;
}
} // --\n;
$this-head .= /script\n\n;
}
}

Thanks

Gav...



 On Sun, Aug 31, 2008 at 1:16 PM, Evert Lammerts
 [EMAIL PROTECTED] wrote:
  The code you've sent seems to be fine, and if I check your website it
  does everything it should do in terms of filtering - if I select
  Tayside as a region I get a development company with the region set to
  Tayside. It seems to me that this means the problem is not in one of
  the subclasses of ProfileList, so not a compatibility issue on that
  level ($this-query works fine).
 
  while( $row = $db-getrow() )
  seems to stop after one loop. This is either because there are no more
  results - the query is limited to 1, so $count=1 - or because
  $db-getRow generates an error.
 
  COUNT and $count look like they have different roles to me, COUNT is the
 amount of
  designers to be listed per page, $count is the number of designers to be
 listed altogether,
  so 150 designers would give me 5 pages of 30 designers.
 
  In ProfileList::render the query is appended with LIMIT $start,
  $count, and the results of the query all seem to be rendered. This
  probably means that $count and COUNT should have the same value - 30 -
  and that the render function is initially called with the global
  variable COUNT as parameter.
 
  To check what goes wrong you first need to set error_reporting to
  E_ALL in php.ini and restart your webserver, or add the line
  error_reporting(E_ALL); at the beginning of you code. After that you
  need to print the query from ProfileList::render. Can you adjust the
  function and add var_dump($q); after the line $q = $q. LIMIT $start,
  $count ;?
 
  Evert
 




-- 
Gav...

[LinkedIn : http://www.linkedin.com/in/ipv6guru]

www.16degrees.com.au | www.iwdp.co.uk | www.minitutorials.com

(Sponsorship slots available on above three sites!)


Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Gav
Just copying the error messages here so I can revert my changes on the site.

*Notice*: Undefined variable: PHP_SELF in *
/var/virtual/web/w0019/html/profilemanager.php* on line *75*

*Notice*: Undefined variable: PHP_SELF in *
/var/virtual/web/w0019/html/profilemanager.php* on line *76

x 22 more times. Then I get :-

**Notice*: Use of undefined constant url - assumed 'url' in *
/var/virtual/web/w0019/html/generic.php* on line *289*

*Notice*: Use of undefined constant desc - assumed 'desc' in *
/var/virtual/web/w0019/html/generic.php* on line *290

x many more times.

Then the result of the var_dump($q);

*string(66) SELECT id FROM designers WHERE view=1 ORDER BY id ASC LIMIT 0,
30 

HTH

I am still looking at it myself, but going round in circles, so thanks for
your help.

Gav...

On Sun, Aug 31, 2008 at 10:15 PM, Gav [EMAIL PROTECTED] wrote:



 On Sun, Aug 31, 2008 at 9:27 PM, Evert Lammerts [EMAIL PROTECTED]wrote:

 You don't need to print the query anymore - I already did that. You
 need to change your code because right now it is open for SQL
 injection attacks: I added some SQL to the url and generated an SQL
 error (http://www.iwdp.co.uk/list.php?region=1start=30,2). When you
 retrieve start, e.g. $_GET['start'], do a check to make sure the value
 is an integer.

 The good news is that the query looks fine:
 SELECT d.id AS id FROM designers d, designer_regions dr WHERE
 dr.region_id=1 AND dr.designer_id=d.id AND d.view=1 ORDER BY d.id ASC
 LIMIT 0, 30;

 Can you run this query directly on the database and see what the result
 is?


 *SQL query:* SELECT d.id AS id FROM designers d, designer_regions dr WHERE
 dr.region_id=1 AND dr.designer_id=d.id AND d.view=1 ORDER BY d.id ASC
 LIMIT 0, 30;
 *Rows:* 30  id  2  4  5  11  43  63  86  99  117  119  158  165  233  272
 290  305  328  335  363  396  414  425  430  436  459  489  490  518  536
 554



 Also check if you get an error after setting error_reporting to E_ALL.


  Yup, I left it up there at http://www.iwdp.co.uk/list.php

 The PHP_SELF being referred to as undefined is in the included file
 generic.php  :-

 class DropNav
 {
 var $items =array();
 var $head;
 var $body;

 // CONSTRUCTOR
 function DropNav()
 {
 }

 // PUBLIC
 function renderHead()
 {
 $this-buildHTML();
 print $this-head;
 }

 // PUBLIC
 function renderBody()
 {
 $this-buildHTML();
 print $this-body;
 }

 // PUBLIC
 function addItem( $url, $desc )
 {
 $this-items[] = array( url = $url, desc=$desc );
 }

 // PRIVATE
 function buildHTML()
 {
 global $PHP_SELF;
 $this-body = form action=\$PHP_SELF\\n;
 $this-body .= \tpselect name=\newLocation\
 onchange=\jumpPage(this.form.newLocation)\\n;
 foreach ( $this-items as $item )
 {
 $this-body .=\t\toption value=\.$item[url].\;
 $this-body .= $item[desc];
 $this-body .=/option\n;
 }

 $this-body .= \t/select/p\n/form\n;

 $this-head = script type=\text/javascript\\n;
 $this-head .= !--
 function jumpPage( newLoc )
 {
 newPage = newLoc.options[newLoc.selectedIndex].value;
 if ( newPage != \\ )
 {
 window.location.href=newPage;
 }
 } // --\n;
 $this-head .= /script\n\n;
 }
 }

 Thanks

 Gav...



 On Sun, Aug 31, 2008 at 1:16 PM, Evert Lammerts
 [EMAIL PROTECTED] wrote:
  The code you've sent seems to be fine, and if I check your website it
  does everything it should do in terms of filtering - if I select
  Tayside as a region I get a development company with the region set to
  Tayside. It seems to me that this means the problem is not in one of
  the subclasses of ProfileList, so not a compatibility issue on that
  level ($this-query works fine).
 
  while( $row = $db-getrow() )
  seems to stop after one loop. This is either because there are no more
  results - the query is limited to 1, so $count=1 - or because
  $db-getRow generates an error.
 
  COUNT and $count look like they have different roles to me, COUNT is
 the amount of
  designers to be listed per page, $count is the number of designers to
 be listed altogether,
  so 150 designers would give me 5 pages of 30 designers.
 
  In ProfileList::render the query is appended with LIMIT $start,
  $count, and the results of the query all seem to be rendered. This
  probably means that $count and COUNT should have the same value - 30 -
  and that the render function is initially called with the global
  variable COUNT as parameter.
 
  To check what goes wrong you first need to set error_reporting to
  E_ALL in php.ini and restart your webserver, or add the line
  error_reporting(E_ALL); at the beginning of you code. After that you
  need to print the query from ProfileList::render. Can you adjust the
  function and add var_dump($q); after the line 

Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Evert Lammerts
In PHP5 register_globals defaults to off. You can either switch it
back on through your php.ini and restart your webserver, or change all
PHP_SELF references to $_SERVER['PHP_SELF']. See if that fixes your
problem.

I hope you understood the SQL injection problem I pointed out. Anybody
can drop your database, so do fix it!

On 8/31/08, Gav [EMAIL PROTECTED] wrote:
 On Sun, Aug 31, 2008 at 9:27 PM, Evert Lammerts
 [EMAIL PROTECTED]wrote:

 You don't need to print the query anymore - I already did that. You
 need to change your code because right now it is open for SQL
 injection attacks: I added some SQL to the url and generated an SQL
 error (http://www.iwdp.co.uk/list.php?region=1start=30,2). When you
 retrieve start, e.g. $_GET['start'], do a check to make sure the value
 is an integer.

 The good news is that the query looks fine:
 SELECT d.id AS id FROM designers d, designer_regions dr WHERE
 dr.region_id=1 AND dr.designer_id=d.id AND d.view=1 ORDER BY d.id ASC
 LIMIT 0, 30;

 Can you run this query directly on the database and see what the result
 is?


 *SQL query:* SELECT d.id AS id FROM designers d, designer_regions dr WHERE
 dr.region_id=1 AND dr.designer_id=d.id AND d.view=1 ORDER BY d.id ASC LIMIT
 0, 30;
 *Rows:* 30  id  2  4  5  11  43  63  86  99  117  119  158  165  233  272
 290  305  328  335  363  396  414  425  430  436  459  489  490  518  536
 554



 Also check if you get an error after setting error_reporting to E_ALL.


  Yup, I left it up there at http://www.iwdp.co.uk/list.php

 The PHP_SELF being referred to as undefined is in the included file
 generic.php  :-

 class DropNav
 {
 var $items =array();
 var $head;
 var $body;

 // CONSTRUCTOR
 function DropNav()
 {
 }

 // PUBLIC
 function renderHead()
 {
 $this-buildHTML();
 print $this-head;
 }

 // PUBLIC
 function renderBody()
 {
 $this-buildHTML();
 print $this-body;
 }

 // PUBLIC
 function addItem( $url, $desc )
 {
 $this-items[] = array( url = $url, desc=$desc );
 }

 // PRIVATE
 function buildHTML()
 {
 global $PHP_SELF;
 $this-body = form action=\$PHP_SELF\\n;
 $this-body .= \tpselect name=\newLocation\
 onchange=\jumpPage(this.form.newLocation)\\n;
 foreach ( $this-items as $item )
 {
 $this-body .=\t\toption value=\.$item[url].\;
 $this-body .= $item[desc];
 $this-body .=/option\n;
 }

 $this-body .= \t/select/p\n/form\n;

 $this-head = script type=\text/javascript\\n;
 $this-head .= !--
 function jumpPage( newLoc )
 {
 newPage = newLoc.options[newLoc.selectedIndex].value;
 if ( newPage != \\ )
 {
 window.location.href=newPage;
 }
 } // --\n;
 $this-head .= /script\n\n;
 }
 }

 Thanks

 Gav...



 On Sun, Aug 31, 2008 at 1:16 PM, Evert Lammerts
 [EMAIL PROTECTED] wrote:
  The code you've sent seems to be fine, and if I check your website it
  does everything it should do in terms of filtering - if I select
  Tayside as a region I get a development company with the region set to
  Tayside. It seems to me that this means the problem is not in one of
  the subclasses of ProfileList, so not a compatibility issue on that
  level ($this-query works fine).
 
  while( $row = $db-getrow() )
  seems to stop after one loop. This is either because there are no more
  results - the query is limited to 1, so $count=1 - or because
  $db-getRow generates an error.
 
  COUNT and $count look like they have different roles to me, COUNT is
  the
 amount of
  designers to be listed per page, $count is the number of designers to
  be
 listed altogether,
  so 150 designers would give me 5 pages of 30 designers.
 
  In ProfileList::render the query is appended with LIMIT $start,
  $count, and the results of the query all seem to be rendered. This
  probably means that $count and COUNT should have the same value - 30 -
  and that the render function is initially called with the global
  variable COUNT as parameter.
 
  To check what goes wrong you first need to set error_reporting to
  E_ALL in php.ini and restart your webserver, or add the line
  error_reporting(E_ALL); at the beginning of you code. After that you
  need to print the query from ProfileList::render. Can you adjust the
  function and add var_dump($q); after the line $q = $q. LIMIT $start,
  $count ;?
 
  Evert
 




 --
 Gav...

 [LinkedIn : http://www.linkedin.com/in/ipv6guru]

 www.16degrees.com.au | www.iwdp.co.uk | www.minitutorials.com

 (Sponsorship slots available on above three sites!)


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Gav
On Sun, Aug 31, 2008 at 10:36 PM, Evert Lammerts
[EMAIL PROTECTED]wrote:

 In PHP5 register_globals defaults to off. You can either switch it
 back on through your php.ini and restart your webserver, or change all
 PHP_SELF references to $_SERVER['PHP_SELF']. See if that fixes your
 problem.


I already have

php_admin_flag register_globals 1

in the VirtualHost config for that site, so it should be on already.
So I guess I'll try changing the references anyway jic.




 I hope you understood the SQL injection problem I pointed out. Anybody
 can drop your database, so do fix it!


Will do, thanks.

Gav...




 On 8/31/08, Gav [EMAIL PROTECTED] wrote:
  On Sun, Aug 31, 2008 at 9:27 PM, Evert Lammerts
  [EMAIL PROTECTED]wrote:
 
  You don't need to print the query anymore - I already did that. You
  need to change your code because right now it is open for SQL
  injection attacks: I added some SQL to the url and generated an SQL
  error (http://www.iwdp.co.uk/list.php?region=1start=30,2). When you
  retrieve start, e.g. $_GET['start'], do a check to make sure the value
  is an integer.
 
  The good news is that the query looks fine:
  SELECT d.id AS id FROM designers d, designer_regions dr WHERE
  dr.region_id=1 AND dr.designer_id=d.id AND d.view=1 ORDER BY d.id ASC
  LIMIT 0, 30;
 
  Can you run this query directly on the database and see what the result
  is?
 
 
  *SQL query:* SELECT d.id AS id FROM designers d, designer_regions dr
 WHERE
  dr.region_id=1 AND dr.designer_id=d.id AND d.view=1 ORDER BY d.id ASC
 LIMIT
  0, 30;
  *Rows:* 30  id  2  4  5  11  43  63  86  99  117  119  158  165  233  272
  290  305  328  335  363  396  414  425  430  436  459  489  490  518  536
  554
 
 
 
  Also check if you get an error after setting error_reporting to E_ALL.
 
 
   Yup, I left it up there at http://www.iwdp.co.uk/list.php
 
  The PHP_SELF being referred to as undefined is in the included file
  generic.php  :-
 
  class DropNav
  {
  var $items =array();
  var $head;
  var $body;
 
  // CONSTRUCTOR
  function DropNav()
  {
  }
 
  // PUBLIC
  function renderHead()
  {
  $this-buildHTML();
  print $this-head;
  }
 
  // PUBLIC
  function renderBody()
  {
  $this-buildHTML();
  print $this-body;
  }
 
  // PUBLIC
  function addItem( $url, $desc )
  {
  $this-items[] = array( url = $url, desc=$desc );
  }
 
  // PRIVATE
  function buildHTML()
  {
  global $PHP_SELF;
  $this-body = form action=\$PHP_SELF\\n;
  $this-body .= \tpselect name=\newLocation\
  onchange=\jumpPage(this.form.newLocation)\\n;
  foreach ( $this-items as $item )
  {
  $this-body .=\t\toption value=\.$item[url].\;
  $this-body .= $item[desc];
  $this-body .=/option\n;
  }
 
  $this-body .= \t/select/p\n/form\n;
 
  $this-head = script type=\text/javascript\\n;
  $this-head .= !--
  function jumpPage( newLoc )
  {
  newPage = newLoc.options[newLoc.selectedIndex].value;
  if ( newPage != \\ )
  {
  window.location.href=newPage;
  }
  } // --\n;
  $this-head .= /script\n\n;
  }
  }
 
  Thanks
 
  Gav...
 
 
 
  On Sun, Aug 31, 2008 at 1:16 PM, Evert Lammerts
  [EMAIL PROTECTED] wrote:
   The code you've sent seems to be fine, and if I check your website it
   does everything it should do in terms of filtering - if I select
   Tayside as a region I get a development company with the region set to
   Tayside. It seems to me that this means the problem is not in one of
   the subclasses of ProfileList, so not a compatibility issue on that
   level ($this-query works fine).
  
   while( $row = $db-getrow() )
   seems to stop after one loop. This is either because there are no more
   results - the query is limited to 1, so $count=1 - or because
   $db-getRow generates an error.
  
   COUNT and $count look like they have different roles to me, COUNT is
   the
  amount of
   designers to be listed per page, $count is the number of designers to
   be
  listed altogether,
   so 150 designers would give me 5 pages of 30 designers.
  
   In ProfileList::render the query is appended with LIMIT $start,
   $count, and the results of the query all seem to be rendered. This
   probably means that $count and COUNT should have the same value - 30 -
   and that the render function is initially called with the global
   variable COUNT as parameter.
  
   To check what goes wrong you first need to set error_reporting to
   E_ALL in php.ini and restart your webserver, or add the line
   error_reporting(E_ALL); at the beginning of you code. After that you
   need to print the query from ProfileList::render. Can you adjust the
   function and add var_dump($q); after the line $q = $q. LIMIT $start,
   $count ;?
  
   Evert
  
 
 
 
 
  

Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Gav
On Sun, Aug 31, 2008 at 10:45 PM, Gav [EMAIL PROTECTED] wrote:



 On Sun, Aug 31, 2008 at 10:36 PM, Evert Lammerts [EMAIL PROTECTED]
  wrote:

 In PHP5 register_globals defaults to off. You can either switch it
 back on through your php.ini and restart your webserver, or change all
 PHP_SELF references to $_SERVER['PHP_SELF']. See if that fixes your
 problem.


 I already have

 php_admin_flag register_globals 1

 in the VirtualHost config for that site, so it should be on already.
 So I guess I'll try changing the references anyway jic.


Well, with E_ALL still on I have cleared all errors now so no more errors on
screen.
However, problem persists, still looking but its now 3am so I should just
try again later.

Gav...







 I hope you understood the SQL injection problem I pointed out. Anybody
 can drop your database, so do fix it!


 Will do, thanks.

 Gav...




 On 8/31/08, Gav [EMAIL PROTECTED] wrote:
  On Sun, Aug 31, 2008 at 9:27 PM, Evert Lammerts
  [EMAIL PROTECTED]wrote:
 
  You don't need to print the query anymore - I already did that. You
  need to change your code because right now it is open for SQL
  injection attacks: I added some SQL to the url and generated an SQL
  error (http://www.iwdp.co.uk/list.php?region=1start=30,2). When you
  retrieve start, e.g. $_GET['start'], do a check to make sure the value
  is an integer.
 
  The good news is that the query looks fine:
  SELECT d.id AS id FROM designers d, designer_regions dr WHERE
  dr.region_id=1 AND dr.designer_id=d.id AND d.view=1 ORDER BY d.id ASC
  LIMIT 0, 30;
 
  Can you run this query directly on the database and see what the result
  is?
 
 
  *SQL query:* SELECT d.id AS id FROM designers d, designer_regions dr
 WHERE
  dr.region_id=1 AND dr.designer_id=d.id AND d.view=1 ORDER BY d.id ASC
 LIMIT
  0, 30;
  *Rows:* 30  id  2  4  5  11  43  63  86  99  117  119  158  165  233
  272
  290  305  328  335  363  396  414  425  430  436  459  489  490  518
  536
  554
 
 
 
  Also check if you get an error after setting error_reporting to E_ALL.
 
 
   Yup, I left it up there at http://www.iwdp.co.uk/list.php
 
  The PHP_SELF being referred to as undefined is in the included file
  generic.php  :-
 
  class DropNav
  {
  var $items =array();
  var $head;
  var $body;
 
  // CONSTRUCTOR
  function DropNav()
  {
  }
 
  // PUBLIC
  function renderHead()
  {
  $this-buildHTML();
  print $this-head;
  }
 
  // PUBLIC
  function renderBody()
  {
  $this-buildHTML();
  print $this-body;
  }
 
  // PUBLIC
  function addItem( $url, $desc )
  {
  $this-items[] = array( url = $url, desc=$desc );
  }
 
  // PRIVATE
  function buildHTML()
  {
  global $PHP_SELF;
  $this-body = form action=\$PHP_SELF\\n;
  $this-body .= \tpselect name=\newLocation\
  onchange=\jumpPage(this.form.newLocation)\\n;
  foreach ( $this-items as $item )
  {
  $this-body .=\t\toption value=\.$item[url].\;
  $this-body .= $item[desc];
  $this-body .=/option\n;
  }
 
  $this-body .= \t/select/p\n/form\n;
 
  $this-head = script type=\text/javascript\\n;
  $this-head .= !--
  function jumpPage( newLoc )
  {
  newPage = newLoc.options[newLoc.selectedIndex].value;
  if ( newPage != \\ )
  {
  window.location.href=newPage;
  }
  } // --\n;
  $this-head .= /script\n\n;
  }
  }
 
  Thanks
 
  Gav...
 
 
 
  On Sun, Aug 31, 2008 at 1:16 PM, Evert Lammerts
  [EMAIL PROTECTED] wrote:
   The code you've sent seems to be fine, and if I check your website it
   does everything it should do in terms of filtering - if I select
   Tayside as a region I get a development company with the region set
 to
   Tayside. It seems to me that this means the problem is not in one of
   the subclasses of ProfileList, so not a compatibility issue on that
   level ($this-query works fine).
  
   while( $row = $db-getrow() )
   seems to stop after one loop. This is either because there are no
 more
   results - the query is limited to 1, so $count=1 - or because
   $db-getRow generates an error.
  
   COUNT and $count look like they have different roles to me, COUNT is
   the
  amount of
   designers to be listed per page, $count is the number of designers
 to
   be
  listed altogether,
   so 150 designers would give me 5 pages of 30 designers.
  
   In ProfileList::render the query is appended with LIMIT $start,
   $count, and the results of the query all seem to be rendered. This
   probably means that $count and COUNT should have the same value - 30
 -
   and that the render function is initially called with the global
   variable COUNT as parameter.
  
   To check what goes wrong you first need to set error_reporting to
   E_ALL in php.ini and restart your 

Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Evert Lammerts
I'm pretty sure I found the problem - I should've spotted it earlier.

The function ProfileList::render gets a reference to the $db object by
its parameter $db. While you loop over your results, you pass the
reference on to $this-des-load. I'm guessing that the definition of
$this-des-load is something like function load($id, $db);, in which
case it's not getting a reference to the $db object but an actual copy
in PHP4. Since PHP 5 there is a new object model that makes sure that
any variable that holds an object is actually just a handle to the
object - so whenever you pass it to a function you use it as a
reference instead of a copy.

To make it clear:

class test {
  var $a = 1;
  function aa() {
$this-a++;
  }
}

$c = new test();
$d = $c;
$c-aa();
$d-aa();
var_dump ($c);

results in:
object(test)#1 (1) { [a]=  int(3) }

This means you should first change the function definitions to not use
references for objects, so take away the  at every $db parameter.

Second you need to create a new $db object for your $this-des-load
function before the while loop in ProfileList::render. I think the
safest option is to do something like $db2 = new Db(...). You can also
use the keyword clone to clone an object, but i'm not sure what this
does with your internal DB handle you could try and see what
happens. Just add $db2 = clone $db; right before the while loop. Call
$this-des-load with $db2 instead of $db.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Gav
On Mon, Sep 1, 2008 at 9:23 AM, Evert Lammerts [EMAIL PROTECTED]wrote:

 I'm pretty sure I found the problem - I should've spotted it earlier.

 The function ProfileList::render gets a reference to the $db object by
 its parameter $db. While you loop over your results, you pass the
 reference on to $this-des-load. I'm guessing that the definition of
 $this-des-load is something like function load($id, $db);, in which
 case it's not getting a reference to the $db object but an actual copy
 in PHP4. Since PHP 5 there is a new object model that makes sure that
 any variable that holds an object is actually just a handle to the
 object - so whenever you pass it to a function you use it as a
 reference instead of a copy.

 To make it clear:

 class test {
  var $a = 1;
  function aa() {
$this-a++;
  }
 }

 $c = new test();
 $d = $c;
 $c-aa();
 $d-aa();
 var_dump ($c);

 results in:
 object(test)#1 (1) { [a]=  int(3) }

 This means you should first change the function definitions to not use
 references for objects, so take away the  at every $db parameter.

 Second you need to create a new $db object for your $this-des-load
 function before the while loop in ProfileList::render. I think the
 safest option is to do something like $db2 = new Db(...). You can also
 use the keyword clone to clone an object, but i'm not sure what this
 does with your internal DB handle you could try and see what
 happens. Just add $db2 = clone $db; right before the while loop. Call
 $this-des-load with $db2 instead of $db.


aha, excellent explanation , and $db2 = clone$db; worked fine!

I was reading my way round php.net and getting closer I think, your
explanation and probably saved my a few days , so thanks.


-- 
Gav...


Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Gav
On Mon, Sep 1, 2008 at 10:10 AM, Gav [EMAIL PROTECTED] wrote:



 On Mon, Sep 1, 2008 at 9:23 AM, Evert Lammerts [EMAIL PROTECTED]wrote:

 I'm pretty sure I found the problem - I should've spotted it earlier.

 The function ProfileList::render gets a reference to the $db object by
 its parameter $db. While you loop over your results, you pass the
 reference on to $this-des-load. I'm guessing that the definition of
 $this-des-load is something like function load($id, $db);, in which
 case it's not getting a reference to the $db object but an actual copy
 in PHP4. Since PHP 5 there is a new object model that makes sure that
 any variable that holds an object is actually just a handle to the
 object - so whenever you pass it to a function you use it as a
 reference instead of a copy.

 To make it clear:

 class test {
  var $a = 1;
  function aa() {
$this-a++;
  }
 }

 $c = new test();
 $d = $c;
 $c-aa();
 $d-aa();
 var_dump ($c);

 results in:
 object(test)#1 (1) { [a]=  int(3) }

 This means you should first change the function definitions to not use
 references for objects, so take away the  at every $db parameter.

 Second you need to create a new $db object for your $this-des-load
 function before the while loop in ProfileList::render. I think the
 safest option is to do something like $db2 = new Db(...). You can also
 use the keyword clone to clone an object, but i'm not sure what this
 does with your internal DB handle you could try and see what
 happens. Just add $db2 = clone $db; right before the while loop. Call
 $this-des-load with $db2 instead of $db.


 aha, excellent explanation , and $db2 = clone$db; worked fine!

 I was reading my way round php.net and getting closer I think, your
 explanation and probably saved my a few days , so thanks.


hmm, did I speak to soon, it does work well for the whole list, but as soon
as you select a region or speciality then it all goes pear shaped, I'll keep
looking.

Gav...





 --
 Gav...




-- 
Gav...

[LinkedIn : http://www.linkedin.com/in/ipv6guru]

www.16degrees.com.au | www.iwdp.co.uk | www.minitutorials.com

(Sponsorship slots available on above three sites!)


Re: [PHP-DB] Problem after moving servers

2008-08-31 Thread Gav
On Mon, Sep 1, 2008 at 10:38 AM, Gav [EMAIL PROTECTED] wrote:



 On Mon, Sep 1, 2008 at 10:10 AM, Gav [EMAIL PROTECTED] wrote:



 On Mon, Sep 1, 2008 at 9:23 AM, Evert Lammerts [EMAIL PROTECTED]wrote:

 I'm pretty sure I found the problem - I should've spotted it earlier.

 The function ProfileList::render gets a reference to the $db object by
 its parameter $db. While you loop over your results, you pass the
 reference on to $this-des-load. I'm guessing that the definition of
 $this-des-load is something like function load($id, $db);, in which
 case it's not getting a reference to the $db object but an actual copy
 in PHP4. Since PHP 5 there is a new object model that makes sure that
 any variable that holds an object is actually just a handle to the
 object - so whenever you pass it to a function you use it as a
 reference instead of a copy.

 To make it clear:

 class test {
  var $a = 1;
  function aa() {
$this-a++;
  }
 }

 $c = new test();
 $d = $c;
 $c-aa();
 $d-aa();
 var_dump ($c);

 results in:
 object(test)#1 (1) { [a]=  int(3) }

 This means you should first change the function definitions to not use
 references for objects, so take away the  at every $db parameter.

 Second you need to create a new $db object for your $this-des-load
 function before the while loop in ProfileList::render. I think the
 safest option is to do something like $db2 = new Db(...). You can also
 use the keyword clone to clone an object, but i'm not sure what this
 does with your internal DB handle you could try and see what
 happens. Just add $db2 = clone $db; right before the while loop. Call
 $this-des-load with $db2 instead of $db.


 aha, excellent explanation , and $db2 = clone$db; worked fine!

 I was reading my way round php.net and getting closer I think, your
 explanation and probably saved my a few days , so thanks.


 hmm, did I speak to soon, it does work well for the whole list, but as soon
 as you select a region or speciality then it all goes pear shaped, I'll keep
 looking.


Ok, sorted that too, all is well again, sorry for noise.



 Gav...





Re: [PHP-DB] Problem with updating MySQL table

2008-08-27 Thread YVES SUCAET
Ah, how to debug SQL code in PHP...

Here's what I would do: run your query separately in something like SQLyog or
the Netbeans database interface. Just to echo $sql and copy and paste. An
echo $Record statement may also help to assure that you're passing on the PK
to the record correctly.

One suggestion: you may want put mysql_real_escape_string() wrappers around
all those $_POST[] fields to prevent SQL hijacking of your site.

HTH,

Yves

-- Original Message --
Received: Wed, 27 Aug 2008 11:07:20 AM CDT
From: Jason Pruim [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Problem with updating MySQL table

Hi Everyone,

So I'm working on a project (Same one I sent the question about  
regarding the user access rights on monday) And now I am attempting to  
update the record... Here is some of my code:

index.php
?PHP

form method=post action=purlprocess.php
First Name/Last Nameinput type=text name=txtFName  
value={$row['FName']} $edit input type=text name=txtLName  
value={$row['LName']} $editbr
Email Address input type=text name=txtEmail  
value={$row['email']} $editbr
Company name input type=text name=txtBusiness  
value={$row['Business']} $editbr
Company Address input type=text name=txtAddress1  
value={$row['Address1']} $editbr
City/State/Zip input type=text name=txtCity  
value={$row['City']} $edit input type=text name=txtState  
value={$row['State']} $edit input type=text name=txtZip  
value={$row['Zip']} $editbr
Phone input type=text name=txtPhone value={$row['phone']}  
$editbr
Your Favorite Type of coffee: input type=radio name=rdoCoffee  
value=Starbucks img src=../media/starbucks.jpeg width=10%  
input type=radio name=rdoCoffee value=Folgers   img src=../ 
media/folgers.jpeg width=10% input type=radio name=rdoCoffee  
value=Other Other: input type=text name=txtCoffee size=20br
When would a good time to bring it over be? input type=text  
name=txtMeetingbr
input type=submit value=Yes! Give me the caffeine!
input type=hidden name=Record value={$row['record']}
/p
/form 

?

purlprocessing.php

?PHP
$FName= $_POST['txtFName'];
$LName= $_POST['txtLName'];
$Email= $_POST['txtEmail'];
$Business = $_POST['txtBusiness'];
$Address1 = $_POST['txtAddress1'];
$City = $_POST['txtCity'];
$State = $_POST['txtState'];
$Zip = $_POST['txtZip'];
$CoffeeChoicetest = $_POST['rdoCoffee'];
//$Coffee = $_POST['txtCoffee'];
$Phone = $_POST['txtPhone'];
$Record = $_POST['Record'];
$Meeting = $_POST['txtMeeting'];
$date = time();
$IPAddress = $_SERVER['REMOTE_ADDR'];
if ($CoffeeChoicetest == Other){
$Coffee = $_POST['txtCoffee'];
}else{
$Coffee = $_POST['rdoCoffee'];
}

$sql = UPDATE `schreur` set FName='{$FName}', LName='{$LName}',  
email='{$Email}', Business='{$Business}', Address1='{$Address1}',  
City='{$City}', State='{$State}', Zip='{$Zip}', Coffee='{$Coffee}',  
subscribed='0', date='{$date}', IPAddress='{$IPAddress}',  
Meeting='{$Meeting}' WHERE record='{$Record}';
mysqli_query($link, $sql) or die(Could not update... .  
mysqli_error($link));
?

mysql describe schreur;
++-+--+-+-+---+
| Field  | Type| Null | Key | Default | Extra |
++-+--+-+-+---+
| FName  | varchar(20) | YES  | | NULL|   |
| LName  | varchar(20) | YES  | | NULL|   |
| email  | varchar(50) | YES  | | NULL|   |
| phone  | varchar(12) | YES  | | NULL|   |
| url| int(12) | YES  | | NULL|   |
| record | int(7)  | YES  | | NULL|   |
| subscribed | int(1)  | NO   | | |   |
| date   | varchar(12) | YES  | | NULL|   |
| IPAddress  | varchar(19) | YES  | | NULL|   |
| Business   | varchar(20) | YES  | | NULL|   |
| Address1   | varchar(50) | YES  | | NULL|   |
| City   | varchar(20) | YES  | | NULL|   |
| State  | varchar(2)  | YES  | | NULL|   |
| Zip| varchar(10) | YES  | | NULL|   |
| Coffee | varchar(20) | YES  | | NULL|   |
| Meeting| text| YES  | | NULL|   |
++-+--+-+-+---+


The problem is when I am attempting to update some of the info, it  
erases the info in the field.

Anyone got a clue as to what is going on? :)

Thanks for looking!



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]









--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with updating MySQL table

2008-08-27 Thread Evert Lammerts
Your index.php looks very strange:

 ?PHP

 form method=post action=purlprocess.php
 
 /form

 ?

I'm guessing you're echoing this? I never echo from my scripts so I
don't know if this is new functionality, but in my days you echoed
either by ?=...;? or by ? echo ...; ?.

Anyway, since you're using the $_POST variable, did you check if it
contains any values? You can do this with var_dump($_POST); Let us
know what the results are.

Another tip:

 $FName= $_POST['txtFName'];
 etc

is terrible practice - if anybody writes an SQL command into one of
your textfields it WILL be executed; this is called SQL injection. A
less terrible scenario, but still one that messes up your page, is if
somebody uses quotes. So always use mysql_real_escape_string() on your
post variables before using them in a query.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with updating MySQL table

2008-08-27 Thread Fergus Gibson
Hi, Jason.  Do you realize this code is wide open for an SQL injection 
attack?  The problem could easily be addressed by using a prepared query 
instead.  For more details, check the mysqli documentation.



Jason Pruim wrote:
The problem is when I am attempting to update some of the info, it 
erases the info in the field.


Anyone got a clue as to what is going on? :)


I'm not sure I understand.  You mean that some of the fields that should 
receive content in the update do not do so?  Why not echo $sql and then 
submit the form so that you can see the query being sent to your 
database?  That will probably help you solve the problem.  Odds are 
there is something wrong with your query.


You'd never want to echo an SQL query in a production environment, but 
since this is in development, I assume you needn't worry about that.


You block of $variable = $_POST['key']; is a complete waste of time, 
BTW.  Why create another copy of the data?  You could just as easily use 
set FName = '{$_POST['txtFName']}'...  That would also make your 
injection vulnerability more obvious to you.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with updating MySQL table

2008-08-27 Thread Jason Pruim

Hi Yves,

I plan to wrap the $_POST's into something to protect against some  
issues like that. But this was a proof of concept for the boss so it  
just needed to be up quickly to see if it was something we wanted to  
go ahead with :)



On Aug 27, 2008, at 12:21 PM, YVES SUCAET wrote:


Ah, how to debug SQL code in PHP...

Here's what I would do: run your query separately in something like  
SQLyog or
the Netbeans database interface. Just to echo $sql and copy and  
paste. An
echo $Record statement may also help to assure that you're passing  
on the PK

to the record correctly.

One suggestion: you may want put mysql_real_escape_string() wrappers  
around

all those $_POST[] fields to prevent SQL hijacking of your site.

HTH,

Yves

-- Original Message --
Received: Wed, 27 Aug 2008 11:07:20 AM CDT
From: Jason Pruim [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Problem with updating MySQL table

Hi Everyone,

So I'm working on a project (Same one I sent the question about
regarding the user access rights on monday) And now I am attempting to
update the record... Here is some of my code:

index.php
?PHP

form method=post action=purlprocess.php
First Name/Last Nameinput type=text name=txtFName
value={$row['FName']} $edit input type=text name=txtLName
value={$row['LName']} $editbr
Email Address input type=text name=txtEmail
value={$row['email']} $editbr
Company name input type=text name=txtBusiness
value={$row['Business']} $editbr
Company Address input type=text name=txtAddress1
value={$row['Address1']} $editbr
City/State/Zip input type=text name=txtCity
value={$row['City']} $edit input type=text name=txtState
value={$row['State']} $edit input type=text name=txtZip 
value={$row['Zip']} $editbr 
Phone input type=text name=txtPhone value={$row['phone']}
$editbr
Your Favorite Type of coffee: input type=radio name=rdoCoffee
value=Starbucks img src=../media/starbucks.jpeg width=10%
input type=radio name=rdoCoffee value=Folgers   img src=../
media/folgers.jpeg width=10% input type=radio name=rdoCoffee
value=Other Other: input type=text name=txtCoffee  
size=20br

When would a good time to bring it over be? input type=text
name=txtMeetingbr
input type=submit value=Yes! Give me the caffeine!
input type=hidden name=Record value={$row['record']}
/p
/form   

?

purlprocessing.php

?PHP
$FName= $_POST['txtFName'];
$LName= $_POST['txtLName'];
$Email= $_POST['txtEmail'];
$Business = $_POST['txtBusiness'];
$Address1 = $_POST['txtAddress1'];
$City = $_POST['txtCity'];
$State = $_POST['txtState'];
$Zip = $_POST['txtZip'];
$CoffeeChoicetest = $_POST['rdoCoffee'];
//$Coffee = $_POST['txtCoffee'];
$Phone = $_POST['txtPhone'];
$Record = $_POST['Record'];
$Meeting = $_POST['txtMeeting'];
$date = time();
$IPAddress = $_SERVER['REMOTE_ADDR'];
if ($CoffeeChoicetest == Other){
$Coffee = $_POST['txtCoffee'];
}else{
$Coffee = $_POST['rdoCoffee'];
}

$sql = UPDATE `schreur` set FName='{$FName}', LName='{$LName}',
email='{$Email}', Business='{$Business}', Address1='{$Address1}',
City='{$City}', State='{$State}', Zip='{$Zip}', Coffee='{$Coffee}',
subscribed='0', date='{$date}', IPAddress='{$IPAddress}',
Meeting='{$Meeting}' WHERE record='{$Record}';
mysqli_query($link, $sql) or die(Could not update... .
mysqli_error($link));
?

mysql describe schreur;
++-+--+-+-+---+
| Field  | Type| Null | Key | Default | Extra |
++-+--+-+-+---+
| FName  | varchar(20) | YES  | | NULL|   |
| LName  | varchar(20) | YES  | | NULL|   |
| email  | varchar(50) | YES  | | NULL|   |
| phone  | varchar(12) | YES  | | NULL|   |
| url| int(12) | YES  | | NULL|   |
| record | int(7)  | YES  | | NULL|   |
| subscribed | int(1)  | NO   | | |   |
| date   | varchar(12) | YES  | | NULL|   |
| IPAddress  | varchar(19) | YES  | | NULL|   |
| Business   | varchar(20) | YES  | | NULL|   |
| Address1   | varchar(50) | YES  | | NULL|   |
| City   | varchar(20) | YES  | | NULL|   |
| State  | varchar(2)  | YES  | | NULL|   |
| Zip| varchar(10) | YES  | | NULL|   |
| Coffee | varchar(20) | YES  | | NULL|   |
| Meeting| text| YES  | | NULL|   |
++-+--+-+-+---+


The problem is when I am attempting to update some of the info, it
erases the info in the field.

Anyone got a clue as to what is going on? :)

Thanks for looking!



--

Jason Pruim
Raoset 

Re: [PHP-DB] Problem with updating MySQL table

2008-08-27 Thread Fergus Gibson

YVES SUCAET wrote:
 One suggestion: you may want put mysql_real_escape_string() wrappers 
around

 all those $_POST[] fields to prevent SQL hijacking of your site.
[...]
mysqli_query($link, $sql) or die(Could not update... .

Yves, he's using mysqli, not mysql.  You should not mix those functions. 
   What he should do is this:


?php

$sql = UPDATE `schreur` set FName=?, LName=?,
email=?, Business=?, Address1=?,
City=?, State=?, Zip=?, Coffee=?,
subscribed=?, date=?, IPAddress=?,
Meeting=? WHERE record=?;

$statement = mysqli_prepare($link, $sql);
mysqli_stmt_bind_param($statement,
'sisssi',
$_POST['txtFName'],
$_POST['txtLName'],
// etc..
);
mysqli_stmt_execute($statement);

?

Personally, I find the object style much easier to use than this 
procedural style, but I am just being consistent with his code.  Using a 
prepare query will escape all necessary data automatically, provided 
your string of types ('sisssi') is correct.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with updating MySQL table

2008-08-27 Thread Fergus Gibson

Jason Pruim wrote:
I plan to wrap the $_POST's into something to protect against some 
issues like that. But this was a proof of concept for the boss so it 
just needed to be up quickly to see if it was something we wanted to go 
ahead with :)


Well, no worries about that then.  We're just looking out for your data 
security.  Heaven forbid someone tamper with your database resulting in 
some poor soul receiving the wrong coffee! ;)


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with updating MySQL table

2008-08-27 Thread Evert Lammerts
Everybody seems to agree on escaping :-) And I'm learning! HEREDOC,
nifty indeed!

How about your $_POST variable, is there anything in there?

On Wed, Aug 27, 2008 at 6:38 PM, Jason Pruim [EMAIL PROTECTED] wrote:

 On Aug 27, 2008, at 12:24 PM, Evert Lammerts wrote:

 Your index.php looks very strange:

 ?PHP

 form method=post action=purlprocess.php
 
 /form

 ?

 I'm guessing you're echoing this? I never echo from my scripts so I
 don't know if this is new functionality, but in my days you echoed
 either by ?=...;? or by ? echo ...; ?.

 It is a index.php page using the HEREDOC syntax... so basically:
 echo HTML Pany HTML code goes here
 HTML;

 pretty nifty I feel.



 Anyway, since you're using the $_POST variable, did you check if it
 contains any values? You can do this with var_dump($_POST); Let us
 know what the results are.

 Another tip:

 $FName= $_POST['txtFName'];
 etc

 is terrible practice - if anybody writes an SQL command into one of
 your textfields it WILL be executed; this is called SQL injection. A
 less terrible scenario, but still one that messes up your page, is if
 somebody uses quotes. So always use mysql_real_escape_string() on your
 post variables before using them in a query.

 mysql_real_escape_string() won't help with my mysqlI connection though :)

 I will be wrapping the whole thing in a prepared statement before going to
 production with this. At this point this is simply a proof of concept for
 the boss.
 --

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 11287 James St
 Holland, MI 49424
 www.raoset.com
 [EMAIL PROTECTED]






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with updating MySQL table

2008-08-27 Thread Jason Pruim


On Aug 27, 2008, at 12:41 PM, Evert Lammerts wrote:


Everybody seems to agree on escaping :-) And I'm learning! HEREDOC,
nifty indeed!


Yeah, ever since I found out about HEREDOC I've used it quite  
extensively with some of my projects... Also, when you're in the  
HEREDOC block, if you need to reference a variable just do this:


?PHP
$var1 = World;
echo HTML
pHello {$var1}!/p
HTML;
?

and voila!



How about your $_POST variable, is there anything in there?


I think I have it narrowed down to disabling the editing of the  
fields...


If I do NOT disable the editing, then it submits fine, if I DO disable  
it then they don't submit.


I need to find a better to stop accidental editing rather then just  
input type=text disable





On Wed, Aug 27, 2008 at 6:38 PM, Jason Pruim [EMAIL PROTECTED]  
wrote:


On Aug 27, 2008, at 12:24 PM, Evert Lammerts wrote:


Your index.php looks very strange:


?PHP

form method=post action=purlprocess.php

/form

?


I'm guessing you're echoing this? I never echo from my scripts so I
don't know if this is new functionality, but in my days you echoed
either by ?=...;? or by ? echo ...; ?.


It is a index.php page using the HEREDOC syntax... so basically:
echo HTML Pany HTML code goes here
HTML;

pretty nifty I feel.




Anyway, since you're using the $_POST variable, did you check if it
contains any values? You can do this with var_dump($_POST); Let us
know what the results are.

Another tip:


$FName= $_POST['txtFName'];
etc


is terrible practice - if anybody writes an SQL command into one of
your textfields it WILL be executed; this is called SQL injection. A
less terrible scenario, but still one that messes up your page, is  
if
somebody uses quotes. So always use mysql_real_escape_string() on  
your

post variables before using them in a query.


mysql_real_escape_string() won't help with my mysqlI connection  
though :)


I will be wrapping the whole thing in a prepared statement before  
going to
production with this. At this point this is simply a proof of  
concept for

the boss.
--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]









--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with updating MySQL table

2008-08-27 Thread Jason Pruim


On Aug 27, 2008, at 12:48 PM, Jason Pruim wrote:



For everyone that has helped me on this thank you! :) the solution was  
changing from: input type=text name=txtFName DISABLED to input  
type=text name=txtFName READONLY Read only fields still get  
passed with POST'ed info where as disabled does not.


And yes I will be adding some prepared statements to prevent SQL  
injections as I'm hoping this will be a VERY popular feature that will  
be used by my company for quite a long time :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with updating MySQL table

2008-08-27 Thread Micah Gersten
Putting commands into input containers in HTML is deprecated in the
XHTML specification.  You should use this instead in the input:

readonly=readonly

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Jason Pruim wrote:

 On Aug 27, 2008, at 12:48 PM, Jason Pruim wrote:


 For everyone that has helped me on this thank you! :) the solution was
 changing from: input type=text name=txtFName DISABLED to input
 type=text name=txtFName READONLY Read only fields still get
 passed with POST'ed info where as disabled does not.

 And yes I will be adding some prepared statements to prevent SQL
 injections as I'm hoping this will be a VERY popular feature that will
 be used by my company for quite a long time :)


 -- 

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 11287 James St
 Holland, MI 49424
 www.raoset.com
 [EMAIL PROTECTED]






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB]problem in creating the ibm_db2 extension

2008-05-01 Thread H Thirividi
On Thu, May 1, 2008 at 5:53 AM, Chris [EMAIL PROTECTED] wrote:

 H Thirividi wrote:
  Hi All,
 
  I have installed db2 on my* fedora core 7* system and now i wan t to
 access
  the database using the* php apis*. For this reason I downloaded the
 *ibm_db2
  1.6* package and tried to create the extension. I did the following
 
  phpize
 
  output is
  Configuring for:
  PHP Api Version: 20041225
  Zend Module Api No:  20060613
  Zend Extension Api No:   220060519
 
  ./configure --with-IBM_DB2=/opt/ibm/db2/V9.5
  part of the ouput
 
  checking for re2c... no
  configure: WARNING: You will need re2c 0.12.0 or later if you want to
  regenerate PHP parsers.
  checking for gawk... gawk
  checking for IBM_DB2 support... yes, shared
  checking Looking for DB2 CLI libraries... checking  in
  /opt/ibm/db2/V9.5...
  checking  in /opt/ibm/db2/V9.5/lib64...
  checking  in /opt/ibm/db2/V9.5/lib32... found
  checking for DB2 CLI include files in default path... checking in
  /opt/ibm/db2/V9.5... not found

 It's looking for the include/, lib/ etc folders under that (ie the
 headers and so on).

 Where are they located?

 Hello Chris,

I am not sure if after getting a reply to the question one should still
reply to the mailing list or reply to the *person directly*. If I have
committed a mistake kindly oblige as this is new to me.
After posting the question I just *searched* and then came to know that
while installing db2, it had created 3 users named *db2inst1*,
*db2fenc1*and one more
*administrative user* whose name i am not able to recollect and then saw *db2
cli include files* in *db2inst1's home* when i logged onto the system as a
db2inst1 user and tried to copy those files to /opt/ibm/db2/V9.5 (which is
where db2 database is installed)  but  gave me an error saying that I cannot
copy.
I also changed the permissions and even then could not copy.
So does this mean i have to complie the extension by logging in as db2inst1
and cant this be as root or what should I do to continue further.

With Regards,
Harsha


Re: [PHP-DB]problem in creating the ibm_db2 extension

2008-05-01 Thread Chris
H Thirividi wrote:
 
 
 On Thu, May 1, 2008 at 5:53 AM, Chris [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
 
 H Thirividi wrote:
  Hi All,
 
  I have installed db2 on my* fedora core 7* system and now i wan t
 to access
  the database using the* php apis*. For this reason I downloaded
 the *ibm_db2
  1.6* package and tried to create the extension. I did the following
 
  phpize
 
  output is
  Configuring for:
  PHP Api Version: 20041225
  Zend Module Api No:  20060613
  Zend Extension Api No:   220060519
 
  ./configure --with-IBM_DB2=/opt/ibm/db2/V9.5
  part of the ouput
 
  checking for re2c... no
  configure: WARNING: You will need re2c 0.12.0 or later if you want to
  regenerate PHP parsers.
  checking for gawk... gawk
  checking for IBM_DB2 support... yes, shared
  checking Looking for DB2 CLI libraries... checking  in
  /opt/ibm/db2/V9.5...
  checking  in /opt/ibm/db2/V9.5/lib64...
  checking  in /opt/ibm/db2/V9.5/lib32... found
  checking for DB2 CLI include files in default path... checking in
  /opt/ibm/db2/V9.5... not found
 
 It's looking for the include/, lib/ etc folders under that (ie the
 headers and so on).
 
 Where are they located?
 
 Hello Chris,
 
 I am not sure if after getting a reply to the question one should still
 reply to the mailing list or reply to the *person directly*. If I have
 committed a mistake kindly oblige as this is new to me.

mailing list - so others can chime in with suggestions and/or learn from
the questions/comments.

 After posting the question I just *searched* and then came to know that
 while installing db2, it had created 3 users named *db2inst1*,
 *db2fenc1* and one more *administrative user* whose name i am not able
 to recollect and then saw *db2 cli include files* in *db2inst1's home*
 when i logged onto the system as a db2inst1 user and tried to copy those
 files to /opt/ibm/db2/V9.5 (which is where db2 database is installed) 
 but  gave me an error saying that I cannot copy.

Note - I have never installed db2 so not sure how it works/is set up.

However, with mysql, postgresql, gd  other extensions for php, you have
to install the devel or dev package along with the main one for php
to compile against.

The dev package provides the headers which other packages can use, for
example:

/usr/include/postgresql/*.h
/usr/lib/postgresql/*

PHP looks at those headers (*.h) and uses those to work out functionality.

So when you compile, you have to point php to the base folder which
contains the include/ and lib/ subdirectories.

./configure --with-pgsql=/usr

in your case:

./configure --with-db2=/path/to/db2

under /path/to/db2 you need the include/, lib/ etc folders which include
the program headers. Without those files, php won't compile with db2
support.


It looks like you have the lib stuff there (lib32/ is fine, it was
picked up) but there's no include/ stuff which is what configure is
complaining about.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB]problem in creating the ibm_db2 extension

2008-04-30 Thread Chris
H Thirividi wrote:
 Hi All,
 
 I have installed db2 on my* fedora core 7* system and now i wan t to access
 the database using the* php apis*. For this reason I downloaded the *ibm_db2
 1.6* package and tried to create the extension. I did the following
 
 phpize
 
 output is
 Configuring for:
 PHP Api Version: 20041225
 Zend Module Api No:  20060613
 Zend Extension Api No:   220060519
 
 ./configure --with-IBM_DB2=/opt/ibm/db2/V9.5
 part of the ouput
 
 checking for re2c... no
 configure: WARNING: You will need re2c 0.12.0 or later if you want to
 regenerate PHP parsers.
 checking for gawk... gawk
 checking for IBM_DB2 support... yes, shared
 checking Looking for DB2 CLI libraries... checking  in
 /opt/ibm/db2/V9.5...
 checking  in /opt/ibm/db2/V9.5/lib64...
 checking  in /opt/ibm/db2/V9.5/lib32... found
 checking for DB2 CLI include files in default path... checking in
 /opt/ibm/db2/V9.5... not found

It's looking for the include/, lib/ etc folders under that (ie the
headers and so on).

Where are they located?


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem when using SQL_CUR_USE_ODBC on connect

2008-04-01 Thread Jon L.
(This isn't a solution, per se...just a suggestion.)

I don't know how they compare; I've never personally used the ODBC
functions...

But, you may give the MSSQL functions a try:
http://php.net/mssql

- Jon L.

On Mon, Mar 31, 2008 at 3:27 PM, cfs [EMAIL PROTECTED] wrote:

 I'm using PHP with Apache. PHP code connects to MS SQL server using ODBC.

 I'm doing a query against a table that is very simple: one column of the
 real data type, one of the text data type.

 The text field is set to testing 1,2,3. The real column is set to
 10.015.

 When I use the default connect options, I get both values back fine.

 When I use  SQL_CUR_USE_ODBC, which I very much want to use, then the text
 column data comes back as boolean(false).

 Does anyone know of a solution?

 Table:

 CREATE TABLE [dbo].[test1](
 [ID] [int] IDENTITY(1,1) NOT NULL,

 [real1] [real] NULL,

 [text1] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

 CONSTRAINT [PK_test1] PRIMARY KEY CLUSTERED

 (

 [ID] ASC

 )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]

 ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

 Code:

 ?php
 $conn = odbc_connect(db-name, user-name,password, SQL_CUR_USE_ODBC);
 $result = odbc_exec($conn, select * from test1);
 if (odbc_fetch_row($result)) {
  print Values:  . odbc_result($result,real1) . , .
 odbc_result($result,text1);
 }
 ?





 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] problem in recorset that seems temporary

2008-01-25 Thread Krister Karlström

Hi!

I did not quite get the point here, but maybe that's not needed to solve 
the problem... :-)


First of all, you seem to have enabled the register_global setting, 
since I can't see from where the parameter $id is posted. Use the $_GET 
or $_POST superglobal array instead. Take big care of input filtering 
also and do not put dirty data directly into your query.


Second, the function mysql_db_query() has been deprecated for a long 
time now, use mysql_select_db() and mysql_query() instead.


I think your problem is in your while-loop:

You loop over the result set $result and fetch the row as an object.
Then you execute a delete statement and at the same time overwriting 
your previous result set $result, thus you will break the loop with an 
error that the provided parameter is not a result set.


I also guess you have a typo in your last statement where you (probably) 
try to delete the gallery. I guess that you maybe want to use the 
variable $galerie_id..? Well, I can't tell without any more information 
about your application.


Greetings,
Krister Karlström, Helsinki, Finland

Ruprecht Helms wrote:


while($row = mysql_fetch_object($result))
{
$galerie_id=$row-ID;
$result=mysql_db_query(pferdeservice-karle,DELETE FROM
Galerie_kultur WHERE GalerieID=$id);
}
$result=mysql_db_query(pferdeservice-karle,DELETE FROM Galerie WHERE
ID=$id);
echo mysql_error();


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with reading out value from urlline

2007-08-06 Thread Aleksandar Vojnovic

Hi,

you should do it like this
?php
$id = $_GET['id']; // -- getting var from the url line
echo $id;
?
- Aleksandar

Ruprecht Helms wrote:

Hi,

I have the problem that a phpscript is not able to read out a value from
the browserline.  In the browserline I have the URL
domain/page?id=value. The id-Value I want to process within the
script but a   echo $id shows me no value.

The Php-Surrounding is very secured. Formfields and variables that
schould be part of a mysqldatabase must be escaped by the
mysql_real_escape_string-command. What is the right command to get the
value from the browserline.

Regards,
Ruprecht

--
Ruprecht Helms IT-Service  Softwaredevelopment

Web: a href=http://www.rheyn.deRuprecht Helms IT-Service 
Softwareentwicklung, Loerrach/a

  


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with passing variable to mssql

2007-06-28 Thread Stut

William Curry wrote:

I have issues I cant understand passing a sql statement to mssql, most
of which work fine, however in some cases, a statement like
SELECT * FROM tblX where value like 'variable%'   will return 0
records when I know they are there. No errors, just 0 records.
 
When I echo the sql string to the page, cut and paste it into SQL query

analyzer, the exact same statement returns the expected records.
 
Anyome point me to the answer??


It's over there -

Sorry, couldn't resist.

Anyhoo, are you expecting variable to be replaced with the contents of 
$variable? If so that's never going to work. Try this instead...


SELECT * FROM tblX where value like '.str_replace(', '', 
$variable).%' 


-Stut

--
http://stut.net/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with passing variable to mssql

2007-06-28 Thread Stut

Please include the list when replying.

William Curry wrote:
Thanx for the quick reply, I left out the concats in my sample here is 
the exact statement:
 
$qry1 = SELECT *,CONVERT(Char(24),CALL_ENTRY_DATE,101) as MYDATE from 
PcarsCallComplete

where Location_address =  .$Location2.  order by CALL_NO;
 
and as echoed with the $Location2 value inserted:
 
SELECT *,CONVERT(Char(24),CALL_ENTRY_DATE,101) as MYDATE from 
PcarsCallComplete where Location_address = '1121 800N,TOT,TOT' order by 
CALL_NO
 
$Location2 is passed in the URL when the user clicks a hyperlink for a 
certain address record from a list of possible matches.
$qry1 returns 0 records in the page, but 10 records in SQL QA.  I run 
the URL var through a stripslashes and add the '%' before inserting it 
into the string.
 
I've, never used the str_replace function, and generally get the same 
results with similar statements. baffled


1) The str_replace is necessary to protect against SQL injection 
attacks. If you don't know what that means, Google it.


2) Are you checking return values for errors? If not, try that.

Aside from that I have no idea. If there are no errors and you are still 
getting different results from the script and from QA with the same SQL 
statement then by definition something *is* different.


-Stut

--
http://stut.net/


  Stut [EMAIL PROTECTED] 6/28/2007 8:30 AM 
William Curry wrote:
  I have issues I cant understand passing a sql statement to mssql, most
  of which work fine, however in some cases, a statement like
  SELECT * FROM tblX where value like 'variable%'   will return 0
  records when I know they are there. No errors, just 0 records.
  
  When I echo the sql string to the page, cut and paste it into SQL query

  analyzer, the exact same statement returns the expected records.
  
  Anyome point me to the answer??


It's over there -

Sorry, couldn't resist.

Anyhoo, are you expecting variable to be replaced with the contents of
$variable? If so that's never going to work. Try this instead...

SELECT * FROM tblX where value like '.str_replace(', '',
$variable).%' 

-Stut

--
http://stut.net/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with passing variable to mssql

2007-06-28 Thread James Gadrow


William Curry wrote: 
$qry1 = SELECT *,CONVERT(Char(24),CALL_ENTRY_DATE,101) as MYDATE 
from PcarsCallComplete

where Location_address =  .$Location2.  order by CALL_NO;

This method usually works well for me for debugging purposes:

immediately prior to query, echo it to see exactly what you're telling 
mysql and then exit the script so it's the only output.
Log in to mysql as the user that your script is logging in as (just in 
case it's a permission setting)

Enter sql via copy  paste
Check results.

So, for you:
echo \$qry1 = \SELECT *,CONVERT(Char(24),CALL_ENTRY_DATE,101) as 
MYDATE from PcarsCallComplete where Location_address = $Location2 order 
by CALL_NO\;;


Enter output into mysql (obviously only the code between the quotes) and 
run query. Be sure you're logged in as the same user that the script 
logs in with, else you may have different privileges!


If you don't receive an error or an empty set in mysql, then it could be 
something simple yet hard to diagnose. Perhaps you're inserting (and 
logging directly in) to a different database than your script is reading 
from (such as if you have multiple comps on your network acting as 
servers, perhaps you're trying to select from the wrong machine's database).


Thanks,

Jim

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with rss-feed generation

2007-06-16 Thread Hassan
I support Neil on this point!
  But anyway this list has answered many other aspects, so why not some XML?
  Ruprecht you might like FeedCreator latest stable from here 
http://www.bitfolge.de/rsscreator it just doesn't generate ATOM 1.0, but all 
other formats will be readable atleast by IE and Firefox.
   
  Best Regards.

   
-
Shape Yahoo! in your own image.  Join our Network Research Panel today!

Re: [PHP-DB] Problem with rss-feed generation

2007-06-15 Thread Niel Archer
Hi

the first line is badly formed

xml version=1.0 encoding=ISO-8859-1

Should be:

?xml version=1.0 encoding=ISO-8859-1 ?


Niel

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with rss-feed generation

2007-06-15 Thread Ruprecht Helms
Niel Archer wrote:
 Hi
 
 the first line is badly formed
 
 xml version=1.0 encoding=ISO-8859-1
 
 Should be:
 
 ?xml version=1.0 encoding=ISO-8859-1 ?

ok by beginning the php-code with ?php I fixed the problem.
Unfortunately my RSSowl tell me that there must be other errors in the
xml-formating. And I don't got a detailed information what RSSowl
dislike in the xml-file.

Regards,
Ruprecht

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with rss-feed generation

2007-06-15 Thread Niel Archer
Hi

 ok by beginning the php-code with ?php I fixed the problem.
 Unfortunately my RSSowl tell me that there must be other errors in the
 xml-formating. And I don't got a detailed information what RSSowl
 dislike in the xml-file.

Try opening it in a browser. Opera, for example, tells you what error it
encounters.  That's how I identified your initial error.

Niel

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with rss-feed generation

2007-06-15 Thread Ruprecht Helms
Niel Archer wrote:
 Hi
 
 ok by beginning the php-code with ?php I fixed the problem.
 Unfortunately my RSSowl tell me that there must be other errors in the
 xml-formating. And I don't got a detailed information what RSSowl
 dislike in the xml-file.
 
 Try opening it in a browser. Opera, for example, tells you what error it
 encounters.  That's how I identified your initial error.

firefox tells me that it dislike the closing xml-tag.
In my quanta-editor it seems that can be difficulties with the tagend of
the opening xml-line of the second position of the questionmark.

Regards,
Ruprecht
?xml version=1.0 encoding=ISO-8859-1? 
!DOCTYPE rss PUBLIC -//Netscape Communications//DTD RSS 0.91//EN
http://my.netscape.com/publish/formats/rss-0.91.dtd;
rss version=0.91
channel
title(RSS 2.0)/title
linkhttp://www.bla.com//link
descriptionDie neuesten Artikel in Bla-Bereich ; /description
languagede/language
managingEditorRuprecht Helms [EMAIL PROTECTED]/managingEditor
webMasterRuprecht Helms [EMAIL PROTECTED]/webMaster
item
title/title
link/link
descriptionlt;table CELLPADDING=quot;5quot;
CELLSPACING=quot;0quot; border=quot;0quot;
align=quot;leftquot;gt;lt;trgt;lt;tdgt;lt;#47;tdgt;lt;#47;trgt;lt;#47;tablegt;
lt;brgt; dsklfdsafdsajfasdf lt;brgt;/description
descriptiondsklfdsafdsajfasdflt;brgt;  -
/description
/item
item
title/title
link/link
descriptionlt;table CELLPADDING=quot;5quot;
CELLSPACING=quot;0quot; border=quot;0quot;
align=quot;leftquot;gt;lt;trgt;lt;tdgt;lt;#47;tdgt;lt;#47;trgt;lt;#47;tablegt;
lt;brgt; Test lt;brgt;/description
descriptionTestlt;brgt;  -
/description
/item
item
title/title
link/link
descriptionlt;table CELLPADDING=quot;5quot;
CELLSPACING=quot;0quot; border=quot;0quot;
align=quot;leftquot;gt;lt;trgt;lt;tdgt;lt;#47;tdgt;lt;#47;trgt;lt;#47;tablegt;
lt;brgt; Testantwort lt;brgt;/description
descriptionTestantwortlt;brgt;  -
/description
/item
item
title/title
link/link
descriptionlt;table CELLPADDING=quot;5quot;
CELLSPACING=quot;0quot; border=quot;0quot;
align=quot;leftquot;gt;lt;trgt;lt;tdgt;lt;#47;tdgt;lt;#47;trgt;lt;#47;tablegt;
lt;brgt; xx lt;brgt;/description
descriptionxxlt;brgt;  -
/description
/item
item
title/title
link/link
descriptionlt;table CELLPADDING=quot;5quot;
CELLSPACING=quot;0quot; border=quot;0quot;
align=quot;leftquot;gt;lt;trgt;lt;tdgt;lt;#47;tdgt;lt;#47;trgt;lt;#47;tablegt;
lt;brgt; ]Test
erneuter Testlt;brgt;/description
description]Test
erneuter Test   lt;brgt;  -
/description
/item
item
title/title
link/link
descriptionlt;table CELLPADDING=quot;5quot;
CELLSPACING=quot;0quot; border=quot;0quot;
align=quot;leftquot;gt;lt;trgt;lt;tdgt;lt;#47;tdgt;lt;#47;trgt;lt;#47;tablegt;
lt;brgt; ]Test
erneuter 2. Test   lt;brgt;/description
description]Test
erneuter 2. Test  lt;brgt;  -
/description
/item
item
title/title
link/link
descriptionlt;table CELLPADDING=quot;5quot;
CELLSPACING=quot;0quot; border=quot;0quot;
align=quot;leftquot;gt;lt;trgt;lt;tdgt;lt;#47;tdgt;lt;#47;trgt;lt;#47;tablegt;
lt;brgt; ]Test
erneuter 2. Test   lt;brgt;/description
description]Test
erneuter 2. Test  lt;brgt;  -
/description
/item
item
title/title
link/link
descriptionlt;table CELLPADDING=quot;5quot;
CELLSPACING=quot;0quot; border=quot;0quot;
align=quot;leftquot;gt;lt;trgt;lt;tdgt;lt;#47;tdgt;lt;#47;trgt;lt;#47;tablegt;
lt;brgt; dfklödsfadfsjdkjsdafasdj lt;brgt;/description
descriptiondfklödsfadfsjdkjsdafasdjlt;brgt;  -
/description
/item
item
title/title
link/link
descriptionlt;table CELLPADDING=quot;5quot;
CELLSPACING=quot;0quot; border=quot;0quot;
align=quot;leftquot;gt;lt;trgt;lt;tdgt;lt;#47;tdgt;lt;#47;trgt;lt;#47;tablegt;
lt;brgt; ]dfklödsfadfsjdkjsdafasdj
 lt;brgt;/description
description]dfklödsfadfsjdkjsdafasdj
lt;brgt;  -
/description
/item
item
title/title
link/link
descriptionlt;table CELLPADDING=quot;5quot;
CELLSPACING=quot;0quot; border=quot;0quot;
align=quot;leftquot;gt;lt;trgt;lt;tdgt;lt;#47;tdgt;lt;#47;trgt;lt;#47;tablegt;
lt;brgt; ]dfklödsfadfsjdkjsdafasdj
 lt;brgt;/description
description]dfklödsfadfsjdkjsdafasdj
lt;brgt;  -
/description
/item
item
title/title
link/link
descriptionlt;table CELLPADDING=quot;5quot;
CELLSPACING=quot;0quot; border=quot;0quot;
align=quot;leftquot;gt;lt;trgt;lt;tdgt;lt;#47;tdgt;lt;#47;trgt;lt;#47;tablegt;
lt;brgt; ]dfklödsfadfsjdkjsdafasdj
 lt;brgt;/description
description]dfklödsfadfsjdkjsdafasdj
 

Re: [PHP-DB] Problem with rss-feed generation

2007-06-15 Thread Ruprecht Helms
Hi Niel,
 
 firefox tells me that it dislike the closing xml-tag.
 In my quanta-editor it seems that can be difficulties with the tagend of
 the opening xml-line of the second position of the questionmark.
 
 Because you missed the  space in front of it.
 
 You really need to find out more about XML and RSS specifications.  This
 isn't a PHP or Db problem so doesn't belong on this list.

Maybe I thought that someone of the member have worked with a dynamicly
rss-feed generator. I use some mysql-tables for content within the feed.

Du you know a good tutorial for XML and RSS, possible relating with PHP.

Regards,
Ruprecht

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with rss-feed generation

2007-06-15 Thread Niel Archer
Hi

 Du you know a good tutorial for XML and RSS, possible relating with PHP.

Not a tutorial, no.  I got my information from the specification
documents.

You should consider changing your method.  Instead of creating the
RSS/XMl file manually, try using one of the PHP extensions that will
generate XML for you, like the PEAR XML_Query2XML package which converts
SQL SELECT results into valid XML data. Or PECL's xmlwriter.


Niel

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with imagebuilding

2007-05-04 Thread bedul
  $hintergrund = $row_hintergrundsbild-Bildname;
  $backgroundimage = $hintergrund;

this is the problem whole about. u call img name but not img file..
fyi.. to build a img u must begin with this..
$im = imagecreatefrompng(test.png);

what u want to do??
plz explain
- Original Message -
From: Ruprecht Helms [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Friday, May 04, 2007 3:10 PM
Subject: [PHP-DB] Problem with imagebuilding


 Hi,

 I actually have a problem with a script that creates a picture from
 database content. I the following error:


 Warning: imagepng(): supplied argument is not a valid Image resource in
 /opt/lampp/htdocs/cycosmos_2/avatare/avatarbild.php on line 315

 The other lines that copy and resize other content for the imagebuilding
 I've remarked, because there produce errors too.

 Another script that produce the result that I want by working with
 hardcoded content works without no problems.


 Can someone tell me what can be wrong in the databasescript.


 The file  avatarbild.php contails the malefunction script.
 The file bild_komplettavatar.php contains an example with the correct
 output.

 Regards,
 Ruprecht

 ---
 Ruprecht Helms IT-Service  Softwaredevelopment
   allow your worktools be individual

 Web: http://www.rheyn.de







 --
 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] Problem with ocilogon

2007-02-16 Thread Brad Bonkoski

Dominik Helle wrote:

Hi,

I've a problem with php-oci and I hope anybody can help me. I want to 
connect with ocilogon to an Oracle Database. If i call my php-Script 
in the browser, this error message turn up:


Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed. 
There is something wrong with your system - please check that 
ORACLE_HOME is set and points to the right directory in...


That is very funny, because if i activate the file on the command line 
- the connect is possible and no error message turns up.


FYI: My System:  Ubunutu 6, Apache 2 and php 5-with-oci  Oracle 
Database 10g (10.1.0.2).


Thank you for helping.

Dominik


I'm assuming since you mention the apache, this is a web application...
It looks like the ORACLE_HOME path is not know by apache/PHP.  So, you 
might try stopping apache, and doing something like 'source 
/etc/profile' or wherever your ORACLE_HOME env variable is set, and then 
restarting apache and trying again...

HTH
-B

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with ocilogon

2007-02-16 Thread Dominik Helle

Brad Bonkoski schrieb:

Dominik Helle wrote:

Hi,

I've a problem with php-oci and I hope anybody can help me. I want to 
connect with ocilogon to an Oracle Database. If i call my php-Script 
in the browser, this error message turn up:


Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed. 
There is something wrong with your system - please check that 
ORACLE_HOME is set and points to the right directory in...


That is very funny, because if i activate the file on the command line 
- the connect is possible and no error message turns up.


FYI: My System:  Ubunutu 6, Apache 2 and php 5-with-oci  Oracle 
Database 10g (10.1.0.2).


Thank you for helping.

Dominik


I'm assuming since you mention the apache, this is a web application...
It looks like the ORACLE_HOME path is not know by apache/PHP.  So, you 
might try stopping apache, and doing something like 'source 
/etc/profile' or wherever your ORACLE_HOME env variable is set, and then 
restarting apache and trying again...

HTH
-B


Mhmmm I set this variables in the Apache - but it don't work :(

SetEnv ORACLE_HOME /xxx
SetEnv TNS_ADMIN /xxx
SetEnv LD_LIBRARY_PATH /xxx
SetEnv ORACLE_SID orcl10g
SetEnv NLS_LANG GERMAN_GERMANY.WE8ISO8859P1

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with ocilogon

2007-02-16 Thread roy . a . jones
Here are a couple of things I have done ...

1) Edit the apachectl script and set the variables there
2) Set the variables in your shell then start apache
3) use phpinfo() to display your settings (I also found the below php 
script to work well)

-
?php
phpinfo();
$a= ini_get_all();//Call ini_get_all()
$output=table border=1;   //Start an output string
  while(list($key, $value)=each($a))  //Loop through results
  {
list($k, $v)= each($a[$key]); //Access each array
$output.=trtd
$key
  /tdtd
$v
/tdtd
$k
  /td/tr;//Build output
  }//while
$output.=/table;  //Finish up
echo $output; //Spit it all out
?
-


Roy A. Jones 
US Distribution IT 
GlaxoSmithKline Inc. US Pharma IT, Financial Shared Services IT 
External:
(919) 483-0266
Internal:
703-0266
Fax:
(919) 315-4979
Office:
STH D-1228
Email:
[EMAIL PROTECTED]
Pager:
(919) 312-0729




Dominik Helle [EMAIL PROTECTED] 
16-Feb-2007 09:58
 
To
php-db@lists.php.net
cc

Subject
Re: [PHP-DB] Problem with ocilogon






Brad Bonkoski schrieb:
 Dominik Helle wrote:
 Hi,

 I've a problem with php-oci and I hope anybody can help me. I want to 
 connect with ocilogon to an Oracle Database. If i call my php-Script 
 in the browser, this error message turn up:

 Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed. 
 There is something wrong with your system - please check that 
 ORACLE_HOME is set and points to the right directory in...

 That is very funny, because if i activate the file on the command line 
 - the connect is possible and no error message turns up.

 FYI: My System:  Ubunutu 6, Apache 2 and php 5-with-oci  Oracle 
 Database 10g (10.1.0.2).

 Thank you for helping.

 Dominik

 I'm assuming since you mention the apache, this is a web application...
 It looks like the ORACLE_HOME path is not know by apache/PHP.  So, you 
 might try stopping apache, and doing something like 'source 
 /etc/profile' or wherever your ORACLE_HOME env variable is set, and then 

 restarting apache and trying again...
 HTH
 -B

Mhmmm I set this variables in the Apache - but it don't work :(

SetEnv ORACLE_HOME /xxx
SetEnv TNS_ADMIN /xxx
SetEnv LD_LIBRARY_PATH /xxx
SetEnv ORACLE_SID orcl10g
SetEnv NLS_LANG GERMAN_GERMANY.WE8ISO8859P1

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





Re: [PHP-DB] Problem with PHP 4.4.4 and MSSQL in Centos

2007-01-12 Thread Frank M. Kromann
Hi Claudio,

1) Check the version of FreeTDS on both systems.
2) Check the freetds.conf file for differences (use the sam TDS version)
3) Check that php is compiled using --with-mssql on both systems
(--with-sybase will give you aliases to some mssql_( functions but not
all)

- Frank

 Hi all!
 
 I've stepped into an annoying problem when trying to fetch the tuples 
 returned by a stored procedure in a MSSQL database from a PHP program 
 running in a Centos Linux server running PHP 4.4.4.
 
 The stored procedure returns an arbitrary number of tuples, and my code

 is only working when the SP returns one row.
 
 The code I'm using, simplified, follows:
 
$db_conn = mssql_connect (server, user, passwd);
mssql_select_db(db,$db_conn);
 
$query = Exec stored_procedure '$par1', '$par2';
$result = mssql_query ($query);
 
while ($row = mssql_fetch_array ($result)) {
echo $row[COL1];
echo br/;
}
 
 If stored_procedure () returns only one row, the code executes without 
 any problem. However, if there are more than one rows to be returned, 
 the program not only blocks, but also eats all the server's memory.
 
 I've run this program also in Ubuntu with PHP 4.4, and it works without

 any problem, so I'm thinking it may be either a configuration problem of

 the centos server, or a bug in the PHP version.
 
 Do you have any hint to solve this? I would appreciate any advice.
 
 Thanks in advance,
 
 Claudio
 
 -- 
 Claudio Saavedra [EMAIL PROTECTED]
 -
 La informacion contenida en esta transmision (y sus documentos 
 adjuntos), es confidencial y no puede ser usada o difundida por 
 personas distintas a su(s) destinatario(s). 
 El uso no autorizado de la informacion contenida en 
 esta transmision puede ser sancionado criminalmente de conformidad con 
 la ley chilena. Si ha recibido esta transmision por error, por favor 
 destruyala y notifique al remitente. Atendido que no existe 
 certidumbre que el presente mensaje no sera modificado como resultado 
 de su transmision por correo electronico, nuestra empresa, no sera 
 responsable si el contenido del mismo ha sido modificado.
 
 -- 
 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] Problem with PHP 4.4.4 and MSSQL in Centos

2007-01-12 Thread Claudio Saavedra
Hi Frank,

El vie, 12-01-2007 a las 10:49 -0800, Frank M. Kromann escribió:

 1) Check the version of FreeTDS on both systems.

It proved irrelevant. See above.

 2) Check the freetds.conf file for differences (use the sam TDS version)

No differences.

 3) Check that php is compiled using --with-mssql on both systems
 (--with-sybase will give you aliases to some mssql_( functions but not
 all)

I fixed it by compiling again php with --with-mssql instead of
--with-sybase. Now it works perfectly. Thanks for your suggestions.

Anyway, I wouldn't expect php to hang and kill my server if compiled
with --sybase. Maybe just a runtime error would be ok, but a hang like
that, it's a bug to me.

I would gladly report it, if I knew where should I. Do you think it may
be in freeTDS or PHP itself? I am not really into PHP internals.

Best regards,

Claudio

-- 
Claudio Saavedra [EMAIL PROTECTED]

-
La informacion contenida en esta transmision (y sus documentos 
adjuntos), es confidencial y no puede ser usada o difundida por 
personas distintas a su(s) destinatario(s). 
El uso no autorizado de la informacion contenida en 
esta transmision puede ser sancionado criminalmente de conformidad con 
la ley chilena. Si ha recibido esta transmision por error, por favor 
destruyala y notifique al remitente. Atendido que no existe 
certidumbre que el presente mensaje no sera modificado como resultado 
de su transmision por correo electronico, nuestra empresa, no sera 
responsable si el contenido del mismo ha sido modificado.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with PHP 4.4.4 and MSSQL in Centos

2007-01-12 Thread Frank M. Kromann
Hi Claudio,

bugs.php.net would be the place to report the bug. As both the MSSQL and
Sybase extensions are using the same FreeTDS library I would think the bug
is in the Sybase extension.

You will get more mssql_* functions with the MSSQL extension, and much
better support for storred procedures so I think you will be happy about
the change.

- Frank

 Hi Frank,
 
 El vie, 12-01-2007 a las 10:49 -0800, Frank M. Kromann escribió:
 
  1) Check the version of FreeTDS on both systems.
 
 It proved irrelevant. See above.
 
  2) Check the freetds.conf file for differences (use the sam TDS
version)
 
 No differences.
 
  3) Check that php is compiled using --with-mssql on both systems
  (--with-sybase will give you aliases to some mssql_( functions but
not
  all)
 
 I fixed it by compiling again php with --with-mssql instead of
 --with-sybase. Now it works perfectly. Thanks for your suggestions.
 
 Anyway, I wouldn't expect php to hang and kill my server if compiled
 with --sybase. Maybe just a runtime error would be ok, but a hang like
 that, it's a bug to me.
 
 I would gladly report it, if I knew where should I. Do you think it may
 be in freeTDS or PHP itself? I am not really into PHP internals.
 
 Best regards,
 
 Claudio
 
 -- 
 Claudio Saavedra [EMAIL PROTECTED]
 
 -
 La informacion contenida en esta transmision (y sus documentos 
 adjuntos), es confidencial y no puede ser usada o difundida por 
 personas distintas a su(s) destinatario(s). 
 El uso no autorizado de la informacion contenida en 
 esta transmision puede ser sancionado criminalmente de conformidad con 
 la ley chilena. Si ha recibido esta transmision por error, por favor 
 destruyala y notifique al remitente. Atendido que no existe 
 certidumbre que el presente mensaje no sera modificado como resultado 
 de su transmision por correo electronico, nuestra empresa, no sera 
 responsable si el contenido del mismo ha sido modificado.
 
 -- 
 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] Problem with executing Oracle query for creating procedure

2006-10-28 Thread Rosen

Christopher Jones [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 Rosen wrote:
 Hi,
 i have problem with PHP and Oracle database.
 I read with PHP script an sql files like this:


 create or replace procedure test_proc1(p1 IN number, p3 OUT number)

 as
 begin
 p3 := p1 + 10;

 end;



 And when I execute it I receive an error:
 Warning: ociexecute(): OCIStmtExecute: OCI_SUCCESS_WITH_INFO: ORA-24344: 
 success with compilation error in...
 And the procedue doesn't put in the database.


 When I edit the .sql file - all to be on 1 row - like this:
 create or replace procedure test_proc1(p1 IN number, p2 OUT number) as 
 begin p2 := p1 + 10; end;

 Then I have no problems.

 Can someone help me with this?

 Thanks in advance,
 Rosen



 Normally I'd use a tool such as SQL Developer or SQL*Plus to
 pre-create database resident things like tables and PL/SQL procedures.


Yes, but this is update system, i.e. - it will need to execute scripts from 
.sql files to many servers.
The procesures/functions must be wrapped with wrap.exe before executing. 
This is very important.


 However, back to your problem: use UNIX style end of line characters.
 Or build up the statement using PHP string concatenation.

How can I do this? Can you give me some example.
Thanks in advance,
Rosen


 Chris

 -- 
 Christopher Jones, Oracle
 Email: [EMAIL PROTECTED]Tel: +1 650 506 8630
 Blog:  http://blogs.oracle.com/opal/ 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with executing Oracle query for creating procedure

2006-10-27 Thread Christopher Jones


Rosen wrote:

Hi,
i have problem with PHP and Oracle database.
I read with PHP script an sql files like this:


create or replace procedure test_proc1(p1 IN number, p3 OUT number)

as
begin
p3 := p1 + 10;

end;



And when I execute it I receive an error:
Warning: ociexecute(): OCIStmtExecute: OCI_SUCCESS_WITH_INFO: ORA-24344: 
success with compilation error in...

And the procedue doesn't put in the database.


When I edit the .sql file - all to be on 1 row - like this:
create or replace procedure test_proc1(p1 IN number, p2 OUT number) as 
begin p2 := p1 + 10; end;


Then I have no problems.

Can someone help me with this?

Thanks in advance,
Rosen




Normally I'd use a tool such as SQL Developer or SQL*Plus to
pre-create database resident things like tables and PL/SQL procedures.

However, back to your problem: use UNIX style end of line characters.
Or build up the statement using PHP string concatenation.

Chris

--
Christopher Jones, Oracle
Email: [EMAIL PROTECTED]Tel: +1 650 506 8630
Blog:  http://blogs.oracle.com/opal/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with Oracle

2006-10-25 Thread Christopher Jones


[EMAIL PROTECTED] wrote:

In Oracle you would write: insert into pts (pid, txt) values (1,'502a');

But in PHP you are going to do the following:

$conn = oci_connect('scott','tiger','my_db');
$sql = insert into pts (pid, txt) values (1,'502a');
$cursor = oci_parse($conn, $sql);
if (! $cursor)
{ $err = oci_error($conn);
  print htmlentities($e['message']);
   exit;
}
$results = oci_execute($cursor);
oci_commit($conn);
oci_close($conn);



The statements:

  $results = oci_execute($cursor);
  oci_commit($conn);

do two commits.  Oci_execute() commits by default.  The message
to the database to perform the commit is piggybacked in the
execute call.  However the subsequent (unecessary in this case)
oci_commit() call requires an explicit round trip to the DB.

If you were doing multiple inserts you might do something like:

  $s = oci_parse($c, 'insert into ptab (pdata) values (:bv)');
  oci_bind_by_name($s, ':bv', $v, 20, SQLT_CHR);
  foreach ($a as $v) {
$r = oci_execute($s, OCI_DEFAULT);
  }
  oci_commit($c);

Or explore calling a PL/SQL block and do a bulk FORALL insert.
I'll blog about bulk FORALL in a few days.

Chris

--
Christopher Jones, Oracle
Email: [EMAIL PROTECTED]Tel: +1 650 506 8630
Blog:  http://blogs.oracle.com/opal/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with Oracle

2006-10-24 Thread roy . a . jones
In Oracle you would write: insert into pts (pid, txt) values (1,'502a');

But in PHP you are going to do the following:

$conn = oci_connect('scott','tiger','my_db');
$sql = insert into pts (pid, txt) values (1,'502a');
$cursor = oci_parse($conn, $sql);
if (! $cursor)
{ $err = oci_error($conn);
  print htmlentities($e['message']);
   exit;
}
$results = oci_execute($cursor);
oci_commit($conn);
oci_close($conn);

The difference is that in PHP it appends a command seperator during the 
parsing.  A simple thing is to remove the trailing comma from the parsed 
SQL or remove it from the file.

Roy A. Jones 




Rosen [EMAIL PROTECTED] 
23-Oct-2006 19:21
 
To
php-db@lists.php.net
cc

Subject
[PHP-DB] Problem with Oracle






Hi,
I have a problem with PHP and Oracle 10 Database.
I read sql script from file and execute it.
Files are something like this:

insert into pts (pid, txt) values (1,'502a');
insert into pts (pid, txt) values (2,'502b');
.

I receive a message: ORA-00911: invalid character
When I remove manually the ; from the end of every row and execute 
separate every command
everything is ok.
I have and script files fo creating procedures/functions and there in not 
a 
problem with ;.

Where is the problem ? Why can not be used ; as command separator from 
PHP 
?

Thanks in advance!
Rosen

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





RE: [PHP-DB] Problem with pg_fetch_array

2006-10-23 Thread Bastien Koert


show relevant code around the query and attempt to loop thru resultset

bastien


From: Vignesh M P N [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Problem with pg_fetch_array
Date: Mon, 23 Oct 2006 15:12:25 -0500

Hi



I am trying to display the rows from a database table in a grid.



I retrieved the results using pg_query() with a Select command. pg_query()
returns true.



But when I pass the results $rows to pg_fetch_array(), it returns false. I
even tried displaying the error, if any, using:



pg_fetch_array($rows) or die('fetch array failed: ' . pg_last_error());



I also tried pg_result_error(), but both didn't display error.



It just displays fetch array failed: , but it doesn't display any error.



When the pg_query() returns a result, I wonder why pg_fetch_array() is not
able to iterate through the rows.



I am new to this PHP database stuff, please help me in this.



Thanks

Vignesh.



_
Ready for the world's first international mobile film festival celebrating 
the creative potential of today's youth? Check out Mobile Jam Fest for your 
a chance to WIN $10,000! www.mobilejamfest.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with pg_fetch_array

2006-10-23 Thread Chris

Vignesh M P N wrote:

Hi

 


I am trying to display the rows from a database table in a grid.

 


I retrieved the results using pg_query() with a Select command. pg_query()
returns true.

 


But when I pass the results $rows to pg_fetch_array(), it returns false. I
even tried displaying the error, if any, using:


You return $result to pg_fetch_array not $rows.

$query = SELECT version();
$result = pg_query($query);
while($row = pg_fetch_array($result)) {
  print_r($row);
}

A shameless plug but: http://www.designmagick.com/article/10/

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with Oracle

2006-10-23 Thread Chris

Rosen wrote:

Hi,
I have a problem with PHP and Oracle 10 Database.
I read sql script from file and execute it.
Files are something like this:

insert into pts (pid, txt) values (1,'502a');
insert into pts (pid, txt) values (2,'502b');
.

I receive a message: ORA-00911: invalid character
When I remove manually the ; from the end of every row and execute 
separate every command

everything is ok.
I have and script files fo creating procedures/functions and there in not a 
problem with ;.


Then you're not showing us the exact content of the files or the code 
you're using to make this insert into your database.


What's the exact code you're using to go through the file and insert the 
data?


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with Oracle query

2006-10-13 Thread roy . a . jones
Try this ...

SELECT m.id
  ,m.text
  FROM main m
  ,recs r
  WHERE m.id = r.id
AND r.log like '%sometext%'
  ORDER BY m.id
/


Roy A. Jones 




Rick [EMAIL PROTECTED] 
13-Oct-2006 10:53
 
To
php-db@lists.php.net
cc

Subject
Re: [PHP-DB] Problem with Oracle query







Brad Bonkoski [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Rosen wrote:
 Hi,
 I have a problem with PHP and Oracle SQL query.
 I have 2 tables :

 Table Main:
 ---
 id number
 text varchar2(100)


 Table Recs
 ---
 id number
 pos number
 log varchar2(200)

 I need to make query to select a list from first table(Main), where 
 somewhere in the second table (Recs), the log field contains some 
string. 
 The records for one ID from Main table can be many in table Recs. ( 
Table 
 Recs acts as log for every row from table Main).

 Can someone help me with this query?

 Thanks in advance,
 Rosen

 select m.id, r.log from main m left outer join recs r on r.id = m.id

 This will output something like:
 Id   log
 1log item 1
 1log item 2
 1log item 3
 2another log
 etc...

Thanks, but I want to retrieve only one row for ID field (row from Main 
table)  where the string contains in second table.
Something like this:

ID   Text
1 Sometext 1
2 Sometext 2
6Sometext 3 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





Re: [PHP-DB] Problem with Oracle query

2006-10-13 Thread Rosen


[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Try this ...

 SELECT m.id
  ,m.text
  FROM main m
  ,recs r
  WHERE m.id = r.id
AND r.log like '%sometext%'
  ORDER BY m.id
 /

Thanks, but this retrieves me so much rows as many are the appearance the 
'sometext' in the Recs table








 Roy A. Jones




 Rick [EMAIL PROTECTED]
 13-Oct-2006 10:53

 To
 php-db@lists.php.net
 cc

 Subject
 Re: [PHP-DB] Problem with Oracle query







 Brad Bonkoski [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Rosen wrote:
 Hi,
 I have a problem with PHP and Oracle SQL query.
 I have 2 tables :

 Table Main:
 ---
 id number
 text varchar2(100)


 Table Recs
 ---
 id number
 pos number
 log varchar2(200)

 I need to make query to select a list from first table(Main), where
 somewhere in the second table (Recs), the log field contains some
 string.
 The records for one ID from Main table can be many in table Recs. (
 Table
 Recs acts as log for every row from table Main).

 Can someone help me with this query?

 Thanks in advance,
 Rosen

 select m.id, r.log from main m left outer join recs r on r.id = m.id

 This will output something like:
 Id   log
 1log item 1
 1log item 2
 1log item 3
 2another log
 etc...

 Thanks, but I want to retrieve only one row for ID field (row from Main
 table)  where the string contains in second table.
 Something like this:

 ID   Text
 1 Sometext 1
 2 Sometext 2
 6Sometext 3

 -- 
 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] Problem with Oracle query

2006-10-13 Thread roy . a . jones
When you say so much rows I am assuming you mean 1 row from MAIN for every 
row in RECS.  If that is true and you just want 1 MAIN row then I would 
add DISTINCT or EXISTS or IN ... 

SELECT DISTINCT
   m.id
  ,m.text
  FROM main m
  ,recs r
  WHERE m.id = r.id
AND r.log like '%sometext%'
  ORDER BY m.id
 /


Roy A. Jones 




Rosen [EMAIL PROTECTED] 
13-Oct-2006 11:09
 
To
php-db@lists.php.net
cc

Subject
Re: [PHP-DB] Problem with Oracle query








[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Try this ...

 SELECT m.id
  ,m.text
  FROM main m
  ,recs r
  WHERE m.id = r.id
AND r.log like '%sometext%'
  ORDER BY m.id
 /

Thanks, but this retrieves me so much rows as many are the appearance the 
'sometext' in the Recs table








 Roy A. Jones




 Rick [EMAIL PROTECTED]
 13-Oct-2006 10:53

 To
 php-db@lists.php.net
 cc

 Subject
 Re: [PHP-DB] Problem with Oracle query







 Brad Bonkoski [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Rosen wrote:
 Hi,
 I have a problem with PHP and Oracle SQL query.
 I have 2 tables :

 Table Main:
 ---
 id number
 text varchar2(100)


 Table Recs
 ---
 id number
 pos number
 log varchar2(200)

 I need to make query to select a list from first table(Main), where
 somewhere in the second table (Recs), the log field contains some
 string.
 The records for one ID from Main table can be many in table Recs. (
 Table
 Recs acts as log for every row from table Main).

 Can someone help me with this query?

 Thanks in advance,
 Rosen

 select m.id, r.log from main m left outer join recs r on r.id = m.id

 This will output something like:
 Id   log
 1log item 1
 1log item 2
 1log item 3
 2another log
 etc...

 Thanks, but I want to retrieve only one row for ID field (row from Main
 table)  where the string contains in second table.
 Something like this:

 ID   Text
 1 Sometext 1
 2 Sometext 2
 6Sometext 3

 -- 
 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] Problem with insert BLOB into Oracle

2006-10-05 Thread Vincent DUPONT
Hello
 you can not insert a lob this way.
Refer to the php manual pages at http://www.php.net/oci
And search for Example 3. Inserting data into a CLOB column

Vincent


-Original Message-
From: Rosen [mailto:[EMAIL PROTECTED] 
Sent: jeudi 5 octobre 2006 14:43
To: php-db@lists.php.net
Subject: [PHP-DB] Problem with insert BLOB into Oracle


Hi,
I have problem with inserting into BLOB field in Oracle 10:


insert into some_table(DESC) values ( '$txt')


The DESC field type is LONG RAW
The $txt variable contains large text, whitch is extracted from another
table field with same type.

When I read field DESC and print it, there is no problems, but when try
to insert I receive an error:Error: ORA-01465: invalid hex number

Can someone help ?

Thanks,
Rosen

--
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] problem with header()

2006-10-04 Thread Dimiter Ivanov

On 10/4/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi

I can not submit any header() information in the following context.
What is wrong within the code?

?php

require_once  includes/db.inc;
require_once HTML/Template/ITX.php;

if (!($connection = @ mysql_connect($hostname, $username, $password)))
   die(Could not connect to database);

$status = mysqlclean($_GET, status, 1, $connection);
$template = new HTML_Template_ITX(./templates);
$template-loadTemplatefile(form2tpl.tpl, true, true);


$template-setCurrentBlock(success);
$template-setVariable(AUTOR, $_REQUEST[autor_eb]);
$template-setVariable(STICHWORT, $_REQUEST[stichwort_eb]);
$template-setVariable(DATUM, $_REQUEST[datum_eb]);
$template-setVariable(ANLAGE, $_REQUEST[anlage_eb]);
$template-setVariable(PROBLEM, $_REQUEST[problem_eb]);
$template-parseCurrentBlock();
$template-show();


session_start();

foreach($_POST as $Key = $Value) {
$_SESSION[$Key] = $Value;
}

if ($_POST['submit'] == Eintrag Bearbeiten){
   header(Location: http://127.0.0.1/www2/knowledge_db/knowbase02.php;);
   exit;
}
?

Best regards, Joerg Kuehne


There must be NO output to the user, before any header(); calls.
1) Check the files you require() for any whitespaces before the ? tag
2) IF $template-show(); does what it says, you must start the session
before that call.
3) Good luck :)

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with list#2

2006-07-07 Thread tg-php
You may get duplicate messages sometimes when someone responds directly to you 
as well as copying the message to the main mailing list.  Like in this ccase, 
my To: field is the PHP DB list, and my CC: field is your personal email 
address.

If that's not the issue, then try what Dave suggested and unsubscribe using one 
of your email addresses and see if that solves the problem.

-TG

On 7/7/06, Karl James [EMAIL PROTECTED] wrote:

 Team,



 I am still receiving duplicate emails.

 I check with my ISP and they tell me it is

 Not their problem. I tried to check the headers

 But I am not able to see anything that indicates

 What email address its being sent to because

 I have two of them.



 Can anyone help suggest on how to resolve this.

 I would send a screen shot but its not advise to

 In forums. Off list I can for sure if any one wants

 To see what's going on.



 Karl James (TheSaint)
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]

 www.theufl.com


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with list#2

2006-07-07 Thread Jack Gates
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



Re: [PHP-DB] Problem with a login page.

2006-03-06 Thread dpgirago

snip...

// check passwords match

$_POST['password'] = stripslashes($_POST['password']);
$info['password'] = stripslashes($info['password']);
$_POST['password'] = $_POST['password'];

if ($_POST['password'] != $info['password']) {
die('Incorrect password, please try again.');
}
snip...

Alex,

Sticking for the moment with the error message you get, I can't see
anyplace where an array named $info with a key of password is declared
or assigned this value. Are you sure that this variable exists?

David

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Problem installing mssql extension

2006-01-25 Thread Jim McDonald
You still need to set the PHPRC system variable to c:\php5 (on the
System Properties menu, Advanced tab, click Environment Variables).
Also, PHP4 has an extensions directory.  PHP5 should point to

extension_dir = C:\PHP5\ext\

PLEASE NOTE that I disagree with Frank that the correct methodology is
to pollute system32 with all of your PHP DLLs.  This makes maintenance
harder.  All of my dll's live in the C:\php tree, so when I swap to the
next 5.1.x release, I don't have to go hunt down a bunch of random dll's
in system32.

When I tried to run only the mssql extension, I kept getting a php
startup error that it was Unable to load c:\php5\ext\php_mssql.dll.  I
knew that the file was there, why couldn't it be opened?  I researched
this (sorry, lost the link) and found that mssql extension has a
dependency on the mysql extension.  So then I was getting Unable to
load c:\php5\ext\php_mysql.dll.  That's when I learned that it's best
to set your PHPRC System Variable to load the required dll's directly
from the php5 directory tree, rather than copying them to system32.

This should be especially useful to you as you are running 5.1.2-dev, as
these dll's may change with the stable release.

-jim

-Original Message-
From: Andrew Kleimeyer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 24, 2006 11:21 PM
To: Bastien Koert
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Problem installing mssql extension

Yes.  My extensions directory is c:\php\extensions and I'm already
successfully running the mysql extension.

On 1/25/06, Bastien Koert [EMAIL PROTECTED] wrote:

 Have you added the path to the extensions in the path/dir section to 
 point to the extensions directory?

 ext_dir = c:\php5\ext;

 bastien


 From: Andrew Kleimeyer [EMAIL PROTECTED]
 To: php-db@lists.php.net
 Subject: [PHP-DB] Problem installing mssql extension
 Date: Wed, 25 Jan 2006 12:56:09 +0800
 
 I've read all the documentation, and tried every suggestion, but I'm
 still
 unable to run the mssql extension.  When I uncomment the line in 
 php.ini, PHP crashes.
 
 My system:
 Windows 2000
 IIS 5.0
 PHP Version 5.1.2-dev
 
 What I have tried:
 I've placed the ntwdblib.dll that came with php into the 
 winnt/system32/ directory.  Nothing.
 I've placed the ntwdblib.dll that is running on my mssql machine into

 winnt/system32/ directory on the php machine.  Nothing.
 I've copied the php_mssql.dll into the winnt/system32/ directory on 
 the
 php
 machine. Nothing.
 
 Any ideas would be greatly appreciated.




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Problem installing mssql extension

2006-01-25 Thread Frank M. Kromann
Hi Jim,

Using PHPRC is not needed on Win32. It's an option.

If you read my post again you will see that I did not say anything about
putting PHP dll's in system32. I was refering to ntwdblib.dll. This is not
a PHP dll, it's a Microsoft DLL that will be installed with the CLient
Tools.

I agree with you about keeping installations simple. I don't even use an
extension dir. Everything works nicly with all PHP files installed in
c:\php5 (c:\php4 and c:\php6).

Your research on MSSQL depending on MySQL is wrong. As the maintainer of
the MSSQL extension I know for sure that it depends only on dblib from
Microsoft.

- Frank
 You still need to set the PHPRC system variable to c:\php5 (on the
 System Properties menu, Advanced tab, click Environment Variables).
 Also, PHP4 has an extensions directory.  PHP5 should point to
 
 extension_dir = C:\PHP5\ext\
 
 PLEASE NOTE that I disagree with Frank that the correct methodology
is
 to pollute system32 with all of your PHP DLLs.  This makes maintenance
 harder.  All of my dll's live in the C:\php tree, so when I swap to the
 next 5.1.x release, I don't have to go hunt down a bunch of random
dll's
 in system32.
 
 When I tried to run only the mssql extension, I kept getting a php
 startup error that it was Unable to load c:\php5\ext\php_mssql.dll. 
I
 knew that the file was there, why couldn't it be opened?  I researched
 this (sorry, lost the link) and found that mssql extension has a
 dependency on the mysql extension.  So then I was getting Unable to
 load c:\php5\ext\php_mysql.dll.  That's when I learned that it's best
 to set your PHPRC System Variable to load the required dll's directly
 from the php5 directory tree, rather than copying them to system32.
 
 This should be especially useful to you as you are running 5.1.2-dev,
as
 these dll's may change with the stable release.
 
 -jim
 
 -Original Message-
 From: Andrew Kleimeyer [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 24, 2006 11:21 PM
 To: Bastien Koert
 Cc: php-db@lists.php.net
 Subject: Re: [PHP-DB] Problem installing mssql extension
 
 Yes.  My extensions directory is c:\php\extensions and I'm already
 successfully running the mysql extension.
 
 On 1/25/06, Bastien Koert [EMAIL PROTECTED] wrote:
 
  Have you added the path to the extensions in the path/dir section to 
  point to the extensions directory?
 
  ext_dir = c:\php5\ext;
 
  bastien
 
 
  From: Andrew Kleimeyer [EMAIL PROTECTED]
  To: php-db@lists.php.net
  Subject: [PHP-DB] Problem installing mssql extension
  Date: Wed, 25 Jan 2006 12:56:09 +0800
  
  I've read all the documentation, and tried every suggestion, but I'm
  still
  unable to run the mssql extension.  When I uncomment the line in 
  php.ini, PHP crashes.
  
  My system:
  Windows 2000
  IIS 5.0
  PHP Version 5.1.2-dev
  
  What I have tried:
  I've placed the ntwdblib.dll that came with php into the 
  winnt/system32/ directory.  Nothing.
  I've placed the ntwdblib.dll that is running on my mssql machine
into
 
  winnt/system32/ directory on the php machine.  Nothing.
  I've copied the php_mssql.dll into the winnt/system32/ directory on 
  the
  php
  machine. Nothing.
  
  Any ideas would be greatly appreciated.
 
 
 
 
 --
 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] Problem installing mssql extension

2006-01-25 Thread Andrew Kleimeyer
So I was able to get the extension working.  Here was my fix:

I replaced my php_mssql.dll file with a download from:
http://kromann.info/download.php?strFolder=php5_1-Release_TSstrIndex=PHP5_1

and everything worked perfectly.  Any ideas what the problem was with my
original php_mssql.dll file?

Thanks,
andrew


On 1/26/06, Frank M. Kromann [EMAIL PROTECTED] wrote:

 Hi Jim,

 Using PHPRC is not needed on Win32. It's an option.

 If you read my post again you will see that I did not say anything about
 putting PHP dll's in system32. I was refering to ntwdblib.dll. This is not
 a PHP dll, it's a Microsoft DLL that will be installed with the CLient
 Tools.

 I agree with you about keeping installations simple. I don't even use an
 extension dir. Everything works nicly with all PHP files installed in
 c:\php5 (c:\php4 and c:\php6).

 Your research on MSSQL depending on MySQL is wrong. As the maintainer of
 the MSSQL extension I know for sure that it depends only on dblib from
 Microsoft.

 - Frank
  You still need to set the PHPRC system variable to c:\php5 (on the
  System Properties menu, Advanced tab, click Environment Variables).
  Also, PHP4 has an extensions directory.  PHP5 should point to
 
  extension_dir = C:\PHP5\ext\
 
  PLEASE NOTE that I disagree with Frank that the correct methodology
 is
  to pollute system32 with all of your PHP DLLs.  This makes maintenance
  harder.  All of my dll's live in the C:\php tree, so when I swap to the
  next 5.1.x release, I don't have to go hunt down a bunch of random
 dll's
  in system32.
 
  When I tried to run only the mssql extension, I kept getting a php
  startup error that it was Unable to load c:\php5\ext\php_mssql.dll.
 I
  knew that the file was there, why couldn't it be opened?  I researched
  this (sorry, lost the link) and found that mssql extension has a
  dependency on the mysql extension.  So then I was getting Unable to
  load c:\php5\ext\php_mysql.dll.  That's when I learned that it's best
  to set your PHPRC System Variable to load the required dll's directly
  from the php5 directory tree, rather than copying them to system32.
 
  This should be especially useful to you as you are running 5.1.2-dev,
 as
  these dll's may change with the stable release.
 
  -jim
 
  -Original Message-
  From: Andrew Kleimeyer [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, January 24, 2006 11:21 PM
  To: Bastien Koert
  Cc: php-db@lists.php.net
  Subject: Re: [PHP-DB] Problem installing mssql extension
 
  Yes.  My extensions directory is c:\php\extensions and I'm already
  successfully running the mysql extension.
 
  On 1/25/06, Bastien Koert [EMAIL PROTECTED] wrote:
  
   Have you added the path to the extensions in the path/dir section to
   point to the extensions directory?
  
   ext_dir = c:\php5\ext;
  
   bastien
  
  
   From: Andrew Kleimeyer [EMAIL PROTECTED]
   To: php-db@lists.php.net
   Subject: [PHP-DB] Problem installing mssql extension
   Date: Wed, 25 Jan 2006 12:56:09 +0800
   
   I've read all the documentation, and tried every suggestion, but I'm
   still
   unable to run the mssql extension.  When I uncomment the line in
   php.ini, PHP crashes.
   
   My system:
   Windows 2000
   IIS 5.0
   PHP Version 5.1.2-dev
   
   What I have tried:
   I've placed the ntwdblib.dll that came with php into the
   winnt/system32/ directory.  Nothing.
   I've placed the ntwdblib.dll that is running on my mssql machine
 into
 
   winnt/system32/ directory on the php machine.  Nothing.
   I've copied the php_mssql.dll into the winnt/system32/ directory on
   the
   php
   machine. Nothing.
   
   Any ideas would be greatly appreciated.
  
  
  
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 






RE: [PHP-DB] Problem installing mssql extension

2006-01-24 Thread Bastien Koert
Have you added the path to the extensions in the path/dir section to point 
to the extensions directory?


ext_dir = c:\php5\ext;

bastien



From: Andrew Kleimeyer [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Problem installing mssql extension
Date: Wed, 25 Jan 2006 12:56:09 +0800

I've read all the documentation, and tried every suggestion, but I'm still
unable to run the mssql extension.  When I uncomment the line in php.ini,
PHP crashes.

My system:
Windows 2000
IIS 5.0
PHP Version 5.1.2-dev

What I have tried:
I've placed the ntwdblib.dll that came with php into the winnt/system32/
directory.  Nothing.
I've placed the ntwdblib.dll that is running on my mssql machine into
winnt/system32/ directory on the php machine.  Nothing.
I've copied the php_mssql.dll into the winnt/system32/ directory on the php
machine. Nothing.

Any ideas would be greatly appreciated.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem installing mssql extension

2006-01-24 Thread Andrew Kleimeyer
Yes.  My extensions directory is c:\php\extensions and I'm already
successfully running the mysql extension.

On 1/25/06, Bastien Koert [EMAIL PROTECTED] wrote:

 Have you added the path to the extensions in the path/dir section to point
 to the extensions directory?

 ext_dir = c:\php5\ext;

 bastien


 From: Andrew Kleimeyer [EMAIL PROTECTED]
 To: php-db@lists.php.net
 Subject: [PHP-DB] Problem installing mssql extension
 Date: Wed, 25 Jan 2006 12:56:09 +0800
 
 I've read all the documentation, and tried every suggestion, but I'm
 still
 unable to run the mssql extension.  When I uncomment the line in php.ini,
 PHP crashes.
 
 My system:
 Windows 2000
 IIS 5.0
 PHP Version 5.1.2-dev
 
 What I have tried:
 I've placed the ntwdblib.dll that came with php into the winnt/system32/
 directory.  Nothing.
 I've placed the ntwdblib.dll that is running on my mssql machine into
 winnt/system32/ directory on the php machine.  Nothing.
 I've copied the php_mssql.dll into the winnt/system32/ directory on the
 php
 machine. Nothing.
 
 Any ideas would be greatly appreciated.





Re: [PHP-DB] Problem with creating parallel connections with mysql_connect

2006-01-18 Thread David Robley
On Wed, 18 Jan 2006 19:51, Aarno Syvänen wrote:
 Hi List,

 decided to try non-permanent connections for  now. So now I have:

 ?

 /* db.php */
 $db_server=127.0.0.1;
 $db_user = asterisk;
 $db_pass = bozzo984;
 $db_db = bebbicell;

 $db_account_server=127.0.0.1;
 $db_account_user = asterisk;
 $db_account_pass = bozzo984;
 $db_account_db = asterisk;

 $allow_multiple = true;

 //$level= error_reporting ( 0);
 $bid=mysql_connect($db_server,$db_user,$db_pass, $allow_multiple);

echo mysql_error();

 //error_reporting ( $level);
 mysql_select_db($db_db,$bid);

echo mysql_error();


 //$level= error_reporting ( 0);
 $accid=mysql_connect($db_account_server,$db_account_user,

echo mysql_error();

 $db_account_pass, $allow_multiple);
 //error_reporting ( $level);
 mysql_select_db($db_account_db, $accid);

echo mysql_error();

 ?

 Still I have same error:

 Warning: mysql_query(): supplied argument is not a valid MySQL-Link
 resource in /var/www/bebbicell.ch/signup.php on line 212

 Warning: mysql_error(): supplied argument is not a valid MySQL-Link
 resource in /var/www/bebbicell.ch/signup.php on line 213

 Offending statements are:

 $res = mysql_query($sql,$accid);

echo mysql_error();

   $err = mysql_error($accid);

 Note that I use php-5.1.2RC1 compiled for Darwin Kernel Version 8.3.0
 and Macintosh powerpc

 Aarno

Try the above to find exactly where your problem is

Cheers
-- 
David Robley

If I had anything witty to say, I wouldn't put it here.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with creating parallel connections with mysql_connect

2006-01-18 Thread Aarno Syvänen

I go following debug:

got error  when doing first connection
resource id was Resource id #3
got error  when selecting first database
got error  when doing second connection
resource id was Resource id #4
got error  when selecting second database

the code was:

$bid=mysql_connect($db_server,$db_user,$db_pass, $allow_multiple);
//error_reporting ( $level);
print got error  . mysql_error() .  when doing first connection\n;
print resource id was $bid\n;
mysql_select_db($db_db,$bid);
print got error  . mysql_error() .  when selecting first database 
\n;

//$level= error_reporting ( 0);
$accid=mysql_connect($db_account_server,$db_account_user, 
$db_account_pass, $allow_multiple);
print got error  . mysql_error() .  when doing second connection 
\n;

print resource id was $accid\n;
//error_reporting ( $level);
mysql_select_db($db_account_db, $accid);
print got error  . mysql_error() .  when selecting second  
database\n;


So resource ids seem to be proper, and there is no errors either.

Signup.php already tests $err:

$err = mysql_error($accid);
if($err==)
{
echo (BRBRp.lfunc 
(signup_successful).BRBR/p);

}
else
{
echo $err;
}

It branches to $err==, when at same time reporting
Warning: mysql_error(): supplied argument is not a valid MySQL-Link  
resource in /var/www/bebbicell.ch/signup.php on line 213


This looks really strange.

Aarno

On 18 Jan 2006, at 11:14, David Robley wrote:


On Wed, 18 Jan 2006 19:51, Aarno Syvänen wrote:

Hi List,

decided to try non-permanent connections for  now. So now I have:

?

/* db.php */
$db_server=127.0.0.1;
$db_user = asterisk;
$db_pass = bozzo984;
$db_db = bebbicell;

$db_account_server=127.0.0.1;
$db_account_user = asterisk;
$db_account_pass = bozzo984;
$db_account_db = asterisk;

$allow_multiple = true;

//$level= error_reporting ( 0);
$bid=mysql_connect($db_server,$db_user,$db_pass, $allow_multiple);


echo mysql_error();


//error_reporting ( $level);
mysql_select_db($db_db,$bid);


echo mysql_error();



//$level= error_reporting ( 0);
$accid=mysql_connect($db_account_server,$db_account_user,


echo mysql_error();


$db_account_pass, $allow_multiple);
//error_reporting ( $level);
mysql_select_db($db_account_db, $accid);


echo mysql_error();


?

Still I have same error:

Warning: mysql_query(): supplied argument is not a valid MySQL-Link
resource in /var/www/bebbicell.ch/signup.php on line 212

Warning: mysql_error(): supplied argument is not a valid MySQL-Link
resource in /var/www/bebbicell.ch/signup.php on line 213

Offending statements are:

$res = mysql_query($sql,$accid);


echo mysql_error();


  $err = mysql_error($accid);

Note that I use php-5.1.2RC1 compiled for Darwin Kernel Version 8.3.0
and Macintosh powerpc

Aarno


Try the above to find exactly where your problem is

Cheers
--
David Robley

If I had anything witty to say, I wouldn't put it here.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






  1   2   3   4   >