[PHP-DB] Re: finding out if a user left our website ?

2010-08-27 Thread Martin Zvarík

Dne 25.8.2010 22:32, Vinay Kannan napsal(a):

Hello Guys,

Wanted to know if there is a way for us to find out, when a user moves away
from our website( closing the window and entering a different url in the
address bar )

closing the window i guess, we could use the javascript onclose or something
similar but for the user moving away from my website by entering a different
URL is what i would like to be able to find out.

Thanks,
Vinay



Hi,
you can use: window.onunload function()

In this function you can add an AJAX that sends a server request that 
the user left.


I used it for administration and it worked in 80% of cases - sometimes 
the request is just not sent.



Martin

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



[PHP-DB] Re: Dynamic Prepared Statements

2009-07-24 Thread Martin Kuckert

  Warning*: call_user_func_array()

[function.call-user-func-arrayhttp://localhost/mbpa/function.call-user-func-array]:
First argument is expected to be a valid callback, 'Array' was given in *
C:\xampp\htdocs\mbpa\classes\db.php* on line *45*

*Fatal error*: Call to a member function execute() on a non-object in *
C:\xampp\htdocs\mbpa\classes\db.php* on line *47*


Your $stmt var is no object. Seems like the prepare call returned no 
mysqli_stmt object but false. Check that with var_dump and the error 
property of the mysqli object.


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



[PHP-DB] Re: How to fix config mysql?

2009-07-24 Thread Martin Kuckert
 I have uncommented php_mysql.dll and set the right ext_dir in the php.ini,
 and made certain that the actural dll does in the ext_dir,

You propably got the wrong php.ini. Under windows are severals of them.
Take that one mentioned in the apache configurations or that one in the
bin directory of the apache if there is no setting in the configs.

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



[PHP-DB] MySQL - LIMIT 1 on primary KEY - makes sense?

2009-06-03 Thread Martin Zvarík

SELECT * FROM xxx WHERE primary_id=123 LIMIT 1

Is it useless (LIMIT 1) ?

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



Re: [PHP-DB] MySQL - LIMIT 1 on primary KEY - makes sense?

2009-06-03 Thread Martin Zvarík

 Bastien Koert napsal(a):

2009/6/3 Martin Zvarík mzva...@gmail.com:
  

SELECT * FROM xxx WHERE primary_id=123 LIMIT 1

Is it useless (LIMIT 1) ?

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


It doesn't do anything...you are already returning just the one row
since there can only be one primary key record
  
I know, but I thought it might have had a little performance + for the 
MySQL... but I guess not.


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



[PHP-DB] SQL for counting comments - is this smart?

2009-03-16 Thread Martin Zvarík

Is it smart to use all of this on one page?
Or should I rather do one SQL and let PHP count it?


$q = $DB-q(SELECT COUNT(*) FROM comments);
$int_total = $DB-frow($q);

$q = $DB-q(SELECT COUNT(*) FROM comments WHERE approved IS NULL);
$int_waiting = $DB-frow($q);

$q = $DB-q(SELECT COUNT(*) FROM comments WHERE approved=0);
$int_deleted = $DB-frow($q);

$q = $DB-q(SELECT COUNT(*) FROM comments WHERE approved=1);
$int_approved = $DB-frow($q);

$q = $DB-q(SELECT COUNT(*) FROM comments WHERE approved=2);
$int_banned = $DB-frow($q);


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



[PHP-DB] Re: Problems with INNER JOIN

2009-01-29 Thread Martin Zvarík

This will work:

$sql = 
SELECT admin.AdminID, workorders.WHAT_YOU_WANT
FROM admin
INNER JOIN workorders ON admin.AdminID=workorders.AdminID
HAVING admin.username='.$_SESSION['user'].'
;


Terion Miller napsal(a):

Hi Everyone! I am having problems getting an INNER JOIN to work and need
some tips trouble shooting where the problem may be.

What I'm trying to do is match up AdminID's from two tables and display only
that users orders, sounds simple enough right...but I can't get it to return
the AdminID...

My Query:

   $sql =
 SELECT admin.AdminID , workorders.AdminID
 FROM admin
 INNER JOIN
 workorders ON
  (admin.AdminID=workorders.AdminID)
 WHERE admin.UserName =   '.$_SESSION['user'].' ;


  $result = mysql_query ($sql);
  $row = mysql_fetch_assoc ($result);
  $Total = ceil(mysql_num_rows($result)/$PerPage);

Thanks for any tips on how else I can accomplish this...
Terion



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



Re: [PHP-DB] Re: Problems with INNER JOIN

2009-01-29 Thread Martin Zvarík

What I wrote with HAVING doesn't do any difference - replace back to WHERE.

Your query is OK.

Try: echo mysql_error();

And try to remove the condition WHERE admin.user... if that outputs 
anything.


Martin


Terion Miller napsal(a):

Thanks Martin, oddly enough that still doesn't pull any results, it won't
even print the variables if I try to list them to see, I know my db
connection is good checked that, and can do really simple queries, would
something be preventing a JOIN from working?
When I Reveal my variables this query snippet:
$sql = SELECT admin.AdminID, workorders.WorkOrderID
FROM admin
INNER JOIN workorders ON admin.AdminID=workorders.AdminID
HAVING admin.username='.$_SESSION['user'].' ;



  $result2 = mysql_query ($sql);
  $row2 = mysql_fetch_assoc ($result2);
  $Total = ceil(mysql_num_rows($result2)/$PerPage);

Returns this:
$sqlSELECT admin.AdminID, workorders.WorkOrderID FROM admin INNER JOIN
workorders ON admin.AdminID=workorders.AdminID HAVING
admin.username='tmiller' $result2$row2

Terion

On Thu, Jan 29, 2009 at 11:56 AM, Martin Zvarík mzva...@gmail.com wrote:


This will work:

$sql = 
SELECT admin.AdminID, workorders.WHAT_YOU_WANT
FROM admin
INNER JOIN workorders ON admin.AdminID=workorders.AdminID
HAVING admin.username='.$_SESSION['user'].'
;


Terion Miller napsal(a):

 Hi Everyone! I am having problems getting an INNER JOIN to work and need

some tips trouble shooting where the problem may be.

What I'm trying to do is match up AdminID's from two tables and display
only
that users orders, sounds simple enough right...but I can't get it to
return
the AdminID...

My Query:

  $sql =
SELECT admin.AdminID , workorders.AdminID
FROM admin
INNER JOIN
workorders ON
 (admin.AdminID=workorders.AdminID)
WHERE admin.UserName =   '.$_SESSION['user'].' ;


 $result = mysql_query ($sql);
 $row = mysql_fetch_assoc ($result);
 $Total = ceil(mysql_num_rows($result)/$PerPage);

Thanks for any tips on how else I can accomplish this...
Terion



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






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



Re: [PHP-DB] Re: Problems with INNER JOIN

2009-01-29 Thread Martin Zvarík
Are you sure you have MORE than ONE [order + admin that belongs 
together] in those tables?


Now, turn on your brain and don't wait for my instructions, you already 
know what to do... test test test




Terion Miller napsal(a):
When I removed the WHERE admin.user... part it did return something, 
granted it returned one adminID and one order (which did belong 
together) but the adminID was not mine so I don't know how it picked 
that one randomly ...is there a way to do what I need using two 
queries one to find out the users ID then another to pull the 
workorders with that id? Can't believe this is proving so hard..

Thanks for helping!
Terion



On Thu, Jan 29, 2009 at 12:55 PM, Martin Zvarík mzva...@gmail.com 
mailto:mzva...@gmail.com wrote:


What I wrote with HAVING doesn't do any difference - replace back
to WHERE.

Your query is OK.

Try: echo mysql_error();

And try to remove the condition WHERE admin.user... if that
outputs anything.

Martin


Terion Miller napsal(a):

Thanks Martin, oddly enough that still doesn't pull any
results, it won't

even print the variables if I try to list them to see, I know
my db
connection is good checked that, and can do really simple
queries, would
something be preventing a JOIN from working?
When I Reveal my variables this query snippet:
   $sql = SELECT admin.AdminID, workorders.WorkOrderID
FROM admin
INNER JOIN workorders ON admin.AdminID=workorders.AdminID
HAVING admin.username='.$_SESSION['user'].' ;



 $result2 = mysql_query ($sql);
 $row2 = mysql_fetch_assoc ($result2);
 $Total = ceil(mysql_num_rows($result2)/$PerPage);

Returns this:
$sqlSELECT admin.AdminID, workorders.WorkOrderID FROM admin
INNER JOIN
workorders ON admin.AdminID=workorders.AdminID HAVING
admin.username='tmiller' $result2$row2

Terion

On Thu, Jan 29, 2009 at 11:56 AM, Martin Zvarík
mzva...@gmail.com mailto:mzva...@gmail.com wrote:

This will work:

$sql = 
SELECT admin.AdminID, workorders.WHAT_YOU_WANT
FROM admin
INNER JOIN workorders ON admin.AdminID=workorders.AdminID
HAVING admin.username='.$_SESSION['user'].'
;


Terion Miller napsal(a):

 Hi Everyone! I am having problems getting an INNER JOIN
to work and need

some tips trouble shooting where the problem may be.

What I'm trying to do is match up AdminID's from two
tables and display
only
that users orders, sounds simple enough right...but I
can't get it to
return
the AdminID...

My Query:

 $sql =
   SELECT admin.AdminID , workorders.AdminID
   FROM admin
   INNER JOIN
   workorders ON
(admin.AdminID=workorders.AdminID)
   WHERE admin.UserName =   '.$_SESSION['user'].' ;


$result = mysql_query ($sql);
$row = mysql_fetch_assoc ($result);
$Total = ceil(mysql_num_rows($result)/$PerPage);

Thanks for any tips on how else I can accomplish this...
Terion


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




-- 
PHP Database Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Re: Problems with INNER JOIN

2009-01-29 Thread Martin Zvarík

SELECT adminID FROM admin WHERE username= $username 

$adminid = mysql_fetch_row ...

SELECT * FROM workorders WHERE adminid = $adminid



Terion Miller napsal(a):
Yes I've already done that and checked the db etc and I've turned my 
brain ON hours ago, I came to the list because I'm stumped and have 
tried all manners of different ways to tell mySql


if admin ID = session user then get workorders where orderID = admin ID





On Thu, Jan 29, 2009 at 1:28 PM, Martin Zvarík mzva...@gmail.com 
mailto:mzva...@gmail.com wrote:


Are you sure you have MORE than ONE [order + admin that belongs
together] in those tables?

Now, turn on your brain and don't wait for my instructions, you
already know what to do... test test test



Terion Miller napsal(a):

When I removed the WHERE admin.user... part it did return
something, granted it returned one adminID and one order (which
did belong together) but the adminID was not mine so I don't know
how it picked that one randomly ...is there a way to do what I
need using two queries one to find out the users ID then another
to pull the workorders with that id? Can't believe this is
proving so hard..
Thanks for helping!
Terion



On Thu, Jan 29, 2009 at 12:55 PM, Martin Zvarík
mzva...@gmail.com mailto:mzva...@gmail.com wrote:

What I wrote with HAVING doesn't do any difference - replace
back to WHERE.

Your query is OK.

Try: echo mysql_error();

And try to remove the condition WHERE admin.user... if that
outputs anything.

Martin


Terion Miller napsal(a):

Thanks Martin, oddly enough that still doesn't pull any
results, it won't

even print the variables if I try to list them to see, I
know my db
connection is good checked that, and can do really simple
queries, would
something be preventing a JOIN from working?
When I Reveal my variables this query snippet:
   $sql = SELECT admin.AdminID, workorders.WorkOrderID
FROM admin
INNER JOIN workorders ON admin.AdminID=workorders.AdminID
HAVING admin.username='.$_SESSION['user'].' ;



 $result2 = mysql_query ($sql);
 $row2 = mysql_fetch_assoc ($result2);
 $Total = ceil(mysql_num_rows($result2)/$PerPage);

Returns this:
$sqlSELECT admin.AdminID, workorders.WorkOrderID FROM
admin INNER JOIN
workorders ON admin.AdminID=workorders.AdminID HAVING
admin.username='tmiller' $result2$row2

Terion

On Thu, Jan 29, 2009 at 11:56 AM, Martin Zvarík
mzva...@gmail.com mailto:mzva...@gmail.com wrote:

This will work:

$sql = 
SELECT admin.AdminID, workorders.WHAT_YOU_WANT
FROM admin
INNER JOIN workorders ON admin.AdminID=workorders.AdminID
HAVING admin.username='.$_SESSION['user'].'
;


Terion Miller napsal(a):

 Hi Everyone! I am having problems getting an INNER
JOIN to work and need

some tips trouble shooting where the problem may be.

What I'm trying to do is match up AdminID's from
two tables and display
only
that users orders, sounds simple enough
right...but I can't get it to
return
the AdminID...

My Query:

 $sql =
   SELECT admin.AdminID , workorders.AdminID
   FROM admin
   INNER JOIN
   workorders ON
(admin.AdminID=workorders.AdminID)
   WHERE admin.UserName =  
'.$_SESSION['user'].' ;



$result = mysql_query ($sql);
$row = mysql_fetch_assoc ($result);
$Total = ceil(mysql_num_rows($result)/$PerPage);

Thanks for any tips on how else I can accomplish
this...
Terion


--
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] Re: question about Zend PHP Studio ...Zend gave useless answer

2008-12-02 Thread Martin Zvarík
Can you explain what does it have to do with Zend PHP Studio (the PHP 
editor) ?



Fred Silsbee napsal(a):

I have Fedora 9/Apache 2/PHP 5.2.6
 
Everything is great but I cannot add the libraries for oci8 1.3.4 I have

in a directory.
 
The entries are grayed out.
 
I was getting an error oci_connect not found. I rebooted!
 
The php program runs **great** from /var/www/html under Apache
 
here is the error:
 
Fatal error: Call to undefined function oci_connect() in
/var/www/html/handle_log_book11g1.php on line 22 
 



  



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



RE: [PHP-DB] Value of $_POST['submit']

2008-11-27 Thread Martin, Steve (MAN-Corporate)
When I'm developing a number of pages and don't keep track of every
variable or form name (etc), I plant a print_r($_POST); at the top of
the page, so there's no guessing what gets sent to the page . . . 

If you have an empty $_POST array, then the form isn't using
action=post, or you didn't code your button as type=submit (?)

Just suggestions - since I can't see the code.

Steve

- Original Message - 
From: Ron Piggott [EMAIL PROTECTED]
To: PHP DB php-db@lists.php.net
Sent: Thursday, November 27, 2008 7:02 PM
Subject: [PHP-DB] Value of $_POST['submit']


I am working on the following web page tonight:
 http://www.actsministrieschristianevangelism.org/verseoftheday/

 I am trying to program the Load Previous Issue Random Issue and
 Load Next Issue buttons.

 I am using Ajax to pass the date the user is requesting to the PHP
 script for processing.

 I am wondering how my PHP script may access the value of value of
 $_POST['submit'].  At present echo $_POST['submit']; doesn't give me a
 value.  Consequently all queries to the mySQL database fail.

 Ron


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

 



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


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



Re: [PHP-DB] creating mysql functions using php

2008-10-09 Thread Andrew Martin
Hello,

Here's the procedural code. Surely it's possible to create a MySQL
function through the API?

