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 "session"; //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 mision

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 ...



gives you a better clue?


On 23 June 2013 23:06, Ethan Rosenberg, PhD  wrote:

>
>
>
>
> On 23 June 2013 21:37, Ethan Rosenberg, PhD  *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 "session"; //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 wkith Query

2013-06-23 Thread Ethan Rosenberg, PhD





On 23 June 2013 21:37, Ethan Rosenberg, PhD 
 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 "session"; //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 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 "session"; //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 "Current Results";
> echo "";
> echo " frame='box'>";
> echo "";
> echo "Balance";
> echo "Payments";
> echo "Charges";
> echo "Date";
> echo "";
> echo "row1";
>

$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


[PHP-DB] Problem with query

2013-06-23 Thread Ethan Rosenberg, PhD

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 "session"; //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 "Current Results";
echo "";
echo "";
echo "";
echo "Balance";
echo "Payments";
echo "Charges";
echo "Date";
echo "";
echo "row1";
print_r($row10);
do
{
?>

  
  
  
  






This works:

$sql1 = "select Balance, Payments, Charges, Date from Charges where
Cust_Num = $_POST[cnum] order by Date";
$result1 = mysqli_query($cxn, $sql1);
echo "";
Current Results";
echo "";
echo "";
echo "";
echo "Balance";
echo "Payments";
echo "Charges";
echo "Date";
echo "";
// echo "";
$row1 = mysqli_fetch_row($result1);
print_r($row1);
do
{
?>

  
  
  
  






TIA

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 <eth...@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."

>
> 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 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 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 <eth...@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."



>
> 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 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

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 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."
>>
>> 
>>
>> >
>> > 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: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."


>
> 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

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 wrote:

> 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
>
>


[PHP-DB] Problem w/query - again

2012-02-09 Thread Ethan Rosenberg

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 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-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  a écrit :
> 
> > On Mon, Nov 28, 2011 at 9:19 PM, Phil Dobbin   
> > wrote:
> >> On 29/11/11 02:08, "Jason Pruim"  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 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 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" 
wrote:

> Jason Pruim  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 Tamara Temple
Jason Pruim  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-28 Thread Amos Jean-Baptiste



Le 2011-11-28 à 22:38, Bastien Koert  a écrit :

On Mon, Nov 28, 2011 at 9:19 PM, Phil Dobbin   
wrote:

On 29/11/11 02:08, "Jason Pruim"  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 with mysql and php

2011-11-28 Thread Bastien Koert
On Mon, Nov 28, 2011 at 9:19 PM, Phil Dobbin  wrote:
> On 29/11/11 02:08, "Jason Pruim"  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 Phil Dobbin
On 29/11/11 02:08, "Jason Pruim"  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 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"  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 01:38, "Jason Pruim"  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



[PHP-DB] Problem with mysql and php

2011-11-28 Thread Jason Pruim
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? :)


Jason Pruim
li...@pruimphotography.com





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  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 :
> >
> >  > $db = new MySQLi('localhost', 'root', 'Password123', 'test');
> > $sql = 'SELECT * FROM a123';
> > $result = $db->query($sql);
> >
> > while($row = $result->fetch_object()) {
> > echo '' . $row->name . '';
> > }
> >
> > $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-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 :
> 
>  $db = new MySQLi('localhost', 'root', 'Password123', 'test');
> $sql = 'SELECT * FROM a123';
> $result = $db->query($sql);
> 
> while($row = $result->fetch_object()) {
> echo '' . $row->name . '';
> }
> 
> $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-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:
>  $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  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 :
>> >
>> > > > $db = new MySQLi('localhost', 'root', 'Password123', 'test');
>> > $sql = 'SELECT * FROM a123';
>> > $result = $db->query($sql);
>> >
>> > while($row = $result->fetch_object()) {
>> >     echo '' . $row->name . '';
>> > }
>> >
>> > $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 in connecting to mysql from php

2011-06-13 Thread C0mf0rtably Numb
Okay. I tried using that too. If I run this:


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  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 :
> >
> >  > $db = new MySQLi('localhost', 'root', 'Password123', 'test');
> > $sql = 'SELECT * FROM a123';
> > $result = $db->query($sql);
> >
> > while($row = $result->fetch_object()) {
> > echo '' . $row->name . '';
> > }
> >
> > $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 mrfroasty
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 :
>
>  $db = new MySQLi('localhost', 'root', 'Password123', 'test');
> $sql = 'SELECT * FROM a123';
> $result = $db->query($sql);
>
> while($row = $result->fetch_object()) {
> echo '' . $row->name . '';
> }
>
> $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




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



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

2011-06-13 Thread C0mf0rtably Numb
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 :

query($sql);

while($row = $result->fetch_object()) {
echo '' . $row->name . '';
}

$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


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



[PHP-DB] Problem with pg_prepare - PostgresSQL

2010-04-23 Thread Giancarlo Boaron
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...

I already checked my configuration files and I have no more
ideas about how to fix it.

Any suggestions?

Thank you.





--
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 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 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



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

2009-03-19 Thread Thomas Robitaille

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

--
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 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 wrote:

> 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
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 
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 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 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  
 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



[PHP-DB] Problem with PDO exceptions

2009-03-07 Thread Daniel Carrera

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-DB] problem oci_connect solved..thanks to those involved