$link = mysql_connect('localhost', 'root', 'pass');
mysql_select_db( 'test' );
$ret = mysql_query( 'DELIMITER $$ DROP FUNCTION IF EXISTS `anti_space`$$
CREATE FUNCTION  `anti_space` (
inString VARCHAR(1000),
replaceThis VARCHAR(1000),
replaceWith VARCHAR(1000)
)
RETURNS VARCHAR(1000)
DETERMINISTIC
BEGIN
DECLARE _outString VARCHAR(1000) DEFAULT TRIM(inString);
DECLARE _length INT DEFAULT LENGTH(_outString);
DECLARE _doneLoop BOOLEAN DEFAULT FALSE;
DECLARE _lengthNext INT DEFAULT 0;

IF ( _length != 0 ) THEN

WHILE (! _doneLoop AND _length != 0 ) DO

SET _outString = REPLACE( _outString, replaceThis, replaceWith );
SET _lengthNext = LENGTH(_outString);
SET _doneLoop = (_lengthNext = _length);
SET _length = _lengthNext;

END WHILE;

END IF;

RETURN _outString;

END$$

DELIMITER ;', $link );

if( !$ret ) echo mysql_error($link);

exit;

output:

You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'DELIMITER $$ DROP FUNCTION IF EXISTS `anti_space`$$ CREATE
FUNCTION `anti_spac' at line 1

I've tried putting the delimiter call in it's own query() call, but no
luck so far.

Thanks,


Andy


2008/10/8 Chris [EMAIL PROTECTED]:
 Andrew Martin wrote:

 Hello,

 Is it possible to create a mysql function from php, or is it command line
 only?

 $db = get_db();

 $a = $db-query( DELIMITER $$  );
 echo $db-error;
 // You have an error in your SQL syntax; check the manual that
 corresponds to your MySQL server version for the right syntax to use
 near 'DELIMITER $$' at line 1
 $a = $db-query( 
 DROP FUNCTION IF EXISTS `anti_space`$$
 CREATE FUNCTION  `anti_space` (
 inString VARCHAR(1000),
 replaceThis VARCHAR(1000),
 replaceWith VARCHAR(1000)
 )
 // You have an error in your SQL syntax; check the manual that
 corresponds to your MySQL server version for the right syntax to use
 near '$$ CREATE FUNCTION `anti_space` ( inString VARCHAR(1000),
 replaceThis VARCHA' at line 1

 What's your query method look like?

 What happens if you try using

 mysql_query($query);

 instead of $db-query($query) ?

 --
 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] creating mysql functions using php

2008-10-09 Thread Andrew Martin
Right, problem's obvious really:

There's never any need to use delimiter in an API call, as
delimiters aren't used - separate calls are made instead. So the
following code works just fine:

$link = mysql_connect('localhost', 'root', 'pass');
mysql_select_db( 'test' );
$ret = mysql_query( 'DROP FUNCTION IF EXISTS `anti_space` ');
if( !$ret ) echo mysql_error($link);
$ret = mysql_query( 'CREATE FUNCTION  `anti_space` (
inString VARCHAR(1000),
replaceThis VARCHAR(1000),
replaceWith VARCHAR(1000)
)
RETURNS VARCHAR(1000)
DETERMINISTIC
BEGIN
DECLARE _outString VARCHAR(1000) DEFAULT TRIM(inString);
DECLARE _length INT DEFAULT LENGTH(_outString);
DECLARE _doneLoop BOOLEAN DEFAULT FALSE;
DECLARE _lengthNext INT DEFAULT 0;

IF ( _length != 0 ) THEN

WHILE (! _doneLoop AND _length != 0 ) DO

SET _outString = REPLACE( _outString, replaceThis, replaceWith );
SET _lengthNext = LENGTH(_outString);
SET _doneLoop = (_lengthNext = _length);
SET _length = _lengthNext;

END WHILE;

END IF;

RETURN _outString;

END', $link );

D'oh. Hope that helps someone.


Andy

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



[PHP-DB] creating mysql functions using php

2008-10-08 Thread Andrew Martin
Hello,

Is it possible to create a mysql function from php, or is it command line only?

$db = get_db();

$a = $db-query( DELIMITER $$  );
echo $db-error;
// You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'DELIMITER $$' at line 1
$a = $db-query( 
DROP FUNCTION IF EXISTS `anti_space`$$
CREATE FUNCTION  `anti_space` (
inString VARCHAR(1000),
replaceThis VARCHAR(1000),
replaceWith VARCHAR(1000)
)
// You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '$$ CREATE FUNCTION `anti_space` ( inString VARCHAR(1000),
replaceThis VARCHA' at line 1

I get errors for these commands, can anybody shed any light on this please?

Many thanks,


Andy

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



Re: [PHP-DB] Performance (lots of tables / databases...)

2008-09-28 Thread Martin Zvarík

Thanks Tim, this helped me a lot.

Martin


Tim Hawkins napsal(a):
If you are looking at future expansion then the separate DB per blog is 
defiantly the way to go.


Some notes:

1) Avoid joins like the plague,  in fact most operations on a blog 
application would consist of getting  primary record and then decorating 
it with secondary data, for example getting a blog post and then getting 
the comments associated with it. Do two queries for this, dont join them.


2) Consider putting some intelligence into the database selection, have 
a master table/db that holds the database/server details for each blog, 
It will allow you to spread your blog application across multiple DB 
servers, as load goes up you can reassign blogs to different machines.  
You can memcache the data from the master db on a per blog basis, so you 
wont take a hit on accessing it, but it gives you great flexibility of 
redistributing data to different machines/clusters.


3) Use memcache, its a life saver.

4) If user registrations are common across all blogs, have a separate db 
for the users, again you can shard this, use a hashing algorithm to 
allow sections of the user database to be split across multiple user 
databases on multiple db servers. Again memcache the hell out of the 
user lookup, its a fixed id=db/datarecord mapping so its great for 
using memcache against as the mapping never changes.


5) Use an external indexer for any search functionality such as sphinx 
(http://www.sphinxsearch.com/), sphinx can index separate databases and 
join the indices together to form a single distributed search, it also 
supports incremental indexing.  Dont be tempted to use the mysql query 
system for searches.



On 28 Sep 2008, at 00:22, Jack van Zanen wrote:


If it were Oracle I'd go with one database and separate schema for each
blog.
For Mysql I think I'd go for a database each blog.

Jack

2008/9/28 Martin Zvarík [EMAIL PROTECTED]


Hi,
I am working on a blog system and I am currently thinking of what 
would be

the best DB approach.

I have read lots about wordpress and other blog's optimizations and DB
structure, but I have not found any mention of having separate 
database for

each blog/user.

So, my question is, which one is performance better (talking about 1000
blogs):

a) 1000 blogs * 5 (let's say we will have tables like comments, 
post... for

each blog) = 5000 tables in one database
... this is Wordpress default

b) 1000 databases (for each blog) each having 5 tables

c) 5 databases by 1000 tables - in this case, won't this be an issue 
when

SELECTing like this: [db_comments].testblog, [db_posts].testblog ?


Is that a controversial topic? :-/

Thanks for ideas,
Martin

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





--
J.A. van Zanen




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



[PHP-DB] Re: Could not run query

2008-09-28 Thread Martin Zvarík

Have you tested this SQL query?
Insert it into phpmyadmin, does it work?

If it does = php error.
If it doesn't = mysql error.



boclair napsal(a):

I need help to track down the cause of the error,Could not run query

A typical query is

$laterrecords = mysql_query(SELECT * FROM messages WHERE `logged`  
$timebegin ORDER BY `logged` DESC ) or die (Cannot 
select:br$querybrError:  . mysql_error());


Louise


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



Re: [PHP-DB] Could not run query

2008-09-28 Thread Martin Zvarík

The quotes are OK.

Tested - works.


danaketh napsal(a):
Well, seems to me like a problem with quotes you're using in query... 
The ` quotes you're using doesn't work, when I tried to use them in PHP 
called query. Maybe you should try use single quotes and if they works.


boclair napsal(a):

I need help to track down the cause of the error,Could not run query

A typical query is

$laterrecords = mysql_query(SELECT * FROM messages WHERE `logged`  
$timebegin ORDER BY `logged` DESC ) or die (Cannot 
select:br$querybrError:  . mysql_error());


Louise





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



[PHP-DB] Performance (lots of tables / databases...)

2008-09-27 Thread Martin Zvarík

Hi,
I am working on a blog system and I am currently thinking of what would 
be the best DB approach.


I have read lots about wordpress and other blog's optimizations and DB 
structure, but I have not found any mention of having separate database 
for each blog/user.


So, my question is, which one is performance better (talking about 1000 
blogs):


a) 1000 blogs * 5 (let's say we will have tables like comments, post... 
for each blog) = 5000 tables in one database

... this is Wordpress default

b) 1000 databases (for each blog) each having 5 tables

c) 5 databases by 1000 tables - in this case, won't this be an issue 
when SELECTing like this: [db_comments].testblog, [db_posts].testblog ?



Is that a controversial topic? :-/

Thanks for ideas,
Martin

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



Re: [PHP-DB] Performance (lots of tables / databases...)

2008-09-27 Thread Martin Zvarík

Hello,

the solution you mentioned came up on my mind too, but as you also said 
- it doesn't seem efficient on high load.


Why do you think having 1000+ databases would be a nightmare?
I think it would be easy to backup, fast to read/write... although I 
don't know what would that cause to the system - trying to imagine 1000 
folders... is it a problem?


I supposed that on the third solution is based the optimized wordpress 
(wordpress.com) - it does seem complicated, but better than having it 
all in one database.


Martin


danaketh napsal(a):

Hi,

the first choice is probably the best for you. When you think 
about second solution, it will be a nightmare when you have 1000+ 
databases and have to administrate them from one central system (if 
you're about to do it like this). The third solution looks little 
complicated to me - have one DB for comments, one for items etc.


But you can do it also in one database and six tables. Make one 
table 'blogs' where the blogs names and ids will be stored. Then you 
can just add one more field 'blog_id' to every table and identify 
items, categories, whatever on this. However in your situation (1000+ 
blogs) it may be not the best solution.



Martin Zvarík napsal(a):

Hi,
I am working on a blog system and I am currently thinking of what 
would be the best DB approach.


I have read lots about wordpress and other blog's optimizations and 
DB structure, but I have not found any mention of having separate 
database for each blog/user.


So, my question is, which one is performance better (talking about 
1000 blogs):


a) 1000 blogs * 5 (let's say we will have tables like comments, 
post... for each blog) = 5000 tables in one database

... this is Wordpress default

b) 1000 databases (for each blog) each having 5 tables

c) 5 databases by 1000 tables - in this case, won't this be an issue 
when SELECTing like this: [db_comments].testblog, [db_posts].testblog ?



Is that a controversial topic? :-/

Thanks for ideas,
Martin



Re: [PHP-DB] Performance (lots of tables / databases...)

2008-09-27 Thread Martin Zvarík

Lester Caine:

danaketh wrote:

Hi,

   the first choice is probably the best for you. When you think about 
second solution, it will be a nightmare when you have 1000+ databases 
and have to administrate them from one central system (if you're about 
to do it like this). The third solution looks little complicated to me 
- have one DB for comments, one for items etc.


   But you can do it also in one database and six tables. Make one 
table 'blogs' where the blogs names and ids will be stored. Then you 
can just add one more field 'blog_id' to every table and identify 
items, categories, whatever on this. However in your situation (1000+ 
blogs) it may be not the best solution.


That alternate option is the easiest to manage, but since you make no 
mention of WHICH database engine which is best would be affected by that 
choice. And how you are hosting the site(s) may also limit your options. 
Properly indexed tables will be fast and a single connection accessing 
that data will be faster than having to make multiple connections to 
different databases, and if it only has to manage a small number of 
table most links would probably be cached.





Sorry, it's MySQL.

I am talking about ONE server = one connection
and then switching between databases.

Example:  SELECT * FROM [db_comments].testblog, [db_posts].testblog
Would this be a performance issue?


Thanks for joining,
Marti

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



Fwd: [PHP-DB] Reading excel files

2008-09-17 Thread Andrew Martin
Hello,

 Are your Excel files nicely organized by columns with column names?
My excel files are not organised with column titles

Thanks for the phpclasses link, I am using the PEAR excel spreadsheet
writer which is sufficient for output, and require a quality reader -
has anybody got experience with the software at www eephp com? I am
loathe to unnecessarily purchase software when so much code is open
source, but can't find the open source solution to this problem.

Many thanks,


Andy

-- Forwarded message --
From: Post-No-Reply TUDBC [EMAIL PROTECTED]
Date: 2008/9/16
Subject: Re: [PHP-DB] Reading excel files
To: Andrew Martin [EMAIL PROTECTED]


Are your Excel files nicely organized by columns with column names?

On 9/16/08, Andrew Martin [EMAIL PROTECTED] wrote:
 Hello,

  Does anybody have experience with excel spreadsheet reader packages,
  either free or commercial? The old PEAR class is no longer maintained
  and the current sourceforge-hosted reader fails to read files above a
  certain size - I have attempted to debug it but to no avail. I have a
  commercial application that requires a new solution urgently, and any
  input on this subject would be appreciated.

  Kind regards,


  Andy


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



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



[PHP-DB] Reading excel files

2008-09-16 Thread Andrew Martin
Hello,

Does anybody have experience with excel spreadsheet reader packages,
either free or commercial? The old PEAR class is no longer maintained
and the current sourceforge-hosted reader fails to read files above a
certain size - I have attempted to debug it but to no avail. I have a
commercial application that requires a new solution urgently, and any
input on this subject would be appreciated.

Kind regards,


Andy

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



[PHP-DB] CMS-Blog system

2008-09-03 Thread Martin Zvarík

Hi,
I am working on CMS-Blog system, which will be using approx. 10 000 users.

I have a basic question - I believe there are only two options - which 
one is better?


1) having separate databases for each blog = fast
(problem: what if I will need to do search in all of the blogs for some 
article?)


2) having all blogs in one database - that might be 10 000 * 100 
articles = too many rows, but easy to search and maintain, hmm?


---

I am thinking of  having some file etc. cms-core.php in some base 
directory and every subdirectory (= users subdomains) would include this 
cms-core file with some individual settings. Is there better idea?


I appreciate your discussion on this topic.

Martin Zvarik

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



[PHP-DB] Separate or 1 database ?

2008-09-03 Thread Martin Zvarík

I have a basic question - I believe there are only two options - which
one is better?

1) having separate databases for each blog = fast
(problem: what if I will need to do search for article in all of the blogs for 
some?)

2) having all blogs in ONE database - that might be 10 000 * 100 
articles = too many rows, but easy to search and maintain



I appreciate your discussion on this topic.

Martin Zvarik



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



[PHP-DB] mathematical discrepancies

2008-08-14 Thread Andrew Martin
Hello,

Can anybody shed any light on this behaviour please?

PHP Version 5.2.5 on XP


$a = 1754.00 ;
$b = 1754.03 ;
$diff = abs($b) - abs($a);

echo $diffbr/; //output: 0.03

$a = 1754.00 ;
$b = 1754.09 ;
$diff = abs($b) - abs($a);

echo $diffbr/; //output :0.08999

$a = 1754.01 ;
$b = 1754.02 ;
$diff = abs($b) - abs($a);

echo $diff; //output: 0.00


Is this expected behaviour? Can anybody reproduce this?

Many thanks,


Andy

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



[PHP-DB] MySQL circular buffer

2008-06-20 Thread Andrew Martin
Hello,

I'm looking at implementing a database-level stack for a (multi stack)
mail merge queue (able to queue up to 1 million messages per stack).
Current workflow:

server 1 (containing main db) transmits data sets (used to populate
mail merge template) to server 2
server 2 web-facing script (script 1) puts data sets onto stack (db)
server 2 mail process script (script 2) pulls single data block (say
100 rows) from front of stack (fifo), merges the data with the
template and sends data to smtp process
server 2 script 2 removes processed block of rows

The problems I am considering include keeping track of the value of
the primary key across multiple instances of script 2 (the script will
run from a cron), whether to select by limit or range (i.e. stack_id 
500  stack_id  601 vs where stack_id = 500 limit 100) and looping
the index back to zero while ensuring there is no data that hasn't
been deleted.

So - it seems easier to avoid these problems and implement a circular
buffer :) What I would like to know is if anybody has experience
implementing this sort of data structure in MySQL (linked list?) or
any advice.

There don't seem to be any current implementations so the last
question is - is there a good reason for that? Too many overheads? I
know this sort of structure is best kept in memory and not on disk,
but I am not sure of any other solution to a queue this size.

Any comments welcome. Many thanks,


Andy

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



[PHP-DB] Serializing mySQLi result resource

2008-06-08 Thread Andrew Martin
Hello,

Is it possible to serialize a MySQL(i) result resource? I am looking
to insert results into the eAccelerator cache but the returned
resource does not appear to be recognised by mysqli_fetch_assoc.

Thanks,


Andy

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



[PHP-DB] Front Base on PHP

2007-11-12 Thread Martin
I've been trying to build PHP with the Front Base interface
on a 64 bit system. Can this be done or am I going to have
to go back to a 32 bit install?

--
http://blameitonlove.com/

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



[PHP-DB] Re: [PHP] the opposite of a join?

2007-10-03 Thread Martin Marques

[EMAIL PROTECTED] wrote:

I have a company table and a contacts table.  In the contacts table, there
is a field called companyID which is a link to a row in the company table.

 


What is the easiest way to query the company table for all the company rows
whose ID is NOT linked to in the contact table? Basically, the opposite of a
join?


SELECT * FROM company WHERE id NOT IN (SELECT companyID FROM contacts);

--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
-
Lic. Martín Marqués |   SELECT 'mmarques' ||
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador,
del Litoral |   Administrador
-

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



Re: [PHP-DB] csv problem.. read csv from var

2007-02-16 Thread Martin Alterisio

2007/2/16, bedul [EMAIL PROTECTED]:


i have problem with reading csv.. for i know the example script i get was
BASIC SCRIPT=
$handle = fopen(hasillab.csv, r);
$data2=$handle;
while($data = fgetcsv($handle, 1000, ,)){
foreach($data as $str)
  $data2.=br=  .$str;

}

the result was:
==OUTPUT==
= A507257
= 3/2/2007
= Hematologi Lengkap,Cholesterol Total,LDL Cholesterol,Trigliserida,HDL
Cholesterol

hasillab.csv contain
A507257,3/2/2007,Hematologi Lengkap,Cholesterol Total,LDL
Cholesterol,Trigliserida,HDL Cholesterol,Asam Urat,Gula Darah Puasa,Gula
Darah 2 Jam PP,Kreatinin,Ureum,Bilirubin Total,Alkali
Fosfatase,SGOT,SGPT,Urine Lengkap,Feses Rutin,Darah Samar Faeces,VDRL,Anti
-
HBs,Total PSA,HBsAg,Anti - HCV Total

the problem i have is.. how about the csv is a var
DATA===
$csv=
A507257,3/2/2007,\Hematologi Lengkap,Cholesterol Total,LDL
Cholesterol,Trigliserida,HDL Cholesterol,Asam Urat,Gula Darah Puasa,Gula
Darah 2 Jam PP,Kreatinin,Ureum,Bilirubin Total,Alkali
Fosfatase,SGOT,SGPT,Urine Lengkap,Feses Rutin,Darah Samar Faeces,VDRL,Anti
-
HBs,Total PSA,HBsAg,Anti - HCV Total\;

what should i do to make the ouput like above.

until now.. i try save the var into files then i use basic script to load
it

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



You can parse the csv yourself. So, lets cast some regexp magic into the
emptyness of this mailing thread:

   preg_match_all('/(?=^|,)((.|\n)*(?!)|.*)(,|$)/Um', $csv, $matches,
PREG_SET_ORDER);
   $rows = array();
   $fields = array();
   foreach ($matches as $match) {
   $field = $match[1];
   if ($field != ''  $field != ''  $field[0] == '' 
substr($field, -1) == '') {
   $field = substr($field, 1, -1);
   $field = str_replace('', '', $field);
   }
   $fields[] = $field;
   if ($match[3] == '') {
   $rows[] = $fields;
   $fields = array();
   }
   }

$rows variable will be filled with an array for each row in a CSV format
complaint string, using line breaks as row separators and commas as field
separators.

If you wonder about the mystic forces that powers this regexp, I'll be more
than willing to explain them throughly, if time becomes available. If it
doesn't work (I tested it againts all the use cases I could think of, but...
murphy's law applies) go blame someone else... =P



Also, if you're working on PHP5, you may bring up the new, mostly unused,
spells in your PHP spell book, available to all those who have reached level
5 in PHP wizardry. Just copy  paste (that skill you have probably adquired
in your early days as an apprentice) the code from the PHP manual included
as an example of custom stream wrappers:

http://www.php.net/stream_wrapper_register

With the VariableStream class registered as a stream wrapper, you can
magically use global variables as a streams. Therefore something like this
will work:

$csv=...etc...;
$handle = fopen(var://csv, r);
... etc ...


Re: [PHP-DB] mysqli auto rollback on script termination

2006-10-10 Thread Martin Koch Andersen

Chris skrev:
It doesn't explicitly say anything about when a connection is lost but 
I'm guessing it would rollback the transaction (well I'd sure hope so).


Me too. In any case, I'm now also using register_shutdown_function, 
which calls a function that does rollback of not committed transations.


Thanks.

--
Martin - http://925.dk
Shoot for the moon, even if you miss, you'll land among the stars.

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



Re: [PHP-DB] mysqli auto rollback on script termination

2006-10-09 Thread Martin Koch Andersen

Chris skrev:
It should be rolled back when a connection is lost or a transaction 
isn't explicitly committed.


Can you find documentation on this specific issue anywhere?

I think the same as you, but I find it odd, it is not documented.

Reason I'm asking is, I've seen some deadlock issues in a script (using 
FOR UPDATE and LOCK IN SHARE MODE), that looks like they are caused by 
transactions not being rolled back (releasing locks) correctly.


--
Martin - http://925.dk
Shoot for the moon, even if you miss, you'll land among the stars.

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



[PHP-DB] mysqli auto rollback on script termination

2006-10-08 Thread Martin Koch Andersen

Hi,

In case the PHP script dies (from fatal error, die() or similar), is any 
started transaction (BEGIN TRANSACTION) automatically rolled back 
(ROLLBACK) by PHP then?


I can't find any documentation about this.

Thanks in advance for hints, links etc.

--
Martin - http://925.dk
Shoot for the moon, even if you miss, you'll land among the stars.

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



Re: [PHP-DB] Select distinct field won't return distinct value

2006-06-07 Thread Martin Alterisio

I have a friend called GROUP_CONCAT, he may know what you want but he's only
available since MySQL 4.1

2006/6/7, Blanton, Bob [EMAIL PROTECTED]:


It is a Sybase vendor function but I was wondering if mysql had
something comparable.  I don't see anything in the manual.  Maybe the
subquery is the only way to go.


-Original Message-
From: Chris [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 07, 2006 8:50 AM
To: Blanton, Bob
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Select distinct field won't return distinct value

Blanton, Bob wrote:
 I'm just learning MySQL so don't know all the syntax.  There is a
LIST
 function in Sybase Adaptive Server Anywhere which would do that.  Is
 there an equivalent function in MySQL?

 Query:
 SELECT distinct niin, list(serial_number) FROM
 fmds.maintenance_equipment
 group by niin
 order by niin

 Output:
 niin  list(serial_number)
 000213909 B71-11649,B71-11657,B71-11650
 000473750 BAF-3750-0001,BAF-3750-0002,BAF-3750-0003
 000929062 2341
 001139768 2207

Pretty sure that's a sybase specific function. Nothing like that exists
in mysql or postgresql.

--
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] Sending filing attachments using PHP

2006-05-12 Thread Martin Alterisio

2006/5/12, JupiterHost.Net [EMAIL PROTECTED]:




Dwight Altman wrote:

  Right after rebuilding php and apache and breaking PHP funtionality
for
 everyone, just so you can send a semi complex MIME message? That is the
 epitome of PHP's lameness and why I can't sit quietly by and not
 recommend an easy to install and use and maintain solution.

 This command breaks Apache?
 require(class.phpmailer.php);
  And besides its in a non strutcutered way to maek it even more
 impossible to maintain.

 Classes and Object Oriented Programming?

Thanks Dwight, good info.

I'm speaking in generalitites of working with PHP not specifics
components of the technology.

As an example of this general clutter/bloat/mess that PHPs basic
paradigm is see:

http://tnx.nl/php

Disclaimer: Note that that url is a comparison of Perl to PHP, which is
not what I'm saying in all this mess. Just look at each point of PHP and
if you don't see whay iots so bad look at how Perl does it and hopefully
it will make more clear where I'm coming from for at least part of my
argument (the deve part) that PHP has many negatives things about it
that are either not an issue in other langauges or are not nearly as
pronounced or common to run up against.

I'm very sorry if this makes some uncomfortable but note that I'm
pointing out downfalls of PHP, a thing, I am not getting personal and
would appreciate the same courtesy. (which Dwight and Edward have done,
thanks ;p)

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




It's a fact that I can't deny any of the bad points you have exposed about
PHP. I even agree with you that most of this problems are really awful and
it's pointless to hide them. But the fact that PHP is by preference the
language for developing small and middle web solutions aimed to be economic
and rapidly developed is also undeniable. All languages have their pros and
cons, and trying to compare them outside of the context of the target market
is pointless. It just happens that PHP pros fit better the desires of the
web solutions market, and they also don't care much about current PHP cons.

Anyway, this market is evolving and its needs are changing, so it's normal
for developers to try and anticipate future development needs and try to
make PHP fit into other philosophies, methodologies or technologies it was
not designed to work with, and everyone who has tried this (including me)
have started to hate PHP in a certain way. But that's all there is to it, I
hate not having a proper application framework, I hate not having
namespaces, I hate the overhead of working with OOP, I hate magic quotes,
but I still use PHP because it is still the most appropiate development
enviroment for a small or middle sized web solution.

I'm guessing this part, but I think you think alike and that's the reason
you're still on this list and trying to make a point out of your bad
experiences with PHP. We can still hope that this problems will be solved
without harming the spirit of PHP in future versions or future enhacements,
and that our needs will be somehow be heard. If not, well they will realize
soon that current trends are leading to a different kind of solutions (not
that utopic Web2.0 but a more realistic Web1.5).

Thanks for sharing your opinion and concerns, I really appreciate them.


Re: [PHP-DB] Sending filing attachments using PHP

2006-05-12 Thread Martin Alterisio

2006/5/12, Martin Alterisio [EMAIL PROTECTED]:


...


I hate not having a proper application framework,



...





Sorry, there is a mistake there. I meant to say that I hate not having an
application server, although I also think currently available framework are
just not the way to go. They are too big and produce too much overhead.


Re: [PHP-DB] Sending filing attachments using PHP

2006-05-12 Thread Martin Alterisio

2006/5/12, JupiterHost.Net [EMAIL PROTECTED]:



 It's a fact that I can't deny any of the bad points you have exposed
about
 PHP. I even agree with you that most of this problems are really awful
and
 it's pointless to hide them. But the fact that PHP is by preference the
 language for developing small and middle web solutions aimed to be
economic
 and rapidly developed is also undeniable. All languages have their pros
and
 cons, and trying to compare them outside of the context of the target
 market
 is pointless. It just happens that PHP pros fit better the desires of
the
 web solutions market, and they also don't care much about current PHP
cons.

Most people aren't aware of the cons, thats my point :)



Developers are aware (well most of them). Designers are not, project leaders
are not (with the exception of a few), marketing people are not, and all the
people higher up in the administration are not. This is mostly our fault,
there really aren't enough effort applied to educate those outside the IT
world.

For example:

  If Mr. big wig was aware that phpBB has a history if being uber
hackable and even being used in a rootkit scheme a time or two he'd not
choose PHP. But its shiny so he says go with that it looks nice.

That is how its popularity has grown, ignorance of the facts.

 Anyway, this market is evolving and its needs are changing, so it's
normal
 for developers to try and anticipate future development needs and try to
 make PHP fit into other philosophies, methodologies or technologies it
was
 not designed to work with, and everyone who has tried this (including
me)
 have started to hate PHP in a certain way. But that's all there is to
it, I
 hate not having a proper application framework, I hate not having
 namespaces, I hate the overhead of working with OOP, I hate magic
quotes,
 but I still use PHP because it is still the most appropiate development
 enviroment for a small or middle sized web solution.

Why not use Perl, it has all the pros but does not have the cons :)



Because it has cons, and lots of them. It's not a language who was designed
for web development and this becomes a hassle. Its language constructions
are not as intuitive as other languages, there are too many ways of doing
the same thing, and too many different code conventions (if they can be
called as such). So it really becomes complicate to make one perl developer
work with another perl developer. There are too many basic data structures
for a scripting language, PHP arrays work better in almost any situation,
are easier to understand and use. Debugging a perl application requires a
higher level of programming skills.

In fact, I use it for several high volumn websites:

  - with persistent database connections and persistently running
instances of the script
(which is the *only* positive PHP has, except it means running PHP
as nobody and with really really bad permissions)
  - without doing *anything* with apache
  - works with SuExec so it runs as the user so the permissions can be
700 and config files 600 - try that with PHP without days of fiddling
and breaking stuff and finally giving up ;)

Now you have the only benefit of PHP (but better) without *any* of its
downside.

 I'm guessing this part, but I think you think alike and that's the
reason
 you're still on this list and trying to make a point out of your bad
 experiences with PHP. We can still hope that this problems will be
solved

It won't, for backwards compatibility they'll have to keep the cobbled
up mess. Or else make it new from scratch and remove the crap, but in
that case itd be a brand new langauge and would have all the problems
inherent with that :)



I think they have proved they don't care too much about backward
compatibility. You have just to see what happened to the [] and {} string
operator: deprecated, undeprecated and so on. They only care about keeping
the core features of PHP (those that really made the language stand where it
is).


Thanks for sharing your opinion and concerns, I really appreciate them.

My pleasure, I've been managing hundreds of servers for nearly a decade
and PHP has always had seriouse drawbacks. I've really honestly tried to
make a go of it but its just to much overhead to be worth it, IMHO :)



PHP doesn't have too much overhead when it's used in its most primitive way.
Everything procedural, everything on arrays and only load what you need.
This way it can run as fast as anyone. But this can only be used for small
solutions and some medium web solutions, it isn't applyable to every need.

--

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




Re: [PHP-DB] preg_replace help!

2006-05-04 Thread Martin Alterisio

2006/5/3, Nathan Heaps [EMAIL PROTECTED]:


Ok, scratch that, new problem. what can I replace (.*?) with in order for
php to recognise a multi-line quote/bold/italic/code/whatever?



By default the . pattern matches anything except a line break you can
either use ((?:.|\n)*) or add a modifier to the regular expression that
changes the behaviour of the . pattern. Modifiers are appended at the end
of the regular expression, after the closing delimiter:

/\[i:(.*?)\](.*?)\[\/i:(.*?)\]/s


The s modifier tells the regular expression to captura any character with
an . pattern. With only this you should be able to captura multiline tags.


Also you should consider using the U modifier which makes all repetition
patters (*,+) ungreedy. This way you can avoid using the ? after


Re: [PHP-DB] preg_replace help!

2006-05-04 Thread Martin Alterisio

2006/5/4, Martin Alterisio [EMAIL PROTECTED]:


2006/5/3, Nathan Heaps [EMAIL PROTECTED]:

 Ok, scratch that, new problem. what can I replace (.*?) with in order
 for
 php to recognise a multi-line quote/bold/italic/code/whatever?


By default the . pattern matches anything except a line break you can
either use ((?:.|\n)*) or add a modifier to the regular expression that
changes the behaviour of the . pattern. Modifiers are appended at the end
of the regular expression, after the closing delimiter:

/\[i:(.*?)\](.*?)\[\/i:(.*?)\]/s


The s modifier tells the regular expression to captura any character
with an . pattern. With only this you should be able to captura multiline
tags.

Also you should consider using the U modifier which makes all repetition
patters (*,+) ungreedy. This way you can avoid using the ? after




Sorry, las message wasn't send properly (gmail isn't working right anymore
for me). The last part was cutoff, it said:

Also you should consider using the U modifier which makes all repetition
patters (*,+) ungreedy. This way you can avoid using the ? after all
repeated patterns:

/\[i:(.*)\](.*)\[\/i:(.*)\]/sU