2008-11-21 Thread Fred Silsbee
I would have had no problem if I had:

(1) used ZEND
(2) installed php, apache, oracle XE, oci8,instant client

I installed 11g1 Enterprise and that already had a client.

Fedora already had php 5 and apache 2

FINALLY: The following works in the browser.

hr/hr is automatically built in the 11g1 database

';
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
print '';
foreach ($row as $item) {
print ''.
($item ? htmlentities($item) : ' ').'';
}
print '';
}
print '';
}

?>

What did I do:

in the file /etc/rc.d/init.d/httpd

I inserted statements starting with export position indicated by the 
surrounding code.

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
# new statements here
export ORACLE_HOSTNAME=localhost.localdomain
export TNS_ADMIN=/u01/app/oracle/product/11.1.0/db_1/network/admin
export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export ORACLE_SID=LMKIIIGDNSID
export LD_LIBRARY_PATH /u01/app/oracle/product/11.1.0/db_1/lib:/lib:/usr/lib

# new statements above

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
$RETVAL = 0 && touch ${lockfile}
return $RETVAL
}

I had put similar statements in /etc/httpd/conf/httpd.conf (setenv). I will 
remove these statements (and see if it still works!)

It stopped working...so:

into /etc/httpd/conf/httpd.conf I had to add:
### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

SetEnv ORACLE_HOSTNAME localhost.localdomain
SetEnv TNS_ADMIN /u01/app/oracle/product/11.1.0/db_1/network/admin
SetEnv ORACLE_BASE /u01/app/oracle
SetEnv ORACLE_HOME /u01/app/oracle/product/11.1.0/db_1
SetEnv ORACLE_SID lmkiiiGDNSID
SetEnv ORACLE_TERM xterm
SetEnv LD_LIBRARY_PATH /u01/app/oracle/product/11.1.0/db_1/lib:/lib:/usr/lib

#
# Don't give away too much information about all the subcomponents
# we are running. Comment out this line if you don't mind remote sites
# finding out what major optional modules you are running
ServerTokens OS

Just noticed: PS!

in /etc/phi.ini I have: (tomorrow I'll see if it still works without this)

237 ; Note: If this directive is empty, PHP will let the user modify ANY
238 ; environment variable!
239 ; safe_mode_allowed_env_vars = PHP_
240
241 ORACLE_HOSTNAME="localhost.localdomain"
242 ORACLE_BASE="/u01/app/oracle"
243 ORACLE_HOME="/u01/app/oracle/product/11.1.0/db_1"
244 ORACLE_SID="lmkiiiGDNSID"
245 LD_LIBRARY_PATH="/u01/app/oracle/product/11.1.0/db_1/lib:/lib:/usr/lib"
246 TNS_ADMIN="/u01/app/oracle/product/11.1.0/db_1/network/admin"
247


  


-- 
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 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 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 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 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 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=1&start=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 = "\n";
>> > $this->body .= "\t> > onchange=\"jumpPage(this.form.newLocation)\">\n";
>> > foreach ( $this->items as $item )
>> > {
>> > $this->body .="\t\t";
>> > $this->body .= $item[desc];
>> > $this->body .="\n";
>> > }
>> >
>> > $this->body .= "\t\n\n";
>> >
>> > $this->head = "\n";
>> > $this->head .= "\n";
>> > $this->head .= "\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.
>> >> >
>> >> >

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=1&start=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 = "\n";
> > $this->body .= "\t > onchange=\"jumpPage(this.form.newLocation)\">\n";
> > foreach ( $this->items as $item )
> > {
> > $this->body .="\t\t";
> > $this->body .= $item[desc];
> > $this->body .="\n";
> > }
> >
> > $this->body .= "\t\n\n";
> >
> > $this->head = "\n";
> > $this->head .= "\n";
> > $this->head .= "\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 yo

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=1&start=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 = "\n";
> $this->body .= "\t onchange=\"jumpPage(this.form.newLocation)\">\n";
> foreach ( $this->items as $item )
> {
> $this->body .="\t\t";
> $this->body .= $item[desc];
> $this->body .="\n";
> }
>
> $this->body .= "\t\n\n";
>
> $this->head = "\n";
> $this->head .= "\n";
> $this->head .= "\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://ww

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=1&start=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 = "\n";
> $this->body .= "\t onchange=\"jumpPage(this.form.newLocation)\">\n";
> foreach ( $this->items as $item )
> {
> $this->body .="\t\t";
> $this->body .= $item[desc];
> $this->body .="\n";
> }
>
> $this->body .= "\t\n\n";
>
> $this->head = "\n";
> $this->head .= "\n";
> $this->head .= "\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. Afte

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=1&start=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 = "\n";
$this->body .= "\t\n";
foreach ( $this->items as $item )
{
$this->body .="\t\t";
$this->body .= $item[desc];
$this->body .="\n";
}

$this->body .= "\t\n\n";

$this->head = "\n";
$this->head .= "\n";
$this->head .= "\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 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=1&start=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 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 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 = "\n";
// For each row in the results print the region
while( $row = $db->getrow() )
{
$h.="\t\tname\">$row->name\n";
}
$h.="\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 "Select developers based on region.";
print "";
DropNav::renderBody();
print "";
}
}