Re: [PHP-DB] Bad picture colors

2006-04-27 Thread Martin Alterisio
2006/4/27, nikos [EMAIL PROTECTED]:

 Hello list

 I use the following code to shrink some photos.

 $directory='/var/www/html/offroads/tmp/';
 $dir=opendir($directory);
 while($file=readdir($dir)) {
 $dirfile=$directory.$file;
 if(is_file($dirfile)) {
 copy($dirfile,$directory.sm/sm_.$file);
 $imgReal = ImageCreateFromJPEG($dirfile);
 $x = ImagesX($imgReal);
 $y = ImagesY($imgReal);
 $newX=$x*0.1783;
 $newY=$y*0.1783;
 $img = ImageCreate($newX,$newY);
 ImageCopyResized($img, $imgReal, 0, 0, 0, 0,
 $newX,
 $newY, $x, $y);
 //$newimg=imagecolorstotal($img);
 ImageJPEG($img,$directory.sm/sm_.$file);
 clearstatcache();
 }
 }
 closedir($dir);

 My problem is that the color results are very bad. How can I take picture
 with good colors?

 Thank you

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



Try using imagecopyresampled() instead of imagecopyresized(). It uses a more
precise algorithm which means: more time to complete. But since it seems
you're creating a cache of resized images that won't mather once the resize
its done.


Re: [PHP-DB] Single quotes in INSERT statements?

2006-04-26 Thread Martin Alterisio
2006/4/26, [EMAIL PROTECTED] [EMAIL PROTECTED]:


  Skip Evans wrote:
 
 Hello all,
 
 I'm brand spanking new to the list and have a
 quick question.
 
 I was under the impression that addslashes() would
 handle single quote marks in INSERT statements,
 but when I execute the following:
 
 $sql=UPDATE images SET orderno=$orderno,
 url='.addslashes($url).',
 banner=$banner,caption='.addslashes($caption).'
 WHERE imageID=$imageID;
 
 ...and $caption contains something like:
 
 Don't look
 
 ...the data is chopped off at the single quote mark.
 
 How, if not addslashes(), does one handle this?

  No, neither mysql_escape_string or
  mysql_real_escape_string worked.
 
  Yes, I am using MySQL, should have said that, sorry.
 
  But anyway, even with both of these functions, the
  data in the string containing the single quote as
  in Don't Look is still being truncated at the
  single quote mark.
 
  Any other suggestions would be greatly appreciated.

  Skip

 For the archives:

 Subject of this thread is misleading since the problem was not one of an
 INSERT failing but of HTML not displaying properly because of quotes or
 other special characters in the text in the database. Just goes to show
 that the best way to get the right answer is to analyze the problem
 accurately and ask the right question.

 David


Well, 80% of solving a problem is finding out what the problem is. If you
ask them to solve that 80% on their own then asking for help is rather
pointless. Anyway I agree that the subject was misleading, but this was
caused by how he explained the problem, particularly on the assumption that
addslashes was not doing what it was supposed to do so. What I advise is to
avoid assumptions and just present the symptoms of the problem.


Re: [PHP-DB] Single quotes in INSERT statements?

2006-04-25 Thread Martin Alterisio
1) Check that the string is not being truncated because of the column length

2) If you're seeing this data being truncated in the html output of your
site, check if it isn't being caused by outputing the data without properly
encoding special html characters.

3) . dunno

2006/4/25, Skip Evans [EMAIL PROTECTED]:

 Hello all,

 I'm brand spanking new to the list and have a
 quick question.

 I was under the impression that addslashes() would
 handle single quote marks in INSERT statements,
 but when I execute the following:

 $sql=UPDATE images SET orderno=$orderno,
 url='.addslashes($url).',
 banner=$banner,caption='.addslashes($caption).'
 WHERE imageID=$imageID;

 ...and $caption contains something like:

 Don't look

 ...the data is chopped off at the single quote mark.

 How, if not addslashes(), does one handle this?

 Thanks!
 --
 Skip Evans
 Big Sky Penguin, LLC
 61 W Broadway
 Butte, Montana 59701
 406-782-2240

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




Re: [PHP-DB] Single quotes in INSERT statements?

2006-04-25 Thread Martin Alterisio
2006/4/25, Skip Evans [EMAIL PROTECTED]:

 Martin Alterisio wrote:
  1) Check that the string is not being truncated because of the column
 length
 

 This was not it.


I was sure it wasn't but the first rule of debugging says never discard a
possible cause, no mather how dumb it may seem

 2) If you're seeing this data being truncated in the html output of your
  site, check if it isn't being caused by outputing the data without
  properly encoding special html characters.
 

 Yup! This was it. The data was fine in the
 database, so I wrapped the output with
 htmlentities() and all came out good.

 Thanks to Martin and all who made suggestions.


You're welcome.

 3) . dunno

 See number 2 ;)

 Thanks again!

 --
 Skip Evans
 Big Sky Penguin, LLC
 61 W Broadway
 Butte, Montana 59701
 406-782-2240



RE: [PHP-DB] help with file downloads from MySQL

2006-03-28 Thread Mickey Martin
I found the problem. I had 2 separate PHP sections of code with a blank line
between them. For some reason, the blank line was causing the newline to be
outputted before the file. I found it by accidentally putting a blank space
between the sections that output the file and the free the results from the
queries and it put a newline at the end of the output data.

Thanks everyone for the help with this. 

-Original Message-
From: Oskar [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 24, 2006 1:59 AM
To: Mickey Martin; PHP db
Subject: Re: [PHP-DB] help with file downloads from MySQL

Mickey Martin wrote:

 From what I can tell, the 0a is not in the file, but is being inserted 
either with the echo or by the browser when it receives the file. Does 
anyone know if a proxy server would cause this? There shouldn't be one 
involved, but I am going to contact my IT department to find out how it 
is configured today.

Thanks,
Mickey
  


  

0a is new line character code. Check your script you must be somewhere
displaying it.

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



RE: [PHP-DB] help with file downloads from MySQL

2006-03-24 Thread Mickey Martin
I guessed that 0a is the code for a new line, but cannot find where it is in
my code. This is the entire code that I'm using for the download:

?php
if ($id_files) {

mysql_select_db($database_ctnwww, $ctnwww);
$query_Attachment = sprintf(SELECT bin_data, filetype, filename, filesize
FROM IssueAttach WHERE id_files=%s, $_GET['id_files']);
$Attachment = mysql_query($query_Attachment, $ctnwww) or die(mysql_error());
$row_Attachment = mysql_fetch_array($Attachment);

  $data = $row_Attachment['bin_data'];
  $name = $row_Attachment['filename'];
  $size = $row_Attachment['filesize'];
  $type = $row_Attachment['filetype'];

  header(Content-type: $type);
  header(Content-length: $size);
  header(Content-Disposition: attachment; filename=\$name\);
  header(Content-Description: PHP Generated Data);
  echo $data;
}
? 

I have also tried putting a string in front of the file on the echo line:
echo TEST TEXT, $data;

When the file is saved, it begins with 0a followed by TEST TEXT and then the
start of the file without another instance of 0a.

Mickey


-Original Message-
From: Oskar [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 24, 2006 1:59 AM
To: Mickey Martin; PHP db
Subject: Re: [PHP-DB] help with file downloads from MySQL

Mickey Martin wrote:

 From what I can tell, the 0a is not in the file, but is being inserted 
either with the echo or by the browser when it receives the file. Does 
anyone know if a proxy server would cause this? There shouldn't be one 
involved, but I am going to contact my IT department to find out how it 
is configured today.

Thanks,
Mickey
  


  

0a is new line character code. Check your script you must be somewhere
displaying it.

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



RE: [PHP-DB] help with file downloads from MySQL

2006-03-22 Thread Mickey Martin
 From what I can tell, the 0a is not in the file, but is being inserted
either with the echo or by the browser when it receives the file. Does
anyone know if a proxy server would cause this? There shouldn't be one
involved, but I am going to contact my IT department to find out how it is
configured today.

Thanks,
Mickey

-Original Message-
From: Giff Hammar [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 21, 2006 3:50 PM
To: 'Mickey Martin'; 'Bastien Koert'; php-db@lists.php.net
Subject: RE: [PHP-DB] help with file downloads from MySQL

Can you use something like this (I haven't tried it)?

$search = '/^0a/'; // Looks at the beginning of the stream for 0a $replace =
; // Replace with this $limit = 1; // How many you want to do $new_file =
preg_replace($search, $replace, $old_file, $limit);

Giff 

-Original Message-
From: Mickey Martin [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 21, 2006 4:05 PM
To: 'Bastien Koert'; php-db@lists.php.net
Subject: RE: [PHP-DB] help with file downloads from MySQL

I tried purposely corrupting the file by adding blank spaces at the
beginning of the echo:
echo  ,$data;

The 0a was put in at the beginning again, followed by the spaces and then
the file. 

Mickey


-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 21, 2006 2:07 PM
To: [EMAIL PROTECTED]; php-db@lists.php.net
Subject: RE: [PHP-DB] help with file downloads from MySQL

If you load the data into the field with addslashes, have you tried
stripslashes on the way out?

Bastien


From: Mickey Martin [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] help with file downloads from MySQL
Date: Tue, 21 Mar 2006 12:55:56 -0600

Every time I try to download a file from MySQL it cannot be opened. 
Using HexEdit, I noticed that all of the files are getting 0a added to 
the beginning of them (happens with all browsers).

I can look at the files with MySQL Query Browser and they don't have 
the 0a.
Using php 4.3.11, Solaris 8, Apache 2.0.54, MySQL 4.1.11.

Here's what I'm using:
mysql_select_db($database_ctnwww, $ctnwww); $query_Attachment = 
sprintf(SELECT bin_data, filetype, filename, filesize FROM IssueAttach 
WHERE id_files=%s, $_GET['id_files']); $Attachment = 
mysql_query($query_Attachment, $ctnwww) or die(mysql_error()); 
$row_Attachment = mysql_fetch_array($Attachment);

   $data = $row_Attachment['bin_data'];
   $name = $row_Attachment['filename'];
   $size = $row_Attachment['filesize'];
   $type = $row_Attachment['filetype'];

   header(Content-type: $type);
   header(Content-length: $size);
   header(Content-Disposition: attachment; filename=$name);
   header(Content-Description: PHP Generated Data);
   echo $data;

Thanks in advance,
Mickey

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


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

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



[PHP-DB] help with file downloads from MySQL

2006-03-21 Thread Mickey Martin
Every time I try to download a file from MySQL it cannot be opened. Using
HexEdit, I noticed that all of the files are getting 0a added to the
beginning of them (happens with all browsers).

I can look at the files with MySQL Query Browser and they don't have the 0a.
Using php 4.3.11, Solaris 8, Apache 2.0.54, MySQL 4.1.11.

Here's what I'm using:
mysql_select_db($database_ctnwww, $ctnwww);
$query_Attachment = sprintf(SELECT bin_data, filetype, filename, filesize
FROM IssueAttach WHERE id_files=%s, $_GET['id_files']);
$Attachment = mysql_query($query_Attachment, $ctnwww) or die(mysql_error());
$row_Attachment = mysql_fetch_array($Attachment);

  $data = $row_Attachment['bin_data'];
  $name = $row_Attachment['filename'];
  $size = $row_Attachment['filesize'];
  $type = $row_Attachment['filetype'];

  header(Content-type: $type);
  header(Content-length: $size);
  header(Content-Disposition: attachment; filename=$name);
  header(Content-Description: PHP Generated Data);
  echo $data;

Thanks in advance,
Mickey

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



RE: [PHP-DB] help with file downloads from MySQL

2006-03-21 Thread Mickey Martin
Stripslashes causes the download to hang. I've also tried with base64_encode
on the upload and base64_decode on the download with the same results.

 

-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 21, 2006 2:07 PM
To: [EMAIL PROTECTED]; php-db@lists.php.net
Subject: RE: [PHP-DB] help with file downloads from MySQL

If you load the data into the field with addslashes, have you tried
stripslashes on the way out?

Bastien


From: Mickey Martin [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] help with file downloads from MySQL
Date: Tue, 21 Mar 2006 12:55:56 -0600

Every time I try to download a file from MySQL it cannot be opened. 
Using HexEdit, I noticed that all of the files are getting 0a added to 
the beginning of them (happens with all browsers).

I can look at the files with MySQL Query Browser and they don't have 
the 0a.
Using php 4.3.11, Solaris 8, Apache 2.0.54, MySQL 4.1.11.

Here's what I'm using:
mysql_select_db($database_ctnwww, $ctnwww); $query_Attachment = 
sprintf(SELECT bin_data, filetype, filename, filesize FROM IssueAttach 
WHERE id_files=%s, $_GET['id_files']); $Attachment = 
mysql_query($query_Attachment, $ctnwww) or die(mysql_error()); 
$row_Attachment = mysql_fetch_array($Attachment);

   $data = $row_Attachment['bin_data'];
   $name = $row_Attachment['filename'];
   $size = $row_Attachment['filesize'];
   $type = $row_Attachment['filetype'];

   header(Content-type: $type);
   header(Content-length: $size);
   header(Content-Disposition: attachment; filename=$name);
   header(Content-Description: PHP Generated Data);
   echo $data;

Thanks in advance,
Mickey

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


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



RE: [PHP-DB] help with file downloads from MySQL

2006-03-21 Thread Mickey Martin
Here's the code I'm using to upload if it helps:

?php
if ($action == upload) {
  include open_db.inc;

  if (isset($binFile)  $binFile != none) {
$data = addslashes(fread(fopen($binFile, rb), filesize($binFile)));
$strDescription = addslashes(nl2br($txtDescription));
$sql = INSERT INTO tbl_Files ;
$sql .= (description, bin_data, filename, filesize, filetype) ;
$sql .= VALUES ('$strDescription', '$data', ;
$sql .= '$binFile_name', '$binFile_size', '$binFile_type');
$result = mysql_query($sql, $db);
mysql_free_result($result); 
echo The new file was successfully added to the database.brbr;
echo a href='main.php'Continue/a;
  }
  mysql_close();

} else {
?

 

-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 21, 2006 2:07 PM
To: [EMAIL PROTECTED]; php-db@lists.php.net
Subject: RE: [PHP-DB] help with file downloads from MySQL

If you load the data into the field with addslashes, have you tried
stripslashes on the way out?

Bastien


From: Mickey Martin [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] help with file downloads from MySQL
Date: Tue, 21 Mar 2006 12:55:56 -0600

Every time I try to download a file from MySQL it cannot be opened. 
Using HexEdit, I noticed that all of the files are getting 0a added to 
the beginning of them (happens with all browsers).

I can look at the files with MySQL Query Browser and they don't have 
the 0a.
Using php 4.3.11, Solaris 8, Apache 2.0.54, MySQL 4.1.11.

Here's what I'm using:
mysql_select_db($database_ctnwww, $ctnwww); $query_Attachment = 
sprintf(SELECT bin_data, filetype, filename, filesize FROM IssueAttach 
WHERE id_files=%s, $_GET['id_files']); $Attachment = 
mysql_query($query_Attachment, $ctnwww) or die(mysql_error()); 
$row_Attachment = mysql_fetch_array($Attachment);

   $data = $row_Attachment['bin_data'];
   $name = $row_Attachment['filename'];
   $size = $row_Attachment['filesize'];
   $type = $row_Attachment['filetype'];

   header(Content-type: $type);
   header(Content-length: $size);
   header(Content-Disposition: attachment; filename=$name);
   header(Content-Description: PHP Generated Data);
   echo $data;

Thanks in advance,
Mickey

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


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



RE: [PHP-DB] help with file downloads from MySQL

2006-03-21 Thread Mickey Martin
I tried purposely corrupting the file by adding blank spaces at the
beginning of the echo:
echo  ,$data;

The 0a was put in at the beginning again, followed by the spaces and then
the file. 

Mickey


-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 21, 2006 2:07 PM
To: [EMAIL PROTECTED]; php-db@lists.php.net
Subject: RE: [PHP-DB] help with file downloads from MySQL

If you load the data into the field with addslashes, have you tried
stripslashes on the way out?

Bastien


From: Mickey Martin [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] help with file downloads from MySQL
Date: Tue, 21 Mar 2006 12:55:56 -0600

Every time I try to download a file from MySQL it cannot be opened. 
Using HexEdit, I noticed that all of the files are getting 0a added to 
the beginning of them (happens with all browsers).

I can look at the files with MySQL Query Browser and they don't have 
the 0a.
Using php 4.3.11, Solaris 8, Apache 2.0.54, MySQL 4.1.11.

Here's what I'm using:
mysql_select_db($database_ctnwww, $ctnwww); $query_Attachment = 
sprintf(SELECT bin_data, filetype, filename, filesize FROM IssueAttach 
WHERE id_files=%s, $_GET['id_files']); $Attachment = 
mysql_query($query_Attachment, $ctnwww) or die(mysql_error()); 
$row_Attachment = mysql_fetch_array($Attachment);

   $data = $row_Attachment['bin_data'];
   $name = $row_Attachment['filename'];
   $size = $row_Attachment['filesize'];
   $type = $row_Attachment['filetype'];

   header(Content-type: $type);
   header(Content-length: $size);
   header(Content-Disposition: attachment; filename=$name);
   header(Content-Description: PHP Generated Data);
   echo $data;

Thanks in advance,
Mickey

--
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] Data split: web local machine

2006-02-21 Thread Martin Alsinet
There was a thread a while ago about credit cards

Storing Credit Cards, Passwords, Securely, two-way encryption
http://beeblex.com/lists/index.php/php.db/40981?s=l:php.db

The part that really gives me the willys is:

 The procedure I initially thought of, was generating a file on the web
 side, emailing it to the client, then merging it with the cc_file to
¿emailing a file with cc numbers? I would never use a service if I
knew that my cc number would go in an excel file via email, but thats
just me. Check the thread for some sobering remarks about cc security.

Martin

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



RE: [PHP-DB] Does PHP strip out the seconds from a SQL Server datetime field?. .

2005-12-06 Thread Norland, Martin
 
How are you printing/extracting this information?  I find it very
unlikely that it's returning that string - it would eliminate any
localization opportunities as well as time conversion / math operations.

Use print_r() to print the contents returned from SQL Server directly,
if you're using date functions , you're already specifying the format
you want and you just need to add the seconds.

If it really is returning that, then check that you're not using some
helper classes or functions either with the returned value or to build
the SQL query, it's possible there's some sort of human readable MSSQL
option being passed in the SQL.

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Alex Gemmell [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 06, 2005 11:15 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Does PHP strip out the seconds from a SQL Server
datetime field?. .

Hello!

I'm using PHP 4.4.1 and pulling out records from a SQL Server database. 
  I use the mssql extension in PHP to connect to SQL Server.  My website

works fine for the most part but I have noticed something odd with the 
dates returned from SQL Server.

In my SQL Server table I have many datetime fields.  For example I can 
clearly see (using Enterprise Manager) the field fldDateCreated 
contains the datetime 06/12/2005 16:20:35 but oddly when I extract 
this field into a PHP variable the variable contains this: Dec 6 2005 
4:20PM.

Annoyingly I lose the seconds and I need the entire date and time.  Can 
anyone explain why the datetime is getting converted?  What is doing 
it (presumably PHP) and how can I get it to stop?

FYI: I use mssql_pconnect() to connect to the SQL Server database and 
mssql_fetch_assoc() to extract each row.

Thanks for any help offered!

Alex

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

2005-11-07 Thread martin lutsch

hi,

i have a problem with mysql transactions and php:
i want to do a transaction through more than one php scripts. i think,
if one script ends and links to another, the database connection ends
and the transaction rolles back. how can i continue one transaction
through more than one script?
any ideas? please help,

cheers, martin

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



RE: [PHP-DB] Re: Need help with delete and modify functions on a form.

2005-10-18 Thread Norland, Martin
-Original Message-
From: Arie Nugraha [mailto:[EMAIL PROTECTED] 

You can also use an array :

form
input type=checkbox name=check[] value=someValue1nbsp;Some
Value 1
input type=checkbox name=check[] value=someValue2nbsp;Some
Value 2
input type=checkbox name=check[] value=someValue3nbsp;Some
Value 3
/form

to get the the third value from the form you can do like this :

?php
echo $_POST[check][2];
?

Good basic examples, two notes though -
1) form method=post (blindingly obvious to most, but might confuse
some)
2) the name/value pair will only be POSTed if it's checked, so that
would only work if the first two were checked.

Some people like to pair all their checkboxes with a hidden of the same
name, the hiddens value will be sent if the checkbox isn't checked.
Personally, I prefer having an actual unique name for the checkbox when
you need to check a specific one.  If you don't need to check if 'the
third one' is set, but you're just getting - for e.g. - a list of pizza
toppings, then the order doesn't matter and [] works fine.  Otherwise
(if it does), give it a unique name:
input type=checkbox name=check[0] value=someValue1nbsp;Some
Value 1
input type=checkbox name=check[1] value=someValue2nbsp;Some
Value 2
input type=checkbox name=check[2] value=someValue3nbsp;Some
Value 3

(although a little more unique would be clearer :) )

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

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



RE: [PHP-DB] Limited connections to the database. .

2005-10-17 Thread Norland, Martin
http://www.google.com/search?q=oracle+limit+client+connections

http://www.oracle.com/technology/pub/articles/php_experts/scaling_oracle
_and_php.html

Summary - either you're not using persistent connections, or your site
is just very busy.  If it's just that the site is busy, best you can do
is just limit things on the website end.  If the problem is no
persistent connections - then you'll want to switch them on if you're
doing multiple queries/page.  You also want to make sure any information
that doesn't need to be pulled from the database isn't (perhaps there
are some global settings/etc. that change once a month, cache them
globally somewhere and don't keep requesting them so often) - there may
not be any such data, but then again, there may be.

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Marcos R. Cardoso [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 17, 2005 5:37 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Limited connections to the database. .

Hello to everyone,

we have been using an Apache server here at work (I work in a Library) 
where PHP/ASP scripts query the database very frequently (in the near 
future only PHP scripts will be used). The DBAs have recently complained

that our webserver is performing the queries in a high speed and many 
times in a second. It worried them and they are asking if we could limit

the connections to the database to a low number. As an example they told

us that other applications in other webserver uses Tomcat to run Java, 
and there they managed to limit the number of active connections at the 
same time.

I would like to know if it's possible to make something similar, and I'd

like to know too if we have to configure the PHP or the Apache.

Our environment is listed below:

Windows 2003 Server
Apache 2.0.54
PHP 4.4.0
Sun Chili!Soft ASP 3.6.2
MySQL 4.0.20a
Oracle 9i (through a Oracle 8i NetClient)


TIA,
Marcos R. Cardoso
Blumenau
Brazil

-- 
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] Search Replace within PHP

2005-10-06 Thread Norland, Martin
 
I think he's looking for str_replace() / preg_replace() or sprintf() or
similar

http://www.php.net/str_replace
http://www.php.net/preg_replace
http://www.php.net/sprintf

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 06, 2005 12:14 PM
To: [EMAIL PROTECTED]; php-db@lists.php.net
Subject: RE: [PHP-DB] Search  Replace within PHP. .

No sure i this is what you want but...

echo Hi, my name is  . $rows['name'];

bastien


From: Ron Piggott [EMAIL PROTECTED]
Reply-To: Ron Piggott [EMAIL PROTECTED]
To: PHP DB php-db@lists.php.net
Subject: [PHP-DB] Search  Replace within PHP
Date: Thu, 6 Oct 2005 10:40:45 -0500

Is there a search  replace PHP command?

An example I am needing this for would be:

My name is replace_with_real_name

I want to retrieve replace_with_real_name from a mySQL database and put
in
the name ... the key is that I want to put the person's name in various
position ... so I want to search for something like 
replace_with_real_name
and be able to put it anywhere in the sentence.

Ron

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


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

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




RE: [PHP-DB] Convert String to Array

2005-09-30 Thread Norland, Martin
Are you sure you even want to be storing it that way?  What happens when
you delete the following row?  Do you have to re-index each column?
There's no (trivially) easy way to do that with an update statement as
it stands.

vehMdlCd[1] LEX

You're likely better off storing it simply as field/value, and storing
the numbering in another column if you actually need the number at all.
Then you can pull each out and simply

$T100s[$row['T100Field']][] = $row['T100Value']; // or equivalent

This also gives you the benefit of being able to make a unique key
against t100field/t100value to prevent duplicates at your database
level.

T100FieldT100Nm  T100Value
==   =   =
vehMdlCd 0   MER
vehMdlCd 1   LEX
vehMdlCd 2   TOY

* again, I'd only keep T100Nm around if you need it for sorting
purposes, don't use it as an array index, if you do or might even remove
rows/etc. and need the array condensed.
---
Otherwise I'd just pull each row out, match it to its prefix
/(^[^\[]*)[([^\]]*)]/ and make an array out of the result.  Still, lots
more effort than the separate columns method.

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 29, 2005 10:23 PM
To: PHP DB List
Subject: [PHP-DB] Convert String to Array. .

Hi guys,

this looks like a very simple problem but i really have no idea how to
do
it.. please help me! thanks!

my MySQL database has a table of which 2 fields are as follow

T100FieldNmT100Value
==   =
vehMdlCd[0] MER
vehMdlCd[1] LEX
vehMdlCd[2] TOY

and I need to echo out the value for $vehMdlCd[0]...[2]. but when I
retrieve
T100FieldNm from the database, PHP recognises it only as a string. Thus,
in
order to get the value of $vehMdlCd[0], I need to do the following.

for($i=0; $i$numOfRows; $i++)
{
   $tmpVehMdlCd = vehMdlCd[$i];
   $vehMdlCd[$i] = $$tmpVehMdlCd;
}

where $numOfRows has been calculated by doing a count of  all
T100FieldNm
like vehMdlCd%.

Can someone enlighten me with a simpler way?! Potentially I can have a
100
over different T100FieldNm! =(

I tried using settype and type-casting but still don't get the
respective
T100Value! *sob*

Thanks sooo much!

Best regards,
Hwee Hwee

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

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



RE: [PHP-DB] PHP Forms - upload VS text

2005-09-30 Thread Norland, Martin
form action=?php tpl($_SERVER['REQUEST_URI']) ? method=post
enctype=multipart/form-data

Beyond that it's just the $_FILES array and $_POST array. 

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Rui Cruz [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 30, 2005 8:18 AM
To: php-db@lists.php.net
Subject: [PHP-DB] PHP Forms - upload VS text. .

Hi, I'm a fairlly experienced developer but there's something that just 
really gets to me...

I can:

- Use a form to upload a file or files
- Use a form to write text to whaever is needed (DB, e-mail
contents, 
etc...)

but I CAN'T

- Use the same form to do both.

I've tried so many diferent things and never got my scripts to upload a
file 
and insert data to a DB.

I find it dificult to accept this. Is this normal or am I doing things 
wrong? Could anyone shed some light on this issue please? 

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

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



RE: [PHP-DB] PHP Forms - upload VS text

2005-09-30 Thread Norland, Martin

Ahh, ignore that - our tpl() is an echo() replacement that our codebase
has, which can take parameters to do fun things.  There's no logical
reason to use it in this place, except it's shorter  to type than echo,
and it's habit.

Wiz 'o Oz Pay no attention to the man behind the curtain.

:)

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Rui Cruz [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 30, 2005 10:26 AM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] PHP Forms - upload VS text. .

Humm.. in the form action you use a function called tpl();

What function is that, I find no reference of it on the php.net function

list.


- Original Message - 
From: Norland, Martin [EMAIL PROTECTED]
Newsgroups: php.db
To: php-db@lists.php.net
Sent: Friday, September 30, 2005 3:36 PM
Subject: RE: [PHP-DB] PHP Forms - upload VS text


form action=?php tpl($_SERVER['REQUEST_URI']) ? method=post
enctype=multipart/form-data

Beyond that it's just the $_FILES array and $_POST array.

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Rui Cruz [mailto:[EMAIL PROTECTED]
Sent: Friday, September 30, 2005 8:18 AM
To: php-db@lists.php.net
Subject: [PHP-DB] PHP Forms - upload VS text. .

Hi, I'm a fairlly experienced developer but there's something that just
really gets to me...

I can:

- Use a form to upload a file or files
- Use a form to write text to whaever is needed (DB, e-mail
contents,
etc...)

but I CAN'T

- Use the same form to do both.

I've tried so many diferent things and never got my scripts to upload a
file
and insert data to a DB.

I find it dificult to accept this. Is this normal or am I doing things
wrong? Could anyone shed some light on this issue please?

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

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

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



RE: [PHP-DB] what is the value of session_register

2005-09-22 Thread Norland, Martin
(top posted because the subject says it all)
session_register --  Register one or more global variables with the
current session 

It's pretty much deprecated in favor of the $_SESSION superglobal.

It's recommended not to mix the two, and it functioning properly depends
on register_globals being enabled. (which is defaulted to off since php
4.2.0).

Hit up http://www.php.net/ 's documentation for more on this.

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: jonathan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 22, 2005 12:17 PM
To: php-db@lists.php.net
Subject: [PHP-DB] what is the value of session_register. .

Is there any values to this function? I'm looking over some code  
where this is a done a bunch of time and I don't see any value to  
it.  Maybe I'm naive about the internals but...

-jonathan

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



RE: [PHP-DB] insert error for mysql

2005-09-19 Thread Norland, Martin
One of the strings you're inserting has an quotation mark (apostrophe).
You're going to have to do some more careful data scrubbing on the
incoming data.

E.G. one of the strings says it's used in the retail, banking, and
insurance industries, among ...
And it's breaking the containing '   -  insert into foo (bar) values
('this isn't going to work.');

might I suggest starting with addslashes()

Cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Yui Hiroaki [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 19, 2005 1:26 PM
To: php-db@lists.php.net
Subject: [PHP-DB] insert error for mysql. .

hi!

I have an error message to try to insert character into table.
But I have an error messages like below. When I try to insert
$strbuf, I got error.


Could not perform INSERT to table 1064: You have an error in your SQL
syntax. Check the manual that corresponds to your MySQL server version
for the right syntax to use near 's used in the retail, banking, and
insurance industries, among



I publish SQL;

mysql create table view(b_col_id mediumint(255) NOT NULL
AUTO_INCREMENT, b_col longblob NOT NULL,file_name varchar(255) NOT
NULL,file_size varchar(255) NOT NULL,file_type varchar(255) NOT
NULL,file_date time,vtext longtext,PRIMARY KEY(b_col_id))TYPE=MyISAM;


mysql alter tablev view add fulltext (vtext);

The code--
$handle = popen(/usr/bin/pdftotext \$original_tmp\ - -layout  21,
'r');
$strbuf = fread($handle, 2048000);
echo $strbuf;

pclose($handle);


$sql_insert = INSERT INTO
view(b_col,file_name,file_size,file_type,file_date,vtext) VALUES
('$binaryContent','$original_name','$original_size','$original_type',CUR
TIME(),'$strbuf');

mysql_query($sql_insert) or DIE (Could not perform INSERT to table
.mysql_errno().: .mysql_error());
mysql_close($db);






Please do help me!

Yui

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

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



RE: [PHP-DB] Re: Inserting same text into HTML files. .

2005-09-13 Thread Norland, Martin
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en
dir=ltr

... Not necessarily.
 
cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Jens Schulze [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 13, 2005 7:18 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Re: Inserting same text into HTML files. .

I don't understand why you don't use searchreplace, as every normal
html file should start with html.

Jens

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



RE: [PHP-DB] Help with

2005-08-31 Thread Norland, Martin

Don't mix mysql_ functions with mysqli_ functions, and you'll have much
greater successes.

$dbcon = mysql_connect( 'localhost', 'root', 'password', 'database_name'
);
should be
$dbcon = mysqli_connect( 'localhost', 'root', 'password',
'database_name' ); 

Cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Richard Hart [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 30, 2005 12:06 PM
To: Bastien Koert; php-db@lists.php.net
Subject: RE: [PHP-DB] Help with. .

Thanks for your help Bastien.

I have changed the authentication procedure but have come up against
another
problem.
This time I am allowing the users to choose their unique usernames and
passwords which
will be stored in a mysql database. However when I check to see if their
details exist
in the databse I get:

Warning: mysqli_query() expects parameter 1 to be mysqli, resource given
in
login.php

any help would be appreciated.

Here is the code:

$username=$_POST['l_username'];
$password=$_POST['l_password'];

// connect to mysql
$dbcon = mysql_connect( 'localhost', 'root', 'password', 'database_name'
);
if (!$dbcon) {
echo 'Cannot connect to the database.';
exit;
}

// query the database to see if there is a matching username and
password
$query = select count(*) from users where username = '$username' and
password = '$password';

$result = mysqli_query($dbcon, $query);
if (!$result) {
echo 'Sorry can't run query';
exit;
}
$row = mysqli_fetch_row($result);
$count = $row[0];

if ($count  0) {
echo 'You have successfully logged on.';
}
else {
echo Your username and/or password have not been accepted.
Please a
href='javascript:history.back();'go back/a and try again.;
}

Thanks

Richard

-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: 30 August 2005 00:59
To: [EMAIL PROTECTED]; php-db@lists.php.net
Subject: RE: [PHP-DB] Help with


you don't have a connection to the db...either because the
name.password, db
name are wrong or you lack the needed permissions to allow the query...

note that this query is a really back idea...opens the whole db
up...better
to provide one connection and allow the users basic read write access
only

bastien


From: Richard Hart [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Help with Date: Mon, 29 Aug 2005 23:27:46 +0100

Hi

I'm new to PHP/MySQL and wondered if anyone on this list would be kind
enough to help me solve
this problem. I'm trying to automatically set up a users privileges on
a
MySQL table using the
username and password selected by them in an html form. I get the error
message:

Warning: mysql_query(): supplied argument is not a valid MySQL-Link
resource

for the code below:

?php

$username=$_POST['username'];
$password=$_POST['password'];

@ $db = new mysqli('localhost', 'root', 'password', 'database_table');

if (mysqli_connect_errno())
{
   echo 'Error: Could not connect to database. Please try again
later.';
   exit;
}

$grant_privilege = grant select, insert, delete, update on
name_of_table
to
$username identified by '$password';
mysql_query($grant_privilege, $db);

$db-close();

?

Can anyone help?

Thanks

Richard

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


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

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



RE: [PHP-DB] Re: HTML layout and arrays (WAS : Brain not working, helpneeded :-). .

2005-08-29 Thread Norland, Martin
-Original Message-
From: Neil Smith [MVP, Digital media]
[mailto:[EMAIL PROTECTED] 

The variable type you need is called an array, it has numerical indexes
: 
In PHP you can just omit the index and it'll be automatically 
auto-incremented from zero, so there's no need to maintain a counter :

$videos=array();
while ($row = mysql_fetch_array($sql_result)) {
$videos[][id] = $row[id];
$videos[][video_link] = $row[video_link];
$videos[][video_thumbnail] = $row[video_thumbname];
$videos[][video_title] = $row[video_title];
$videos[][video_description] = $row[video_description];

};

print_r($videos);

[snip]
 
You either want to be putting a $count in there, or assigning it all in
one go, otherwise you're left with:
$videos[0] == $row[id]
$videos[1] == $row[video_link]
etc.

while ($row = mysql_fetch_array($sql_result) {
$videos[] = array(
'id' = $row['id'],
'video_link' = $row['video_link'],
'video_thumbnail' = $row['video_thumbname'],
'video_title' = $row['video_title'],
'video_description' = $row['video_description'],
);
}

You can in PHP using variable variables but it gets very complicated
and 
hard to debug.
Stick with arrays so you can use stuff like

for ($i=0; $icount($videos); $i++) {
 print_r($videos[$i]);
}

or

foreach ($videos as $video_index=$video) {
 print(Index : .$video_index.br /Contents : );
 print_r($video);
}


I have 6 items on the page so I can hardcode ?=$id1? for item 1 and

Instead, use ?=$videos[0][video_description]? and so on.

And use ?php instead of ? just to be safe :)

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

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



RE: [PHP-DB] Brain not working, help needed :-). .

2005-08-29 Thread Norland, Martin
Figured I'd expand on what these evaluate to, in case anyone gets lost
otherwise:

-Original Message-
From: Micah Stevens [mailto:[EMAIL PROTECTED] 
[snip]
You can use variable variables.. like this:

$num = 2
$num == 2 [obviously :) ]

$varname = id.$num;
$varname == id2

$$varname = id2 is stored here!;
$id2 == id2 is stored here! // $$varname == ${$varname} == ${id2}

You can use {}'s whenever there's ambiguity, just like arrays.  It's
true that these can get confusing, but they're also a really good way to
do some neat dynamic things and have predictable variable names for
them.

It's in the docs in the variables section..

I couldn't have suggested a better place to get sorted out on all this -
Chris: browse the docs some, best way to wrap your head around things -
and the comments at the bottom tend to have useful real-world examples.

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

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



Re: [PHP-DB] mysql not valid resource. .

2005-08-09 Thread Martin Norland
A thought - if he's getting the 'not a valid resource' from just the 
code he posted, then his problem is with the $connessione variable, and 
not the query itself.  Check to make sure the connection is up at 
all/etc. and *it* is a valid resource.  Generally (well, in the simple 
case - which is the general case) you only have the one database 
connection, and don't need to bother passing it around.


Also, make sure you're using resources in the right places later - many 
times people will use the result ($query) as if it contains the rows 
returned, instead of being a resource identifier to get the rows.


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


Hutchins, Richard wrote:

Marco,

Have you tried echoing out the sql statement to the browser before it gets
sent to the database? That would show you the exact query string and give
you a chance to see where the error might reside.

$sql=select distinct des_riga, count ( des_riga ) as freq from k_riga
where id_tabella= . $id_tabella .  and id_colonna= . $id_colonna .
 group by des_riga order by des_riga;

echo $sql //ADD THIS LINE

// COMMENT THIS OUT FOR NOW $query=mysql_query ($sql, $connessione);

Rich
-Original Message-
From: Marco Strullato [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 09, 2005 9:44 AM
To: php-db@lists.php.net
Subject: [PHP-DB] mysql not valid resource


Hi all, I have a problem with mysql:
this code produce a not valid mysq resource.

$sql=select distinct des_riga, count ( des_riga ) as freq from k_riga
where id_tabella= . $id_tabella .  and id_colonna= . $id_colonna .
 group by des_riga order by des_riga;
$query=mysql_query ($sql, $connessione);

$id_tabella, $id_colonna and $connessione has the correct value...

The same query runs perfectly if I exec it directly on the db.

Do you have any suggestions?

Marco


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



[PHP-DB] PHP PostgreSQL UTF-8 issue

2005-08-03 Thread Martin Edlman

Hello,

I have problem with Unicode (UTF-8) data read from PostgreSQL 8.0, 
processed in PHP 4.3.5 and inserted back to DB.


Situation:
database with unicode (utf-8) encoding
table customer
  name varchar(30),
  surname varchar(50)
table invoice_tmp
  name varchar(70),
  surname varchar(70)

There are czech (utf-8 encoded) character in these columns
I have PHP script which reads data from customer and after some 
computings puts it to invoice_tmp. No data manipulation is done with 
name and surname.


The data the script reads are OK, when I print it on output I see it OK.
On most data it's OK to insert it to invoice_tmp but there are some data 
which it's not possible to insert.


When the name is longer than 30 bytes (not chars) or surname is longer 
than 50 bytes (not chars) I get the following error on insert:


Warning:  odbc_exec(): SQL error: [unixODBC]Error while executing the 
query (non-fatal);
ERROR:  unterminated quoted string at or near 'hasící zařízení spol. s 
r at character 74, SQL state 01000


When I print the name I see full text 'hasící zařízení spol. s r.o.'

strlen() of full text is 28 chars, 33 bytes
strlen() of trimmed (in error mgs) text is 25 chars, 30 bytes

The same error repeats for other records, every time the trimmed text 
has variable char lenght (depends on number of czech chars) but exactly 
30 bytes (for name) or 50 bytes (for surname).


I suppose it's problem of PHP which somehow knows the size of db column 
and then puts only such bytes into insert command. But prints full variable.
Is there some way to make it working? Use multibyte? I tried to use mb_ 
functions but without efect.


For now I made it working by increasing the size of the name and the 
surname columns in the DB.



Regards,
Martin Edlman

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



Re: [PHP-DB] Re: printing errors. .

2005-08-02 Thread Martin Norland

I would like to think that we could be a little nicer to this poor fellow.

He obviously typed all of these messages on a cellphone keypad without 
predictive text entry.  He's in dire straits, and needs our help.


At least, I really hope that's the case.

thrws i m gnna gt mdvl n hs ss

Incidentally - I *think* in some of these he's actually answering 
questions, but they must be fairly old, I archive every two months or so 
and I don't see any matches in my current.


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.



Miles Thompson wrote:

David,

Amen to that! Vowels do help, don't they?

Started to read this thread, then thought Bah, if he doesn't care 
enough to help us understand his problem, why bother straining to 
understand this  crap?


Miles

At 09:27 AM 8/2/2005, David Robley wrote:


(umeed wrote:

 most of the time wen dealing with
 mysql,
 i get error

 bt i want to exactly know wt the error is
 due to.

 how can i print specific error tht wil make it easy to know

u cn us mysql_error() n prnt ur qry as well

And perhaps if you write properly your questions may be better understood


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



RE: [PHP-DB] Duplicate record

2005-07-30 Thread Martin B. Nielsen
Would'nt the simplest just setting one of the rows as UNIQUE? Or you can add
one query that checks if one of the values already exists in the database.

Best regards,
Martin

-Original Message-
From: Hallvard [mailto:[EMAIL PROTECTED] 
Sent: 30. juli 2005 12:17
To: php-db@lists.php.net
Subject: [PHP-DB] Duplicate record

I have a page that posts data from a form to a mysql database.

The problem is that if the user hits the reload button on the browser, the 
data will be posted again, resulting in a duplicate record.

How can I avoid that? 

-- 
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] Finding duplicate contacts..

2005-07-26 Thread Martin Norland
Well, if you want to be as certain as you can - you're going to need to 
stick to a fairly rigorous check.  What you could do is export the DB 
into something PHP can quickly load right in (something serialized, for 
e.g.) every X minutes, and then at the end of the day run your 'rigorous 
 test'.  One thing that (might) spare you, is once you've checked a set 
against itself, you shouldn't need to check it again [depends on how 
changes are handled].  If you track the records that are changed updated 
or added, and every few hours (or nightly) check back over that - you'll 
have a fairly fast performing system that has few likely dupes on the whole.


Now, in my opinion you might want to stick with the idea of hitting the 
DB directly (depends) - but toss in some 'real world sanity checking'. 
Without seeing the query, I can't say if you haven't already - but 
chances are you can do quicker passes frequently, and occasionally do 
the slower more thorough checks.  Most peoples last names don't change 
often - and when they do, they could easily also change phone number and 
address.  Toss in 'soundex' to handle typos if doing it at the DB level, 
or you can use levenshtein distance [levenshtein()] to catch the 
occasional typo if hitting the info in PHP.


Another thing to note - if you know you're going to have duplicates no 
matter what your efforts, you might just want to automatically accept 
new records and let the system mark anything that looks dupe for a human 
to check over, saving you all that checking on the entry end of things 
(which I guess are done in batches, PDA sync or some such?)


If you realize there will be no fast perfect solution, you can start 
getting creative with a couple different levels and find a pretty happy 
balance.


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


[EMAIL PROTECTED] wrote:

We have a table with contacts and we need to determine if someone's already in 
there but with possibly slightly different info or if the old data contains 
duplicates.  Current criteria (I'm sure there's better):

If home phone matches any existing home, work or alt phones.
If work phone matches any existing home, work or alt phones.
If alt phone matches any existing home, work or alt phones.
If a concat of last name, street address and zip match any existing.

Table currently contains about 60,000 entries (imported from old system) and we 
can expect it to grow.

Indexes are on home, work and alt phones, as well as last name, street address 
and zip.  Tried it without indexes, it was slow.. tried it with indexes.. still 
about the same speed.

Tried seeing if putting the dupe check into a prepared statement sped it up 
any.  It didn't.

Analyzed table.  Same speed.

Out of 60,000 entries, we have roughly 40,000+ unique phone numbers (that's 
doing a union on all three phone number columns).  So even pre-compiling just 
that list and querying another table is going to be similar in time issues it 
seems.

For new contacts being brought in, we might have 30-60 at a time (maybe more) 
so this query would end up being run on each of the 30-60.  At 1.5-2 sec for 
each query, that ends up being a full minute or two to do the whole scan.

If I pull the phone #'s and name/address/zip combies into an array in PHP first, it's 
only like 12 secs, but each user would end up pulling it (and maybe store in a session 
variable or something) and re-pull it periodically to make sure it's semi-fresh.  This 
sounds like the quicker, but not the best solution.



Any tricks, tips or philosophical and/or theoretical things I've just not 
seeing, please let me know.


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



Re: [PHP-DB] Help. I am losing the plot.. .

2005-07-05 Thread Martin Norland

Ross Honniball wrote:

script1.php:

echo 'script 1 before';
require_once('script2.php');
echo 'script 1 after';

script2.php:

echo 'hello from script 2';

which in IE visually produces:

script 1 beforehello from script 2script 1 after

However if I view the source in IE, I get:

script 1 before?hello from script 2script 1 after
^
^
^
NOTICE THE QUESTION MARK.


I can't say I've ever run into it, but I would guess it relates to ? 
?'s.  Perhaps your Apache server configuration changed and it no longer 
recognizes ? start tags and only ?php - but then it shouldn't be 
echo()ing, rather just emitting the whole of the file or some such.


I'd suggest using telnet and issuing your get statement right there

telnet yourserver 80
GET /

this should give you exactly what your server returns on such a request, 
minus any customizations it has for the useragent.  View source can lie 
sometimes, unfortunately.


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] Re: list test subject. .

2005-06-26 Thread Martin Norland

[[[ O-F-F topic ]]]

prefer replies offlist if they have to be done, but I had to clear the 
waters some on this.


that said...

JeRRy wrote:
[A lot of mostly unintelligible and worthless to quote jumble]

delays like this are not frequent, and should not be.

delays like such.  Most recently IP's were a major issue than they 
upgraded how they operate to IP(something or rather) ... IP2 or 
something.  Effected Web Hosts.  I'm not quite clear exactly what all 
this was but my web host was down for a considerable time because of it 
and all my sites effected as people could not connect.  Some were 
upgraded on the fly some sites were down for weeks or more.  My web host 
was down for 11 days.Where do you live ?


No.  You were handed a pile of lies, it's possible that a major line 
recently was upgraded or repaired.  Are you in New Zealand?

http://slashdot.org/article.pl?sid=05/06/24/0249231tid=95tid=133
More likely your web host broke something badly and had to rebuild their 
system(s).  IPv6 is the next version of IP, and it's not full replacing 
IPv4 anytime soon because coordinating the whole mess is cumbersome. 
It's already in use in plenty of places, and they use it alongside IPv4 
just fine.


Australia!I know, that the USA are realy underdeveloped (Broadband,...) 
but broken DNS or such issues?


The USA is not really underdeveloped in this area, we are just too 
widespread to have *really* fast pipes.  Broadband has penetrated the US 
quite fine and it's extremely easy to get fast always on connections


Tests were ran with certain domains.  Most domains failed in Washington 
area.  But since these tests are not always accurate but I'd guess the 
problem lays within a hop or something there.  But how would I know in 
Australia?  Another is I tried to load 
http://www.getpaid2reademails.com/ and I can't access it but people 
elsewhere can.  When I ran anonymous browsing it works.  (another 
location)More bizzare!!!


Your DNS was broken, you still had a local cache of the sites you 
frequently visit.


Not really.  A person in Canada confirmed they were not able to view the 
above site for the passed 3 days.  I can view it now.  Another person in 
Americal could see it before but can't now despite the site being online 
and the server active.  It happens quite often this occourence. This 
list seems to be working fine now, I just got a swag of emails sworming 
in all at once.  But when I see the date/time emails were sent I see 
there is quite a delay in some hitting the inboxes.Maybe you should ask 
your ISP what happen...


Again, DNS servers/issues.  DNS changes can take a long while to 
propogate.  If your webhost was also your DNS host and their servers 
went poof, it is possible some people had the lookup cached while some 
didn't.


Email has no particular guaranteed delivery time, and backoff algorithms 
differ - in addition to mail servers queuing mail up before sending.  It 
happens, mail isn't always as instant as we would like.


Why should I?  Can't you see I am using Yahoo!? lol ... Nothing wrong 
with my ISP currently.  As they don't feed my emails, they just feed the 
pages to check them. ;)  But it's great to see people interested if the 
list is still ACTIVE... Rather than forgetting it exists if people 
don't get emails every so hours.  The list has lovers.. :):-)


amen.  hail to the list. :)

I think there has been 2 emails stating is the list active lately.  But 
none have confirmed www problems.   Michelle, go back to your little 
box.Little Box ?


That's what they call a linux (of some description) O/S machine, a box. 

it's just OS - it's an abbreviation, not O/S like O/S 2.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] RE: php-db Digest 20 Jun 2005 23:54:37 -0000 Issue 2992. .

2005-06-22 Thread Martin Norland

Cosman CUSCHIERI wrote:

I make part of a team where we have created a system which produces reports.
The reports are produced based on selection criteria which the user sets
from an oracle database. 


The problem we are facing is that when the users selects a big time frame
the report just freezes, the status bar displays 'done' the IE (our
preferred browser) window flag stops animating and report does not show
anything, only a blank page. I am suspecting a time out somewhere. I am
using the function set_time_limit and some of the reports did improve but
still facing the problem with others. 


[snip]

Make sure php is logging its errors somewhere, and check your apache 
error logs.  This seems very much like the behavior I've seen when a 
script hits the maximum memory allowed.  It's possible the first 
bottleneck was the processing, and the second is the memory needed.


Of course, it's possible it's something else entirely - but something 
should be logged when the pages bail out like that.


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] Shrinking gifs.. .

2005-06-22 Thread Martin Norland

nikos wrote:

Thank you Martin
I install new gd, reconfigure php and now is running OK.

But, it was a mass to realize that shortening gifs results to loss
transparency(!).

[snip]

imagecolortransparent()

That function will set the transparent color in an image (only one per 
image).  If you read the description carefully it says that it will 
return the existing one if you don't specify a new color...


so:
$transparent_color = imagecolortransparent($uploaded_img);
imagecolortransparent($thumbnail, $transparent_color);

That should get you and Nadim what you're looking for, assuming things 
work as promised (I've never used it myself).


If you need to work with pngs and the likes, imagecolorexactalpha / 
imagecolorclosestalpha - requires GD 2.01 and PHP 4.0.6 
(imagecolorallocatealpha requires PHP 4.3.2 though, oddly enough)


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] Shrinking gifs. .

2005-06-21 Thread Martin Norland

nikos wrote:

Hello list
I'd like to make a thumbnaile list using some gifs.
I use the following code but I got error (Call to undefined function:
imagecreatefromgif() ).
Does anybody knows what's wrong?

[snip]

RH-9 Linux
Apache httpd-2.0.40-21.11
PHP Version 4.3.11
gd-1.8.4-11


gif support was removed from gd in 1.6*.  It was re-added in 2.0.28. 
This is all due to the Unisys patent on the LZW compression that gifs use.


short answer - you just don't have support for making gifs, it was a 
licensing issue at the time the software you're using was 
released/packaged.  Upgrade gd.


* funny, since gd stood for 'gif draw' originally.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] Strange MySQL Problem. .

2005-06-14 Thread Martin Norland

Brian D. McGrew wrote:

I'm am having the hardest time getting PHP to connect to MySQL.  From a
command line I can say 'mysql -u root -p' and connect with no problems.

[snip]

Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (13)


what do you get with:
mysql -u root -p -S/var/lib/mysql/mysql.sock
chances are you need to tell php where your mysql socket is (through 
php.ini).


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] mysqldump but exclude one table. .

2005-06-14 Thread Martin Norland

Hassan wrote:

Hello everyone,
   I've a reader for sometime now, the best db list ever got into.
 
Well, I'd like to mysqldump a certain database, but with skipping one table, is it possible?

[snip]

from mysqldump --help

--ignore-table=name
Do not dump the specified table. To specify more than one
table to ignore, use the directive multiple times, once
for each table.  Each table must be specified with both
database and table names, e.g. --ignore-table=database.table

forgotten, but found using mysqldump --help | grep table and some 
quick scanning - docs are your friend :)


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] mysqldump but exclude one table. .. .

2005-06-14 Thread Martin Norland

[EMAIL PROTECTED] wrote:

C:\mysqldump --version
mysqldump  Ver 9.09 Distrib 4.0.16, for Win95/Win98 (i32)

[snip]

Ummm. What version are you using, Martin?

David


fairly fresh I'm afraid.

mysqldump  Ver 10.9 Distrib 4.1.9, for pc-linux-gnu (i686)

your grep generates... interesting... output :)  Useful, but I hope its 
not default.


A quick search on mysql's site isn't giving any indication when this was 
added - though there is mention of some replication flags with 
ignore-tables in 4.0.15 - since you're 4.0.16 I'm guessing that's not 
when it was added.  Your other options are to expressly state the tables 
you want dumped

mysqldump [OPTIONS] database [tables]
the old fashioned way.  You can get listings of the database through php 
and just have an `ignore` array that skips them when building the dump 
command.


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] Page refresh question. .

2005-06-09 Thread Martin Norland

Chris Payne wrote:


I'm using PHP and MySQL in a shopping cart system but the client wants it so
that when you add an item to the cart the page doesn't refresh and we all
know with PHP the page MUST refresh in order to execute the MySQL query.  Is
it possible, maybe with javascript? That I can talk to MySQL without having
to have the page itself refresh when they add the items to the cart?  This
is really a pain as the system was basically finished and now I'm told they
don't want the page to refresh and they see other sites that don't refresh -
sigh.  If it can be done with Javascript, do you have a sample of how I can
use PHP, Javascript and MySQL together to achieve this please?


Ask them if they're willing to lose any business at all, because any 
solution (XMLHttpRequest, hidden frame, cookies to store it until page 
refresh, etc.) will or could run into compatibility problems, and it's 
possible users won't be able to check out if they're using older browsers.


Also, it's really too late now, but you should try to demo these things 
early and be firm about having things stated as early in the process as 
possible, so you can change to meet their final request (which always 
differs from their initial) earlier rather than later.  Bottom line is 
this is probably a new request, but you may have to eat it depending on 
your situation / relationship / contract.


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] Missing mysql.so?. .

2005-05-31 Thread Martin Norland

KEVIN ZEMBOWER wrote:

I'm trying to fix PHP and MySQL on a Debian woody system that might be pretty 
messed up. The system has some parts, perhaps some libraries, in Debian testing 
with the bulk of the system in stable. I thought it's been running okay since I 
made these system changes, but today I had to reboot it and php and MySQL 
failed.

I've removed and reinstalled the Debian packages from stable:
cn2:/var/www/centernet/htdocs/phpmyadmin# apt-get install -t stable php4 
php4-cgi php4-common php4-mysql php4-mcal php4-cli

[snip]

Is it normal that the php4, php4-mysql, php4-mcal and php4-cgi versions are all 
4.1.2, but that php4-common and php4-cli are 4.3.10?

[snip]

I tried linking or copying the files in 20010901 to 20020429, but that gave an 
error about a mismatch.

Any suggestions on what I can try to get this system back in working order? If 
possible, I'd like to stay within the Debian system, using Debian package 
management commands rather than downloading source and recompiling.

Thanks for reading through all this and for your advice and suggestions.


php4-cli and php4-common don't exist in stable, it's pulling from 
testing - I expect you've got apt-pining setup:

http://packages.debian.org/cgi-bin/search_packages.pl?keywords=php4searchon=namessubword=1version=allrelease=all

so I would start there...
apt-get remove php4-common php4-cli php4-mysql;
apt-get update;
apt-get install php4-mysql;
see how that goes.  You might need to re-remove everything.  When all is 
said and done check your php.ini, in case it has remaining lines 
pointing at wrong libs/etc.


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] Multiselect List. .