// 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 "Select developers based on Speciality.";
print "";
DropNav::renderBody();
print "";
}
}

// 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 "Hey, you! You forgot to define a query in my subclass:
Yours ProfileList";
$q = $this->query;
$q = $q." LIMIT $start, $count ";
// print "Query: $q";
$db->runquery( $q );
$this->lastcount = $db->numrows;
if ( $db->numrows > 0 )
{
$this->setView();

// Loop through each designer in the database query results.
while( $row = $db->g

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 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



[PHP-DB] Problem after moving servers

2008-08-31 Thread Gav
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...


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

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

Only if your doctype is XHTML, in which case you should also close
every tag, including the input tag. If your doctype is HTML your code
is fine. I use the HTML validator plug in for FireFox to check if my
code is valid.

-- 
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:  to  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 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:  to 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 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:


Hello {$var1}!
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  






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:






?>


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 .


It is a index.php page using the HEREDOC syntax... so basically:
echo <

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:
>>
>>> >>
>>> 
>>> 
>>> 
>>>
>>> ?>
>>
>> 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 .
>
> It is a index.php page using the HEREDOC syntax... so basically:
> echo < 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:24 PM, Evert Lammerts wrote:


Your index.php looks very strange:






?>


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 .


It is a index.php page using the HEREDOC syntax... so basically:
echo <

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 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:




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 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

First Name/Last Name 
Email Address 
Company name 
Company Address 
City/State/Zip
Phone 
Your Favorite Type of coffee:  
value="Other"> Other: size="20">

When would a good time to bring it over be? 



   

?>

purlprocessing.php



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


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

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

Thanks for looking!



--

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









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




--

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 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 Evert Lammerts
Your index.php looks very strange:

> 
> 
> 
> 
>
> ?>

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 .

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 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

First Name/Last Name 
Email Address 
Company name 
Company Address 
City/State/Zip   
Phone 
Your Favorite Type of coffee:
 Other: 
When would a good time to bring it over be? 



 

?>

purlprocessing.php



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


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

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

Thanks for looking!



--

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









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



[PHP-DB] Problem with updating MySQL table

2008-08-27 Thread Jason Pruim

Hi Everyone,

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


index.php

	First Name/Last Namevalue="{$row['FName']}" $edit> value="{$row['LName']}" $edit>
	Email Address value="{$row['email']}" $edit>
	Company name value="{$row['Business']}" $edit>
	Company Address value="{$row['Address1']}" $edit>
	City/State/Zip value="{$row['City']}" $edit> value="{$row['State']}" $edit> value="{$row['Zip']}" $edit>	
	Phone $edit>
	Your Favorite Type of coffee: value="Starbucks">   
 	 value="Other"> Other: 
	When would a good time to bring it over be? name="txtMeeting">




   

?>

purlprocessing.php

	$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]






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

2008-04-30 Thread Chris
H Thirividi wrote:
> 
> 
> 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.

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 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-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



[PHP-DB]problem in creating the ibm_db2 extension

2008-04-29 Thread H Thirividi
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

and I get  the above error

Any help would be of great help.Thanks in advance

With Regards,
harsha


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

2008-04-02 Thread cfs
The mssql driver uses a dll that has a limitation on varchar fields of 255 
characters. And the 30 chracter column name limit. And after SQL 2005, may 
not be supported at all.

So that alt has been tried, and then adandoned.

""Jon L."" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> (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:
>>
>> > $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
>>
>>
> 



-- 
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:
>
>  $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
>
>


[PHP-DB] Problem when using SQL_CUR_USE_ODBC on connect

2008-03-31 Thread cfs
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 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



[PHP-DB] problem in recorset that seems temporary

2008-01-25 Thread Ruprecht Helms
Hi,

I have a problem that confuse me a little bit. When I want to delete a
picture by giving the id-value in the URL I get the following error:

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL
result resource in
/opt/lampp/htdocs/pferdeservice_karle/galerie_delete.php on line 81


On clicking the relodebutton on the browser I get no error and the
deletion of the recordset seems to be not executed. When I don't reload
the page and change to view the pictureresults the recordset have been
deleted. But I don't know why I get the warning-message.

Attached the code.

Regards,
Ruprecht
http://www.rheyn.de




http://www.w3.org/TR/html4/loose.dtd";>



  
  
  


a:link { color:#FF;
font-family:Arial,Helvetica,Verdana,Sans-serif;font-size:9pt;
font-weight:bold;text-decoration:none;}
a:visited { color:#CC340A;
font-family:Arial,Helvetica,Verdana,Sans-serif;font-size:9pt;
font-weight:bold;text-decoration:none;}
a:active { color:#FFCC00;
font-family:Arial,Helvetica,Verdana,Sans-serif;font-size:9pt;
font-style:italic; font-weight:bold;text-decoration:none;}
a:hover { color:#FF9900;
font-family:Arial,Helvetica,Verdana,Sans-serif;font-size:9pt;
font-weight:bold;text-decoration:none;}
td { color:#00; font-family:Arial,Helvetica,Verdana,Sans-serif;
font-size:9pt;font-weight:plain;}
h2 { color:#00; font-family:,Helvetica,Verdana,Sans-serif;
font-size:12pt; font-weight:bold;}
h4 { color:#FF; font-family:Arial,Helvetica,Verdana,Sans-serif;
font-size:10pt; line-height:12pt; font-weight:bold;}
h1 {
color:#44;
margin-top:1em;
font-size: 1.4em;
font-weight: bold;
}
body{
text-align:center;
background-color:#F0F0F0;
font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size:0.78em;
}



  

  



  

  Bildergalerie
Galeriebilder zeigen
Galeriebild hinzufügen
Galeriebild aktualisieren



  Quicklinks
Springpferde
Dressurpferde
FAQ




  News
News zeigen
News hinzufügen
News bearbeiten
News löschen


  







  
Galerie löschen
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

- 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
/?id=. 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: http://www.rheyn.de>Ruprecht Helms IT-Service &
Softwareentwicklung, Loerrach

  


--
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 santosh

Try this code
$id=$_REQUEST['id'];
echo $id;

I find it working well.



Santosh


- Original Message - 
From: "Ruprecht Helms" <[EMAIL PROTECTED]>

To: 
Sent: Monday, August 06, 2007 2:52 PM
Subject: [PHP-DB] Problem with reading out value from urlline



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
/?id=. 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: http://www.rheyn.de>Ruprecht Helms IT-Service &
Softwareentwicklung, Loerrach

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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.11.4/935 - Release Date: 8/3/2007 
5:46 PM





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



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

2007-08-06 Thread Ruprecht Helms
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
/?id=. 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: http://www.rheyn.de>Ruprecht Helms IT-Service &
Softwareentwicklung, Loerrach

-- 
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 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 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



[PHP-DB] Problem with passing variable to mssql

2007-06-28 Thread William Curry
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??
 
 
Bill Curry
METCAD
217-333-4398


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

> 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 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

> 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.

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 > 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
 
http://my.netscape.com/publish/formats/rss-0.91.dtd";>


(RSS 2.0)
http://www.bla.com/
Die neuesten Artikel in Bla-Bereich ; 
de
Ruprecht Helms [EMAIL PROTECTED]
Ruprecht Helms [EMAIL PROTECTED]




dsklfdsafdsajfasdf
dsklfdsafdsajfasdf
-

Test
Test
-

Testantwort
Testantwort
-

xx
xx
-

]Test erneuter Test
]Test erneuter Test
-

]Test erneuter 2. Test
]Test erneuter 2. Test
-

]Test erneuter 2. Test
]Test erneuter 2. Test
-

dfklödsfadfsjdkjsdafasdj
dfklödsfadfsjdkjsdafasdj
-

]dfklödsfadfsjdkjsdafasdj
]dfklödsfadfsjdkjsdafasdj
-

]dfklödsfadfsjdkjsdafasdj
]dfklödsfadfsjdkjsdafasdj
-

]dfklödsfadfsjdkjsdafasdj
]dfklödsfadfsjdkjsdafasdj
-

]dfklödsfadfsjdkjsdafasdj
]dfklödsfadfsjdkjsdafasdj
-

dsklfdsafdsajfasdf
dsklfdsafdsajfasdf
-

Test
Test
-

Testantwort
Testantwort
-

xx
xx
-

]Test erneuter Test
]Test erneuter Test
-

]Test erneuter 2. Test
]Test erneuter 2. Test
-

]Test erneuter 2. Test
]Test erneuter 2. Test
-

dfklödsfadfsjdkjsdafasdj
dfklödsfadfsjdkjsdafa

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

2007-06-15 Thread Niel Archer
Hi

> ok by beginning the php-code with  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
> 
> the first line is badly formed
> 
> 
> 
> Should be:
> 
> 

ok by beginning the php-code with 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

the first line is badly formed



Should be:




Niel

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



[PHP-DB] Problem with rss-feed generation