2005-05-18 Thread Martin Norland
Patel, Aman wrote:
Ryan Jameson (USA) wrote:
That's not the problem. The problem is referring to the listbox via
javascript. It doesn't like the format: formName.listBoxName[].value it
has no problem with formName.listBoxName.value but then PHP doesn't seem
to handle it correctly.
There is a function called MM_findObj which does exactly what you 
need. I believe it originated from the Macromedia company (hence the MM 
prefix) - possibly used by Dreamweaver for its scripting purposes, but I 
digress.

Below is the funtion, and whenever you want to refer to oddly named form 
elements, you call MM_findObj('oddlyNamedFormElement[]') (and it returns 
an object reference to the form element that you can use normally).
[snip]
An addendum to that, two points:
 (mixed js and html examples, patently obvious which is which though)
1) You can use this for more than just form elements, if you give an 
item an id.  e.g.
	div id=my_great_divhello world/div
	h8_ie_my_great_div = MM_findObj(my_great_div);

2) This is just a general warning, but I used to stumble into it a lot. 
 IE creates variables/objects in the document namespace, essentially 
polluting it - good for convenience, bad for cross-browser anything.  As 
an example:
	input name=nothing
can be used as just nothing e.g.:
	alert(nothing);
... and in fact, you get errors when you try to do things like:
	nothing = MM_findObj(nothing);
because IE doesn't like to overwrite its pretty little objects.  Which 
nobody asked for.  The only solution is to use different names for the 
javascript variables describing/referring to your form/other elements.
	h8_ie_nothing = MM_findObj(nothing);

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] php line error. .

2005-05-17 Thread martin . norland
'Yemi Obembe wrote:
 
 just care to know how php does the line counting when it echoes error 
 messages like:
 
 parse error: unexpected '}' on line 129
 
 1. does the line counting includes empty lines
yes.
 2. are externally included files (using include(), require() etc) also line 
 counted(sic)?
no. (but the line with the include() call counts normally
 3. are d parts of the file that are not in php (i mean that are not contained 
 within the php delimeters) also counted?
yes.

in short, it's the line number of the script as if it were a plain text 
file.

cheers,
-- 
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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




**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


GWAVAsigAdmID:DD28CD8AE59761E4E0C23AE2EB03BE38



**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


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

Re: [PHP-DB] problems with a script. .

2005-05-17 Thread martin . norland
John R. Sims, Jr. wrote:
  Martin; I have taken your advice and read both of the articles, but
 unfortunately I have not been able to find what needs to be changed.  As I
 mentioned, I am very new at this.
 
 Could you possibly look at the script and point me in the right direction?
[snip]
 /head  ?php
 // Set the page title and include the HTML header.
 $page_title = 'Wireless Neighborhoods';
 include_once ('include/header.html');
 
 $db_connection = mysql_connect ('db.wireless-neighborhoods.org', 'scfn',
 'scfn75') or die (mysql_error());
 $db_select = mysql_select_db('scfn') or die (mysql_error());
 // If the form was submitted, process it.
 
 if (isset($submit)) {
 $query = insert into case_note values ('0', '$id',NOW(),
 NOW(),'$cmanager', '$location', '$purpose', '$present', '$subject',
 '$note');
 if (@mysql_query ($query)) {
 ààecho 'A Case Note has been added.';
 } else {
 ààecho 'The case note could not be added.' . mysql_error();
 }
 }
 
 ?
[snip]
It looks like you are using register_globals on your development 
machine.  You'll likely find it easier to write safer/cleaner PHP 
scripts if you don't rely on this.

http://us2.php.net/register_globals

though register globals itself isn't strictly a security issue, it is a 
convenience that can cause unwanted/undue variable namespace pollution. 
  I'd recommend you disable it on your development machine ( in your 
php.ini configuration file ) and then you'll have to set about changing 
any variables that are coming from get/post - e.g.
if (isset($submit)) {
becomes
if (isset($_POST['submit'])) {
and the likes.

It's odd that your PHP 5 installation has this enabled - the default 
changed to it being off in PHP 4.2.0, and certainly hasn't changed back.

cheers,
-- 
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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




**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


GWAVAsigAdmID:A00631876AE75ABACF5876E2D91276D2



**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


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

Re: [PHP-DB] problems with a script. .

2005-05-16 Thread Martin Norland
John R. Sims, Jr. wrote:
 Martin; I have taken your advice and read both of the articles, but
unfortunately I have not been able to find what needs to be changed.  As I
mentioned, I am very new at this.
Could you possibly look at the script and point me in the right direction?
[snip]
/head  ?php
// Set the page title and include the HTML header.
$page_title = 'Wireless Neighborhoods';
include_once ('include/header.html');
$db_connection = mysql_connect ('db.wireless-neighborhoods.org', 'scfn',
'scfn75') or die (mysql_error());
$db_select = mysql_select_db('scfn') or die (mysql_error());
// If the form was submitted, process it.
if (isset($submit)) {
$query = insert into case_note values ('0', '$id',NOW(),
NOW(),'$cmanager', '$location', '$purpose', '$present', '$subject',
'$note');
if (@mysql_query ($query)) {
echo 'A Case Note has been added.';
} else {
echo 'The case note could not be added.' . mysql_error();
}
}
?
[snip]
It looks like you are using register_globals on your development 
machine.  You'll likely find it easier to write safer/cleaner PHP 
scripts if you don't rely on this.

http://us2.php.net/register_globals
though register globals itself isn't strictly a security issue, it is a 
convenience that can cause unwanted/undue variable namespace pollution. 
 I'd recommend you disable it on your development machine ( in your 
php.ini configuration file ) and then you'll have to set about changing 
any variables that are coming from get/post - e.g.
	if (isset($submit)) {
becomes
	if (isset($_POST['submit'])) {
and the likes.

It's odd that your PHP 5 installation has this enabled - the default 
changed to it being off in PHP 4.2.0, and certainly hasn't changed back.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] php line error. .

2005-05-16 Thread Martin Norland
'Yemi Obembe wrote:
just care to know how php does the line counting when it echoes error 
messages like:
parse error: unexpected '}' on line 129
1. does the line counting includes empty lines
yes.
2. are externally included files (using include(), require() etc) also line counted(sic)?
no. (but the line with the include() call counts normally
3. are d parts of the file that are not in php (i mean that are not contained within the php delimeters) also counted?
yes.
in short, it's the line number of the script as if it were a plain text 
file.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] database synchronization. .

2005-05-12 Thread Martin Norland
M Saleh EG wrote:
Are you running your sites on the same server?
If yes use only one database for all of them.
Unless he's installed the latest of either SSvX* or QFCP**, I'm guessing 
his server isn't installed at multiple sites.
  * [SSvX] Schrodinger's Server vX
  ** [QFCP] Quantum Flux Computing Platform

He could just have all the 'sites' use the same database if they were 
websites, he meant sites as in on-site, e.g. physical locations.

I have to agree that you're basically stuck with either replication, or 
the frequent synchronization you're doing now - depending on whether or 
not the servers can always be on.  Is it possible to have a delay on the 
updating of information - to have a master server for the writes, and 
local slave servers at each site for just reads - or are writes too 
common a change?

Cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] problems with a script. .

2005-05-12 Thread Martin Norland
Mychael Scribner wrote:
I think you do. When I first installed php5, the tried a few apps that were
written in php4, and they never worked with 5.
-Original Message-
From: John R. Sims, Jr. [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 12, 2005 10:04 AM
To: php-db@lists.php.net; php_mysql@yahoogroups.com
Subject: [PHP-DB] problems with a script

Hi everyone,
 
I have a question.  I have built a script on my desktop that works fine, but
when I upload it to the server, it does not post the data to the database.
I checked the my server and the isp server.  I am running php 5.+ but my isp
is only running php 4.3.9  does this mean I have to change my script?
 --- eep crosspost ---
You will likely need to change some parts of it, but it should by no 
means be a complete rewrite.  We'd need more info to track down whether 
it's a specific problem - but I suggest you read this:
	http://us4.php.net/manual/en/migration5.php
and more specifically this:
	http://us4.php.net/manual/en/migration5.incompatible.php
to see what might have changed that you're using that php4 doesn't 
handle the same.  Any instances of unknown functions and the likes will 
have to be tracked down and dealt with as you hit it.

Basically - your best bet is enabling error messages (note: @ before a 
function suppresses errors) and grunting through it.  Note - obviously - 
if you are using lots of the newer php5 features (mostly related to 
classes) you probably won't want to try migrating down, and might be 
better off looking for a new host or setting up php5 on your current 
host (either you or them installing it, more likely you'll have to if 
it's even allowed).

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] Transfering post data to a series of pages. .

2005-05-04 Thread Martin Norland
Perry, Matthew (Fire Marshal's Office) wrote:
Is there a way to transfer post data to a series of PHP pages?
For example, lets say I have the following 4 pages:
Page1.php - this page has my original post form
Page2.php - this page does one thing with the post data
Page3.php - this page does another thing with the post data
Page4.php - this page shows the results of everything I have done
Right now I am using the header: ?header(Location: page3.php);?
The problem is, the following works:
Page1.php - this page has my original post form
Page2.php - this page does one thing with the post data
Page3.php - this page shows the results of everything I have done
But when I try to add the second transfer the data is lost:
Page1.php - this page has my original post form
Page2.php - this page does one thing with the post data
Page3.php - this page does another thing with the post data
Page4.php - Only the results from Page2.php are shown
ASP does this with %Server.Transfer (transferpage1.asp)%
Is there a counterpart with PHP?
- Matthew
include() :P
seriously though, Page1.php and Page4.php are the only two pages that 
should exist, if any.  Page2 and Page3 should pretty much guaranteed be 
turned into function calls or classes and called from Page4.php.  You 
don't need to separate logic and display in separate scripts that you 
push everything at, just separate your logic out into function calls.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] Transfering post data to a series of pages. .. .

2005-05-04 Thread Martin Norland
Martin Norland wrote:
include() :P
seriously though, Page1.php and Page4.php are the only two pages that 
should exist, if any.  Page2 and Page3 should pretty much guaranteed be 
turned into function calls or classes and called from Page4.php.  You 
don't need to separate logic and display in separate scripts that you 
push everything at, just separate your logic out into function calls.
haha - clarification on the if any... I meant if there should even be 
a separate page for receiving the POST data.  It will depend on how you 
have things setup, as to whether or not Page1 should POST to Page4 or 
just POST back onto itself.

	For e.g. 'detail' pages I tend to have POST to themselves, so you add 
an item in the page then it enters edit mode.  Similarly with list 
pages, when modifying properties of a listed entity - e.g. activate, 
delete, share.  It all depends on how you want things, but you will 
want at least 1 .php script, as opposed to if any :)

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] URL question. .

2005-05-02 Thread Martin Norland
Mark Cain wrote:
 a 404 script is the way I would handle it.
[snip]
- Original Message -
From: Chris Payne [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Friday, April 29, 2005 11:00 PM
Subject: [PHP-DB] URL question
Hi there everyone,
My client needs to be able to have their url www.blahblah.com
http://www.blahblah.com/  pickup the product number but I can't do it
the way I'd want (which would be www.blahblah.com/?mls=examplenumber, instead
they said it MUST be www.blahblah.com/examplenumber - how can I grab the
number AFTER the .com in PHP so that I can process it with MySQL without
it being assigned a variable name, just the number?
[snip]
You might also want to use apache mod_rewrite
http://httpd.apache.org/docs/mod/mod_rewrite.html
e.g. .htaccess
RewriteEngine On
RewriteRule ^/prod/(.*)$ product.php?pid=$1 [R]
I don't see that there's any easy way to trap a 404 error and rewrite 
based on that, you might be able to check if the requested object 
existed beforehand and set an ENV var to check against.

I don't know whether the straight 404 work would be easiest, or whether 
you might want to combine the two.  If you absolutely can't have any 
other pieces in the URL that you can uniquely tie to product lookups, 
you'll have a hard time doing this with just mod_rewrite, so the 404 may 
be the way to go.

Still, something to be aware of.  You could also do a rewrite map if the 
products are sufficiently static, though in that case you could also 
just alias it / etc.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] Problems with a script. .

2005-05-02 Thread Martin Norland
John R. Sims, Jr. wrote:
 ?php
[snip * - not even gunna bother]
 /HTML
Okay, quick/proper fixes 1 - 4:
1) you never open a FORM element, you only close it - you'll be 
wanting one, probably with a method=POST.