2007-06-15 Thread Ruprecht Helms
Hi,

I've a problem in creating a xml-file for a dynamic rss-feed.
When I try to read the feed in my feedreader RSSowl I get an
errormessage that the xml was not formated properly

The feed should present boardentries in a short description.
Because there are much articles the feed should show that as seperate
postings like other feeds do it also.

Together with the xml-file I think that someone can give me support
how to fix the problem so I can try to read the feed in RSSowl for testing.

Regards,
Ruprecht

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

Web: http://www.rheyn.de


rss-feed-test3.php
Description: application/php
 http://my.netscape.com/publish/formats/rss-0.91.dtd";>


(RSS 2.0)
http://www.xing.com/
Die neuesten Artikel in Bla-Bereich ; 
de
Ruprecht Helms [EMAIL PROTECTED]
Ruprecht Helms [EMAIL PROTECTED]




dsklfdsafdsajfasdf
dsklfdsafdsajfasdf
-

Test
Test
-

Testantwort
Testantwort
-

xx
xx
-

]Test erneuter Test
]Test erneuter Test
-

]Test erneuter 2. Test
]Test erneuter 2. Test
-

]Test erneuter 2. Test
]Test erneuter 2. Test
-

dfklödsfadfsjdkjsdafasdj
dfklödsfadfsjdkjsdafasdj
-

]dfklödsfadfsjdkjsdafasdj
]dfklödsfadfsjdkjsdafasdj
-

]dfklödsfadfsjdkjsdafasdj
]dfklödsfadfsjdkjsdafasdj
-

]dfklödsfadfsjdkjsdafasdj
]dfklödsfadfsjdkjsdafasdj
-

]dfklödsfadfsjdkjsdafasdj
]dfklödsfadfsjdkjsdafasdj
-

dsklfdsafdsajfasdf
dsklfdsafdsajfasdf
-

Test
Test
-

Testantwort
Testantwort
-

xx
xx
-

]Test erneuter Test
]Test erneuter Test
-

]Test erneuter 2. Test
]Test erneuter 2. Test
-

]Test erneuter 2. Test
]Test erneuter 2. Test
-

Re: [PHP-DB] Problem with imagebuilding

  $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: 
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



[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


avatarbild.php
Description: application/php


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

[PHP-DB] Problem with Opera 9.0

Hello Everyone,



Iam having a strange problem with Opera 9.0.

I have a website where user can login to their admin panel. My site is working 
fine in all the browser but when i use Opera 9.0 and enter the username and 
password and click on submit, it niether goes to process page nor show me any 
error message, it just keep loading the page for hours...



Please Suggest.





Best Regards,
Imran Khan

Re: [PHP-DB] Problem with ocilogon

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)

<->
";   //Start an output string
  while(list($key, $value)=each($a))  //Loop through results
  {
list($k, $v)= each($a[$key]); //Access each array
$output.="
$key
  
$v

$k
  ";//Build output
  }//while
$output.="";  //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 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 ocilogon


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



[PHP-DB] Problem with ocilogon


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

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



  1   2   3   4   5   6   7   >