2) you should quote your array indices... just because php will evaluate 
them as themselves doesn't mean it's a good thing to rely on.
wrong: ($_POST[master_id] == )) {
right: ($_POST['master_id'] == )) {

3) you should similarly quote and curly group for the mysql queries.
wrong:
$add_master = insert into client values ($_POST[fname]', '$_POST[lname]');
right:
$add_master = insert into client values ('{$_POST['fname']}',
'{$_POST['lname']}');
4) also, all of your queries are doing inserts - they're not specifying 
the fields they are to insert into, and I'm sure many of them should in 
fact be UPDATE statements.  You'll want to fix that before your data 
gets *too* sparse.


Once that's all fixed, go to step 5.

5) rewrite all the database accesses to prevent people from doing sql 
injection attacks and ruining everything.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] Headers sent error msg on one server but not the other ...... .

2005-04-29 Thread Martin Norland
David Martínez wrote:
I suggest you to activate Output Buffering at beggining of your code. 
It's so easy and should not modify the output of your code.
This prevents your error Headers already sent.
At the first line of your PHP code, insert ob_start() and in the end 
of your code insert ob_clean_flush().

If you do not want to use Output Buffering you should remove any 
character sent, including Cr Lf (\n\r). I think it's so hard and I don't 
recommend it.

Depending of your server, PHP can evaluate \n\r as nothing or evaluate 
\n\r as an output.
Personally I disagree with this.  Yes it's easy, but you should never 
enable a feature to fix a bug or problem when it can be tracked down 
(although obviously in time critical situations, using it as a 'band 
aid' is - sometimes - necessary).  With a quick pointer he was able to 
find it, and not impact the performance of his web server (output 
buffering will take more memory - since it's obviously buffering all the 
output)

More importantly though, with output buffering - no content is sent to 
the client until you flush - in your suggestion at the end.  This isn't 
always an issue since many scripts do much of their processing at the 
top anyway, but if nothing is sent to the browser - the users will (the 
majority of the time) see the page they were on, and continue 
interacting with it thinking their request didn't go through.  This will 
only increase load on your server and, depending on what the users are 
doing (and how your backend is written) could throw someone or something 
into a state of confusion.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] php3 and oracle9i client libraries doesn't compile. .

2005-04-28 Thread Martin Norland
neil smith wrote:
I'm using this command to configure php3
./configure --with-apxs=/usr/local/apache/bin/apxs 
--with-config-file-path=/usr/local/lib --enable-versioning 
--enable-track-vars --with-oci8=/u01/app/oracle/product/9.2.0.4 
--with-oracle=/u01/app/oracle/product/9.2.0.4 --enable-sigchild

that works ok. But when I type make it eventually fails with this error:
gcc -shared -o libphp3.so mod_php3.o libmodphp3-so.a -L/usr/local/lib 
-L/u01/app/oracle/product/9.2.0.4/lib -lclntsh -lpsa -lcore4 -lnlsrtl3 
-lclntsh -ldl -lm -lpthread -lnsl -lirc -lgdbm -lpam -lm -ldl -lcrypt 
-lresolv -Wl,--version-script=/usr/php/php-3.0.18/php.map -Wl,-rpath 
/u01/app/oracle/product/9.2.0.4/lib
/usr/bin/ld: cannot find -lpsa
collect2: ld returned 1 exit status
apxs:Break: Command failed with rc=1
make: *** [libphp3.so] Error 1


I don't understand enough about this compilation process to know what 
lpsa is and why it can't find it. Does anybody know how I can get php3 
to work with oracle 9i client libraries?
thanks in advance to anyone who can help.
-lpsa means it's trying to link a library named 'psa' - off the top of 
my head I can't say what that is, and a brief googling is proving less 
than useful.

--- end section where I am 'useful', on to questioning rant ---
Can I ask why you're using such an old version of php?  If it's for a 
legacy application I can understand, but it seems like you're giving up 
a LOT to stay on php3.  In any case - looking at the release dates for 
the two:

http://www.oracle.com/technology/software/products/oracle9i/index.html
	Oracle9i Database Release 2 Enterprise/Standard Edition for Linux New 
(26-Mar-04)

http://www.php.net/releases.php
3.0.x (latest)
# Released: 20 Oct 2000
I'd say you'd be better off trying your legacy app under php4 and moving 
to that.  If it's simply a register globals issue, then you're no safer 
in php3 than you would be in php4 with it turned on, so that's not a 
reason to stay back.

good luck determining what psa is, I have to run to a meeting but I may 
try looking again later.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] php3 and oracle9i client libraries doesn't compile.... . .

2005-04-28 Thread Martin Norland
Patel, Aman wrote:
As far as I know, PSA is the internal product name for Plesk Server 
Administration software. Here's the product page if you need more 
information.

http://www.sw-soft.com/ru/products/psa/
Why would PHP need PSA? I have no idea (apart from the fact that psa 
seems to be just another web server(tm) probably based on apache).
psa is an Oracle module - though I can't see what it is, maybe someone 
with Oracle somewhere could find out (there should be a psa.h somewhere) 
- it should be included with your Oracle server/client files.  At the 
bare minimum, you can search for that and make sure php3 can find it, or 
just remove the -lpsa and see what happens - could be something 
unnecessary you aren't using anyway.

	My guess is that it's an older module that's since been replaced or 
phased out, but php3's interface to it expects it to be there still. 
Could be wrong, it's happened before.

Incidentally, why does PHP need:
Professional Services Automation
Personal Security Advisor
Public Safety Announcement
Python Software Activity
Port Scan Attack
 (  3 letter abbreviations are way too crowded :P  )
cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] Headers sent error msg on one server but not the other.... .

2005-04-28 Thread Martin Norland
Craig Hoffman wrote:
Hey Folks,
I have a script that times out the session if there is no activity in a 
certain amount of time.  If there is no activity the HEADER()  redirects 
to the logout page and kills the session.  Everything works fine on our 
test server, but when I test the script on the production server, I get  
an error HEADERS ALREADY SENT... after no activity.  I know all this 
stuff needs to be on top, before any  XHTML.

The test server has reg globals = OFF and the production server has them 
set to ON.  I can't change the any PHP.INI settings on the production 
server. Both servers are running PHP 4.3.10.  Other than that PHP 
installation is close to identical.   Any ideas / thoughts on what's 
causing the production server to send this error out?  Something to 
steer me in the right direction... I'm attaching a code snippet to look at:
Something is generating output before you get there - it could be as 
simple as:
---
?php
$stuff = '';
?

?php
$otherstuff = '';
?
---
Did you spot it?  That's right - a carriage return was sent.  Since your 
application works locally, I'd have to assume something is sending 
output before your scripts even start.  Is there any kind of header, 
wrapper, server-side include, or anything around the script - or perhaps 
you're making use of output buffering and the server isn't allowing its use?

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: FW: [PHP-DB] mime-type related to extension?. .

2005-04-27 Thread Martin Norland
meal list_php wrote:
Hi I sent this on 21st of april and got no answer...
there is no way to check the real mime type of a file?
even a file without extension?
thanks,
You can call out to an external program called file (which is pretty 
much guaranteed to be there, on a Linux system) which uses some magic to 
determine the file type.  It should be able to tell you if the file is 
jpeg regardless, without any messy work from you.  It will return a 
string like so:
	$ file false.doc
	false.doc: JPEG image data, JFIF standard 1.02
I'd run a few tests with some images from different sources, but it 
should be returning a very standard string - JPEG image data should at 
least be common.  IIRC Sony also has a 'motion jpeg' which might cause 
you problems, depending on what you're doing - if you can get a hold of 
one of those to test (if it's a concern) you might want to.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] Memory. .

2005-04-27 Thread Martin Norland
[FOTOList.com] Suporte wrote:
Hi,
When I get something from database, using this function: pg_query 
(postgresql) or mysql_query and after put this result in somes 
variables, Am I using double memory to same data or this new variable 
point to variable with db result?
The postgresql or mysql process is storing the resultset in memory, php 
is passed the address of the resultset.  When you actually pull the 
individual rows out of the resultset into PHP and assign them a 
variable, you are storing a second copy of that.  If you pull out all 
the rows and store them in an array in PHP, you then have two copies of 
your entire data.  If you need to pull your whole set of results out 
into an array, you can immediately use pg_free_result() or 
mysql_free_result() afterwards to free up the copy using memory in the 
database.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] Counting HTML Lines

2005-04-15 Thread Martin Norland
Ng Hwee Hwee wrote:
is there a way to count how many lines of screen output has HTML render?
below is a sample of what i'm trying to do.. i'm trying to generate a table
with the Remarks column containing data type TEXT which may have a few
lines. therefore, i cannot just count how many rows of records i have. can
someone please help me??
basically, i need to insert a page break at every 20 lines of screen output
for printing purposes. can someone enlighten me on how i can read HTML
rendered output?? thank you really really s much!!!
I'm going to go out on a limb and answer your problem instead of your 
question - because I don't personally see your proposed method as a good 
solution for the problem.  Put simply, it's impractical to try to 
approximate how the end users browser will render content, and no matter 
what you do, you'll constantly be tweaking for exceptions.  Instead, 
we'll attack with the best weapon we have, HTML and CSS.

There are a number of ways you can get what you want, but you'll likely 
have to play with all of them just to get a single working solution.

1) thead/tfoot
	http://www.w3.org/TR/html4/struct/tables.html#h-11.2.3
This is likely the best bet and simplest way to get what you want - I 
assume the reason you are wanting to break the content up is because

2) CSS pagebreak options
'page-break-before' and 'page-break-after' can be set to 'always', 
'auto', 'left', and 'right' - left and right are for printing on both 
sides - and afaik 'left' isn't supported by anyone, and 'right' has very 
limited support - still, as far as pagebreaks, you'll mostly be just 
forcing them with an always.  It's worth noting that this is CSS2 - but 
it is some of the rare CSS2 that is supported in browsers [though not 
necessarily all, since there are even CSS1 properties not (properly) 
supported by all major browsers]

3) PRE tags if all else fails
  If you can't get any of these solutions to work, you can force your 
output to behave as expected with PRE tags and approximations.  This 
basically brings you back to your original question - counting 
linebreaks and characters and the likes, counting the lines by stripping 
the html output to determine how many characters really would go out 
(with the ob_* functions, remember though - you're just analyzing, don't 
leave the html out unless you really want to!). - except it changes to 
have you cater your output more to be predictable.  Also, remember to 
account for htmlentities if that's an issue,  = amp;, etc.  Really 
not a fun solution to entertain, IMO.

Good luck!
cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] using POST data for a readfile

2005-04-13 Thread Martin Norland
mel list_php wrote:
Thank you very much!
[snip]
I didn't get the base tag though, what does that mean?
It was merely a cautionary warning about sites that force a base href 
for relative URIs (including, of course, URLs)

See: http://www.w3.org/TR/html4/struct/links.html#h-12.4
cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


  1   2   3   4   5   >