php-general Digest 21 Jul 2010 13:05:01 -0000 Issue 6857

2010-07-21 Thread php-general-digest-help

php-general Digest 21 Jul 2010 13:05:01 - Issue 6857

Topics (messages 307040 through 307062):

exec output to mySQL, How?
307040 by: Tom Sparks
307050 by: Nilesh Govindarajan
307053 by: Per Jessen
307055 by: Tom Sparks
307056 by: Nilesh Govindarajan
307057 by: Nilesh Govindarajan
307059 by: Ashley Sheridan
307060 by: Per Jessen

php array in different OS
307041 by: fyang
307042 by: fyang
307043 by: fyang
307044 by: fyang
307045 by: fyang
307046 by: fyang
307047 by: fyang
307048 by: fyang
307061 by: Bob McConnell

Re: eval and HEREDOC
307049 by: Sorin Buturugeanu
307051 by: Peter Lind
307054 by: Sorin Buturugeanu

Re: MySQL select matching
307052 by: Simcha Younger

MySQL+PHP
307058 by: Diana Wu

PDO and UPDATE problem
307062 by: Sky Gunning

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
How do I take the output from a command line program and update a MYSQL 
database with it?

tom_a_sparks
Light travels faster then sound, which is why some people appear bright, until 
you hear them speak



---End Message---
---BeginMessage---
On Wed, Jul 21, 2010 at 8:49 AM, Tom Sparks tom_a_spa...@yahoo.com.au wrote:
 How do I take the output from a command line program and update a MYSQL 
 database with it?

 tom_a_sparks
 Light travels faster then sound, which is why some people appear bright, 
 until you hear them speak




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



$cmdop=shell_exec('cmd');
$con=new mysqli(...);
// Check connection error
// Refer to php.net/mysqli
$con-multi_query($cmdop);

-- 
Regards,
Nilesh Govindarajan
Facebook: http://www.facebook.com/nilesh.gr
Twitter: http://twitter.com/nileshgr
Website: http://www.itech7.com
---End Message---
---BeginMessage---
Tom Sparks wrote:

 How do I take the output from a command line program and update a
 MYSQL database with it?

command line program | mysql -u user -p -Ddatabase



-- 
Per Jessen, Zürich (22.6°C)

---End Message---
---BeginMessage---
--- On Wed, 21/7/10, Nilesh Govindarajan li...@itech7.com wrote:
 On Wed, Jul 21, 2010 at 8:49 AM, Tom
 Sparks tom_a_spa...@yahoo.com.au
 wrote:
  How do I take the output from a command line program
 and update a MYSQL database with it?
 
  tom_a_sparks
  Light travels faster then sound, which is why some
 people appear bright, until you hear them speak
 
 
 $cmdop=shell_exec('cmd');
 $con=new mysqli(...);
 // Check connection error
 // Refer to php.net/mysqli
 $con-multi_query($cmdop);
ok, thanks the program I am using reports a estimated time to completion, I 
understand I need a loop, but I cant work out how I would do this

run program
while program is running {
sleep 60 seconds
update mySQL with ET from program
}

tom


  
---End Message---
---BeginMessage---
On Wed, Jul 21, 2010 at 12:29 PM, Per Jessen p...@computer.org wrote:
 Tom Sparks wrote:

 How do I take the output from a command line program and update a
 MYSQL database with it?

 command line program | mysql -u user -p -Ddatabase



 --
 Per Jessen, Zürich (22.6°C)


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



I don't think this is what he needs? Otherwise why would he post on a
PHP list lol.

-- 
Regards,
Nilesh Govindarajan
Facebook: http://www.facebook.com/nilesh.gr
Twitter: http://twitter.com/nileshgr
Website: http://www.itech7.com
---End Message---
---BeginMessage---
On Wed, Jul 21, 2010 at 12:39 PM, Tom Sparks tom_a_spa...@yahoo.com.au wrote:
 --- On Wed, 21/7/10, Nilesh Govindarajan li...@itech7.com wrote:
 On Wed, Jul 21, 2010 at 8:49 AM, Tom
 Sparks tom_a_spa...@yahoo.com.au
 wrote:
  How do I take the output from a command line program
 and update a MYSQL database with it?
 
  tom_a_sparks
  Light travels faster then sound, which is why some
 people appear bright, until you hear them speak
 

 $cmdop=shell_exec('cmd');
 $con=new mysqli(...);
 // Check connection error
 // Refer to php.net/mysqli
 $con-multi_query($cmdop);
 ok, thanks the program I am using reports a estimated time to completion, I 
 understand I need a loop, but I cant work out how I would do this

 run program
 while program is running {
 sleep 60 seconds
 update mySQL with ET from program
 }

 tom





You want to calculate how much time the query takes?

-- 
Regards,
Nilesh Govindarajan
Facebook: http://www.facebook.com/nilesh.gr
Twitter: http://twitter.com/nileshgr
Website: http://www.itech7.com
---End Message---
---BeginMessage---
On Wed, 2010-07-21 at 12:57 

php-general Digest 22 Jul 2010 02:35:11 -0000 Issue 6858

2010-07-21 Thread php-general-digest-help

php-general Digest 22 Jul 2010 02:35:11 - Issue 6858

Topics (messages 307063 through 307081):

Re: PDO and UPDATE problem
307063 by: Peter Lind

ƒÈ|²¿|Éó|Ӌ|Óë|ƒÈ|¿Ø|ïL|ëU|¹Ü|Àí
307064 by: bftvetq

Question about SQL and Graph nodel trees
307065 by: Tim Gallagher
307070 by: Andrew Ballard
307080 by: Tim Gallagher

Extending Exception
307066 by: Christoph Boget
307067 by: Ashley Sheridan
307068 by: Richard Quadling
307069 by: Richard Quadling
307071 by: Richard Quadling

XML DOM
307072 by: Ben Miller

What are the curly brackets around variables in SQL statements for?
307073 by: Dotan Cohen
307074 by: Daniel Brown
307075 by: Dotan Cohen
307076 by: Nathan Nobbe
307077 by: Dotan Cohen
307078 by: Nathan Nobbe
307079 by: Daniel Brown

Re: php array in different OS
307081 by: fyang

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
On 21 July 2010 15:04, Sky Gunning sky.gunn...@gmail.com wrote:
 Hello

 I have a problem with a update using PDO.
 (learning atm and updating a php class to use PDO)

    private function updateUser($id)
    {
        $date = mktime();

        $DB = Db::getInstance();

        $stmt = $DB-prepare('UPDATE  '. TBL_USERS .' SET
 date_last_action=:updateDate WHERE id=:userId');

Try without the extra quotation mark before UPDATE.

Regards
Peter

-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
/hype
---End Message---
---BeginMessage---
下午 10:04:12;ZFWAR3WSDGT4WE633E63XG


  内 部 审 计 及 内 部 控 制 与 财 务 风 险 管 理 

 时 间:2010年7月29-30日(上 海)
 时 间:2010年8月06-07日(深 圳)

◆参课对象: 董事会、监事会成员;负责内部控制和内部审计部门的经理
、主管;总经理、财务副总经理以及其他高级经营管理人员;财务总监、财
务经理、财务主管、税务经理、税务主管、总帐会计、税务会计等具体操
作人士。

◆说  明:凡希望参加认证的学员,在课程结束后参加认证考试并合格者,
颁发“香港培训认证中心国际职业资格认证中心HKTCC”《国际注册
财务管理师(内部审计与内部控制管理方向)》职业资格证书。(国际认
证/全球通行/雇主认可/联网查询)。(课程结束10日内快递给学员)。

◇课--程--背--景:
如何确保企业经营的效率和效果?
如何确保企业财务报告的可靠性? 
如何保证企业始终遵守法律法规?
如何保证企业资产的安全?
如何评估与防范财务风险,保证企业永续经营?
如何通过内部审计发现企业经营异常并及时采取有效措施? 
  为了实现上述目标,企业必须建立有效的内部控制体系,有效的内部
控制体系已成为企业可持续发展的关键。改革开放以来中国诸多企业的
兴衰成败也从某个侧面揭示了内部控制与采取风险管理的必要性,特别
是近年来德隆集团、格林柯尔等企业的覆灭,更是凸显其重要性。 

◇讲--师--资--历:
  章老师:(中国唯一纵横“财务、人力资源、管理”三大领域的“三栖”
实战财务专家)中国人民大学MBA,中国注册会计师(CPA)、注册税务师
(CPT),著名实战派财务管理专家与人力资源管理专家。历任江苏油田
江都油脂油品厂财务主管、江苏油田化工公司副总经理、扬州大公会计师
事务所首席注册会计师、中美合资上海美通生物科技有限公司首席财务官
兼泰州美通药业有限公司财务总监。精通财务管理咨询及税务策划、资本
运作、企业内部审计及内部控制与财务风险管理制度设计、项目可行性分
析及项目融资、人力资源管理与开发技术等,从管理的角度解读财务,从
财务的角度分析管理,能将专业的财税类课程讲解得通俗易懂且趣味横生
,先后为全国数十家企业提供深度咨询服务,为上百家企业提供企业内训
服务,成功举办过上百场大型公开课。主讲的《内部审计及内部控制与财
务风险管理》、《总经理的财务管理实战高级研修班》、《微利时代打造
企业竞争力的管理利器――全面预算管理与全面成本控制实战》、《企业
经营战略》、《新企业所得税法解读和应对策略及实施后的合法节税技巧
与涉税风险防范》、《税务策划技巧与实务》、《企业中高收入者的薪酬
奖金纳税筹划(避税)》、《税务风险规避与防范》、《房地产企业土地增
值税清算与筹划实务》、《非财务经理的财务管理》、《财务管理沙盘模
拟》、《公共关系与商务礼仪》、《企业营销理念与技巧》、《团队建设
与管理》、《非人力资源经理的人力资源管理》、《打造强势执行力》等
课程深受业内人士好评。接受过章先生培训指导的部分客户有:中国电信
、中国石油、中国石化、扬子江动力、宏福集团、亚星客车、奔驰汽车、
赛德电气、华山光电、恒诚织布、威克生物、星火锻压、红旗电缆、中机
环建、中油天工、正大饲料、广兴达集团、鹰游集团、京江大酒店、万科
房产、德美化工、深圳和立泰集团、珠海威丝曼服饰、安徽古井集团、河
南航空食品、上海三电、江都市发展与改革委员会、台州市经济与贸易委
员会……等上千企业,均受到客户的一致赞扬。
   授课风格:旁征博引,诙谐幽默,深入浅出。 

◇课--程--大--纲:
企业内部审计篇
一、内部审计的基本概念
(一)内部审计的概念
1)概念
2)目的
3)内部审计与外部审计的比较
(二)内部审计的发展阶段
1)控制
2)控制结构
3)企业风险
4)企业风险管理流程
(三)内部审计的角色
1)监督者
2)检察员
3)协助者
4)咨询师
(四)内部审计过程
1)理解期望
2)分析经营状况
3)确认程序与风险
4)分析程序与风险
5)汇报与跟踪
(五)基本审计方法
1)与管理层讨论
2)实地观察
3)审阅书面资料
4)抽样测试

二、内部审计与外部审计共同涉及的几大专业问题
1)审计通知书与审计业务约定书 
2)审计计划
3)重要性与审计风险
4)内外部审计的评价、协调与专家的使用
5)审计抽样
6)审计证据
7)审计工作底稿
8)审计报告
9)审计质量控制

三、内部审计具体准则讲解
1)内部控制审计
2)舞弊的预防检查与报告
3)后续审计
4)内部审计督导
5)结果沟通
6)遵循性审计
7)分析性复核
8)风险管理审计
10)人际关系
11)内部审计的控制自我评估法
12)内部审计机构与董事会或最高管理层的关系
13)内部审计机构的管理
14)经济性审计
15)效果性审计
16)效率性审计 

四、内部审计实施中需要关注的几个问题
1)符合性测试与实质性测试
2)重要性、审计风险与审计抽样
3)不同类型审计的特殊考虑

企业内部控制篇
一、内部控制概论
(一)内部控制的概念
1)内部控制的一般概念
2)COSO报告的定义
3)内部控制的种类
(二)内部控制的属性
1)职责分工
2)实物接触控制
3)内部核查
4)充分的书面记录
5)恰当的授权
(三)内部控制的种类
1)按控制性质分
2)按控制内容分
3)按控制地位分
4)按控制功能分
5)按控制时序分
(四)内部控制的设计原则
1)相互牵制
2)协调配合
3)岗位匹配
4)成本效益
5)整体结构
(五)控制点与控制技巧
1)一般控制点应建立在尽可能接近行动发生之处
2)一般控制技巧
总结:内部控制的局限

二、内部会计控制规范总揽
(一)内部会计控制规范(试行)
1)基本规范
2)货币资金
3)销售与收款
4)采购与付款
5)工程项目
6)担保
7)对外投资 
 (二)内部会计控制规范(征求意见稿)
1)成本费用
2)存货
3)预算
4)固定资产
5)筹资 

三、业务流程重组
(一)流程重组的症状
1)市场份额下降
2)交货期延长
3)竞争能力降低
4)生产率降低
5)客户满意度降低
6)环境剧变
(二)流程重组的步骤及各步骤的操作要点
1)制定重组策略
2)流程设计
3)实施
4)效果评估
(三)流程重组各步骤操作要点(最佳管理实践)
1)了解市场和客户
2)制定愿景和战略
3)设计产品和服务
4)市场营销
5)生产和配送产品及提供服务
6)向客户开票收款及提供服务
7)人力资源管理
8)财务管理
(四)业务流程图
1)业务流程涉及的部门
2)工作内容及步骤
3)部门间的相互关系
4)业务文件
5)业务流程图操作手册示例

四、内部控制实务
(一)常见的舞弊类型
1)虚报冒领
2)阴阳发票
3)无中生有
4)侵吞不报
5)模仿签字
6)假公济私
7)瞒天过海
8)里应外合
9)暗渡陈仓
10)混水摸鱼
11)偷梁换柱
12)张冠李戴
13)监守自盗
(二)内部控制的设计步骤
1)确定控制目标
2)整合控制流程
3)鉴别控制环节
4)确定控制措施
(三)内部控制实例详解
1)货币资金内控设计

Re: [PHP] exec output to mySQL, How?

2010-07-21 Thread Nilesh Govindarajan
On Wed, Jul 21, 2010 at 8:49 AM, Tom Sparks tom_a_spa...@yahoo.com.au wrote:
 How do I take the output from a command line program and update a MYSQL 
 database with it?

 tom_a_sparks
 Light travels faster then sound, which is why some people appear bright, 
 until you hear them speak




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



$cmdop=shell_exec('cmd');
$con=new mysqli(...);
// Check connection error
// Refer to php.net/mysqli
$con-multi_query($cmdop);

-- 
Regards,
Nilesh Govindarajan
Facebook: http://www.facebook.com/nilesh.gr
Twitter: http://twitter.com/nileshgr
Website: http://www.itech7.com

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



Re: [PHP] eval and HEREDOC

2010-07-21 Thread Peter Lind
On 21 July 2010 06:46, Sorin Buturugeanu m...@soin.ro wrote:
 @Vincent: no, the short tags are not off.

 @Jim: This seamns to work fine:

 $template = file_get_contents(pathTemplates.$this-dir.$this-tpl);
 ob_start();
 $template = eval('?'.$template);
 $template = ob_get_clean();

 Thanks!

 Best wishes!

 Sorin


 --
 Sorin Buturugeanu
 http://www.soin.ro




 On Wed, Jul 21, 2010 at 1:45 AM,  li...@cmsws.com wrote:



 On Wed, 21 Jul 2010 01:04:12 +0300, Sorin Buturugeanu m...@soin.ro wrote:
 Hello Vincent and thank you for your reply :).

 That's true, I forgot to explain how I got to using HEREDOC, so ..

 Using eval(file_get_contents($file)) just outputs the result on the
 spot and I need
 to get the whole output (without echoing it) and do some more things with
 it.

 require_once() doesn't fit here (from what I can tell), because it
 would still just
 include the file in echo the output.

 I think there must be a solution, but I'm missing something here  ..


 Check out the ob_* functions

 You could do this

 ob_start();

 include /your/file.php;

 $output = ob_get_clean();

 echo $output;

 Jim


 Thanks again!

 --
 Sorin Buturugeanu
 http://www.soin.ro


 On Wed, Jul 21, 2010 at 12:49 AM, Daevid Vincent dae...@daevid.com
 wrote:

  -Original Message-
  From: Sorin Buturugeanu [mailto:m...@soin.ro]
  Sent: Tuesday, July 20, 2010 2:11 PM
  To: php-general@lists.php.net
  Subject: [PHP] eval and HEREDOC
 
  Hello,
 
  I am having trouble with a part of my templating script. I'll
  try to explain:
 
  The template itself is HTML with PHP code inside it, like:
 
  div?=strtoupper($user['name']);?/div
 
  And I have the following code as part of the templating engine:
 
  $template = file_get_contents($file);
  $template = return TEMPLATE\n.$template.\nTEMPLATE;\n;
  $template = eval($template);
 
  The problem is that the eval() HEREDOC combination gives the
  following output:
 
  ?=strtoupper(Array['time']);?
 
  If in the HTML file (template) I use
 
  div?=strtoupper({$user['name']});?/div
 
  I get  ?=strtoupper(username);? as an output.
 
  I have tried closing the php tag like this:
 
  $template = return TEMPLATE\n?.$template.\nTEMPLATE;\n;
 
  but the extra ? only gets outputed as HTML.
 
  This is my first post to this mailing list, so I great you
  all and thank you for any kind of solution to my problem.

 Why are you using HEREDOC to begin with? I personally find them to be
 ugly
 and more trouble than they're worth.

 You can write the same thing as this I think (untested):

 $template = eval(file_get_contents($file));

 But you might also consider using include_once or require_once
 instead
 of this eval() business.

 Also note, that a string can span more than one line and have variables
 in
 it. It can even be used with code, so HEREDOC is again useless for most
 situations:

 $foo = 
 Hello $name,\n
 \n
 Today is .date('Y-m-d').\n
 \n
 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 \n
 Nulla eros purus, pharetra a blandit non, pellentesque et leo. In augue
 metus, mattis a sollicitudin in, placerat vitae elit.
 \n
 Quisque elit mauris, varius sit amet cursus sed, eleifend a mauris.
 ;


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


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



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



1) heredoc is great for not caring about escaping ' or . Whether or
not you like the syntax it's not hard to use in any way.
2) stay away from eval. Just don't use it unless you have no other choice
3) the include+output buffering solution is much better. Another
option would be to use markers in your templates and then just replace
them with content. Whether or not that would suit you depends on what
kinds of templates you're making and for what purpose

Regards
Peter

-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
/hype

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



Re: [PHP] MySQL select matching

2010-07-21 Thread Simcha Younger
On Mon, 19 Jul 2010 10:36:40 -0600
Ashley M. Kirchner ash...@pcraft.com wrote:


 mysql select * from table where id='1';
 +---+-+-+---+
 | 1 | 123 | 0.0 | C |
 | 1 | 234 | 0.1 | D |
 | 1 | 345 | 0.0 | D |
 | 1 | 456 | 0.1 | C |
 | 1 | 567 | 0.1 | G |
 +---+-+-+---+
 
  Now, I have to find other IDs that match the above result.  In the 
 table, that would be ID '3' (and in the entire DB, there may be 
 others as well - I need to find all those IDs.)  But, notice how ID 0003 
 isn't in the same order as ID 1, but the data is still the same.
 
select distinct id from `table` where concat(`b`, `c`, `d`) in (select 
concat(`b`,`c`,`d` from `table` where id = '0001') AND id != '0001';
(untested)

-- 
Simcha Younger sim...@syounger.com

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



Re: [PHP] exec output to mySQL, How?

2010-07-21 Thread Per Jessen
Tom Sparks wrote:

 How do I take the output from a command line program and update a
 MYSQL database with it?

command line program | mysql -u user -p -Ddatabase



-- 
Per Jessen, Zürich (22.6°C)


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



Re: [PHP] eval and HEREDOC

2010-07-21 Thread Sorin Buturugeanu
Hi Peter!

In the first version of the template engine I had markers but now I
need more complex conditions or operations inside the template files,
like array of arrays and so on. I really like the freedom to be able
to just open a PHP tag ? ? and use a foreach() or whatever PHP
function as I please.

Thanks again to all of you for your support! :)

Sorin

--
Sorin Buturugeanu
http://www.soin.ro



On Wed, Jul 21, 2010 at 9:47 AM, Peter Lind peter.e.l...@gmail.com wrote:
 On 21 July 2010 06:46, Sorin Buturugeanu m...@soin.ro wrote:
 @Vincent: no, the short tags are not off.

 @Jim: This seamns to work fine:

 $template = file_get_contents(pathTemplates.$this-dir.$this-tpl);
 ob_start();
 $template = eval('?'.$template);
 $template = ob_get_clean();

 Thanks!

 Best wishes!

 Sorin


 --
 Sorin Buturugeanu
 http://www.soin.ro




 On Wed, Jul 21, 2010 at 1:45 AM,  li...@cmsws.com wrote:



 On Wed, 21 Jul 2010 01:04:12 +0300, Sorin Buturugeanu m...@soin.ro wrote:
 Hello Vincent and thank you for your reply :).

 That's true, I forgot to explain how I got to using HEREDOC, so ..

 Using eval(file_get_contents($file)) just outputs the result on the
 spot and I need
 to get the whole output (without echoing it) and do some more things with
 it.

 require_once() doesn't fit here (from what I can tell), because it
 would still just
 include the file in echo the output.

 I think there must be a solution, but I'm missing something here  ..


 Check out the ob_* functions

 You could do this

 ob_start();

 include /your/file.php;

 $output = ob_get_clean();

 echo $output;

 Jim


 Thanks again!

 --
 Sorin Buturugeanu
 http://www.soin.ro


 On Wed, Jul 21, 2010 at 12:49 AM, Daevid Vincent dae...@daevid.com
 wrote:

  -Original Message-
  From: Sorin Buturugeanu [mailto:m...@soin.ro]
  Sent: Tuesday, July 20, 2010 2:11 PM
  To: php-general@lists.php.net
  Subject: [PHP] eval and HEREDOC
 
  Hello,
 
  I am having trouble with a part of my templating script. I'll
  try to explain:
 
  The template itself is HTML with PHP code inside it, like:
 
  div?=strtoupper($user['name']);?/div
 
  And I have the following code as part of the templating engine:
 
  $template = file_get_contents($file);
  $template = return TEMPLATE\n.$template.\nTEMPLATE;\n;
  $template = eval($template);
 
  The problem is that the eval() HEREDOC combination gives the
  following output:
 
  ?=strtoupper(Array['time']);?
 
  If in the HTML file (template) I use
 
  div?=strtoupper({$user['name']});?/div
 
  I get  ?=strtoupper(username);? as an output.
 
  I have tried closing the php tag like this:
 
  $template = return TEMPLATE\n?.$template.\nTEMPLATE;\n;
 
  but the extra ? only gets outputed as HTML.
 
  This is my first post to this mailing list, so I great you
  all and thank you for any kind of solution to my problem.

 Why are you using HEREDOC to begin with? I personally find them to be
 ugly
 and more trouble than they're worth.

 You can write the same thing as this I think (untested):

 $template = eval(file_get_contents($file));

 But you might also consider using include_once or require_once
 instead
 of this eval() business.

 Also note, that a string can span more than one line and have variables
 in
 it. It can even be used with code, so HEREDOC is again useless for most
 situations:

 $foo = 
 Hello $name,\n
 \n
 Today is .date('Y-m-d').\n
 \n
 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 \n
 Nulla eros purus, pharetra a blandit non, pellentesque et leo. In augue
 metus, mattis a sollicitudin in, placerat vitae elit.
 \n
 Quisque elit mauris, varius sit amet cursus sed, eleifend a mauris.
 ;


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


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



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



 1) heredoc is great for not caring about escaping ' or . Whether or
 not you like the syntax it's not hard to use in any way.
 2) stay away from eval. Just don't use it unless you have no other choice
 3) the include+output buffering solution is much better. Another
 option would be to use markers in your templates and then just replace
 them with content. Whether or not that would suit you depends on what
 kinds of templates you're making and for what purpose

 Regards
 Peter

 --
 hype
 WWW: http://plphp.dk / http://plind.dk
 LinkedIn: http://www.linkedin.com/in/plind
 BeWelcome/Couchsurfing: Fake51
 Twitter: http://twitter.com/kafe15
 /hype


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



Re: [PHP] exec output to mySQL, How?

2010-07-21 Thread Tom Sparks
--- On Wed, 21/7/10, Nilesh Govindarajan li...@itech7.com wrote:
 On Wed, Jul 21, 2010 at 8:49 AM, Tom
 Sparks tom_a_spa...@yahoo.com.au
 wrote:
  How do I take the output from a command line program
 and update a MYSQL database with it?
 
  tom_a_sparks
  Light travels faster then sound, which is why some
 people appear bright, until you hear them speak
 
 
 $cmdop=shell_exec('cmd');
 $con=new mysqli(...);
 // Check connection error
 // Refer to php.net/mysqli
 $con-multi_query($cmdop);
ok, thanks the program I am using reports a estimated time to completion, I 
understand I need a loop, but I cant work out how I would do this

run program
while program is running {
sleep 60 seconds
update mySQL with ET from program
}

tom


  

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



Re: [PHP] exec output to mySQL, How?

2010-07-21 Thread Nilesh Govindarajan
On Wed, Jul 21, 2010 at 12:29 PM, Per Jessen p...@computer.org wrote:
 Tom Sparks wrote:

 How do I take the output from a command line program and update a
 MYSQL database with it?

 command line program | mysql -u user -p -Ddatabase



 --
 Per Jessen, Zürich (22.6°C)


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



I don't think this is what he needs? Otherwise why would he post on a
PHP list lol.

-- 
Regards,
Nilesh Govindarajan
Facebook: http://www.facebook.com/nilesh.gr
Twitter: http://twitter.com/nileshgr
Website: http://www.itech7.com

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



Re: [PHP] exec output to mySQL, How?

2010-07-21 Thread Nilesh Govindarajan
On Wed, Jul 21, 2010 at 12:39 PM, Tom Sparks tom_a_spa...@yahoo.com.au wrote:
 --- On Wed, 21/7/10, Nilesh Govindarajan li...@itech7.com wrote:
 On Wed, Jul 21, 2010 at 8:49 AM, Tom
 Sparks tom_a_spa...@yahoo.com.au
 wrote:
  How do I take the output from a command line program
 and update a MYSQL database with it?
 
  tom_a_sparks
  Light travels faster then sound, which is why some
 people appear bright, until you hear them speak
 

 $cmdop=shell_exec('cmd');
 $con=new mysqli(...);
 // Check connection error
 // Refer to php.net/mysqli
 $con-multi_query($cmdop);
 ok, thanks the program I am using reports a estimated time to completion, I 
 understand I need a loop, but I cant work out how I would do this

 run program
 while program is running {
 sleep 60 seconds
 update mySQL with ET from program
 }

 tom





You want to calculate how much time the query takes?

-- 
Regards,
Nilesh Govindarajan
Facebook: http://www.facebook.com/nilesh.gr
Twitter: http://twitter.com/nileshgr
Website: http://www.itech7.com

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



[PHP] MySQL+PHP

2010-07-21 Thread Diana Wu
Dear all,


I'm a newbie, need your help.
Now I am building a databasea using MySQL and PHP, I want to put two tables
in one searching, the two are in one database.

$query = SELECT SQL_CALC_FOUND_ROWS * FROM table1 WHERE .implode( AND
, $data);
$number = SELECT FOUND_ROWS();
How can I change this if I want to put table2 in it.

Thank you.


Best wishes,

diana
2010-7-21


Re: [PHP] exec output to mySQL, How?

2010-07-21 Thread Ashley Sheridan
On Wed, 2010-07-21 at 12:57 +0530, Nilesh Govindarajan wrote:

 On Wed, Jul 21, 2010 at 12:29 PM, Per Jessen p...@computer.org wrote:
  Tom Sparks wrote:
 
  How do I take the output from a command line program and update a
  MYSQL database with it?
 
  command line program | mysql -u user -p -Ddatabase
 
 
 
  --
  Per Jessen, Zürich (22.6°C)
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 I don't think this is what he needs? Otherwise why would he post on a
 PHP list lol.
 
 -- 
 Regards,
 Nilesh Govindarajan
 Facebook: http://www.facebook.com/nilesh.gr
 Twitter: http://twitter.com/nileshgr
 Website: http://www.itech7.com
 


Because many people wouldn't know that Linux can happily deal with this
on the command line, so would assume they would have to use a scripting
language to perform the task.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] exec output to mySQL, How?

2010-07-21 Thread Per Jessen
Nilesh Govindarajan wrote:

 On Wed, Jul 21, 2010 at 12:29 PM, Per Jessen p...@computer.org wrote:
 Tom Sparks wrote:

 How do I take the output from a command line program and update a
 MYSQL database with it?

 command line program | mysql -u user -p -Ddatabase

 
 I don't think this is what he needs? Otherwise why would he post on a
 PHP list lol.

Who knows, but I answered his question.  Besides, he doesn't need PHP to
do mysql updates with output from a command line program. 



-- 
Per Jessen, Zürich (23.3°C)


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



RE: [PHP] php array in different OS

2010-07-21 Thread Bob McConnell
From: fyang

 I have a simple test code in different OS ,but it give me a
different 
 result.
 the code as follows:
?php
 $n= 5;
 for($i=0;$i$n;$i++)
 {
  $data[]=array(,$i,$i/1000);
  echo $i,  ,$data[$i][1],br;
 }
 echo count:,count($data);
?
OS1:  Red Hat Enterprise Linux Server release 5.1
  Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux
test result:  the result is correct,it can display 5 data and 
 count:5.
 
OS2: CentOS release 5.4
 Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux
test result: the result is wrong,it can only display 31148 data and
it 
 can not display count value.
I'm not sure the result relate to array capacity in different OS.
Please give me some tips,thanks in advance.

Did you really have to post the same message eight times?

CentOS is Red Hat minus the proprietary elements, so you actually have
two releases of the same OS here. The bigger question is what version of
PHP are you running on each of them and how are they configured?

Bob McConnell

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



[PHP] PDO and UPDATE problem

2010-07-21 Thread Sky Gunning
Hello

I have a problem with a update using PDO.
(learning atm and updating a php class to use PDO)

private function updateUser($id)
{
$date = mktime();

$DB = Db::getInstance();

$stmt = $DB-prepare('UPDATE  '. TBL_USERS .' SET
date_last_action=:updateDate WHERE id=:userId');
$stmt-bindParam(:updateDate, $date);
$stmt-bindParam(:userId, $id);
$stmt-execute();
}

It does not work.
I get this :

Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[42000]: Syntax error or access violation: 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 'UPDATE mf_Users SET
date_last_action='1279717039' WHERE id='1'' at line 1' in
/public_html/forum/includes/classes/Auth.class.php on line *157*

PDO works and is fine with my SELECT request's. Does not seam to work with
this simple UPDATE. I tested the request in PHPMyAdmin and it works. (UPDATE
mf_Users SET date_last_action='1279717039' WHERE id='1')


Thx,

Sky


Re: [PHP] PDO and UPDATE problem

2010-07-21 Thread Peter Lind
On 21 July 2010 15:04, Sky Gunning sky.gunn...@gmail.com wrote:
 Hello

 I have a problem with a update using PDO.
 (learning atm and updating a php class to use PDO)

    private function updateUser($id)
    {
        $date = mktime();

        $DB = Db::getInstance();

        $stmt = $DB-prepare('UPDATE  '. TBL_USERS .' SET
 date_last_action=:updateDate WHERE id=:userId');

Try without the extra quotation mark before UPDATE.

Regards
Peter

-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
/hype

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



[PHP] ��|部|审|��|与|��|控|�L|�U|管|理

2010-07-21 Thread bftvetq
下午 10:04:12;ZFWAR3WSDGT4WE633E63XG


  内 部 审 计 及 内 部 控 制 与 财 务 风 险 管 理 

 时 间:2010年7月29-30日(上 海)
 时 间:2010年8月06-07日(深 圳)

◆参课对象: 董事会、监事会成员;负责内部控制和内部审计部门的经理
、主管;总经理、财务副总经理以及其他高级经营管理人员;财务总监、财
务经理、财务主管、税务经理、税务主管、总帐会计、税务会计等具体操
作人士。

◆说  明:凡希望参加认证的学员,在课程结束后参加认证考试并合格者,
颁发“香港培训认证中心国际职业资格认证中心HKTCC”《国际注册
财务管理师(内部审计与内部控制管理方向)》职业资格证书。(国际认
证/全球通行/雇主认可/联网查询)。(课程结束10日内快递给学员)。

◇课--程--背--景:
如何确保企业经营的效率和效果?
如何确保企业财务报告的可靠性? 
如何保证企业始终遵守法律法规?
如何保证企业资产的安全?
如何评估与防范财务风险,保证企业永续经营?
如何通过内部审计发现企业经营异常并及时采取有效措施? 
  为了实现上述目标,企业必须建立有效的内部控制体系,有效的内部
控制体系已成为企业可持续发展的关键。改革开放以来中国诸多企业的
兴衰成败也从某个侧面揭示了内部控制与采取风险管理的必要性,特别
是近年来德隆集团、格林柯尔等企业的覆灭,更是凸显其重要性。 

◇讲--师--资--历:
  章老师:(中国唯一纵横“财务、人力资源、管理”三大领域的“三栖”
实战财务专家)中国人民大学MBA,中国注册会计师(CPA)、注册税务师
(CPT),著名实战派财务管理专家与人力资源管理专家。历任江苏油田
江都油脂油品厂财务主管、江苏油田化工公司副总经理、扬州大公会计师
事务所首席注册会计师、中美合资上海美通生物科技有限公司首席财务官
兼泰州美通药业有限公司财务总监。精通财务管理咨询及税务策划、资本
运作、企业内部审计及内部控制与财务风险管理制度设计、项目可行性分
析及项目融资、人力资源管理与开发技术等,从管理的角度解读财务,从
财务的角度分析管理,能将专业的财税类课程讲解得通俗易懂且趣味横生
,先后为全国数十家企业提供深度咨询服务,为上百家企业提供企业内训
服务,成功举办过上百场大型公开课。主讲的《内部审计及内部控制与财
务风险管理》、《总经理的财务管理实战高级研修班》、《微利时代打造
企业竞争力的管理利器――全面预算管理与全面成本控制实战》、《企业
经营战略》、《新企业所得税法解读和应对策略及实施后的合法节税技巧
与涉税风险防范》、《税务策划技巧与实务》、《企业中高收入者的薪酬
奖金纳税筹划(避税)》、《税务风险规避与防范》、《房地产企业土地增
值税清算与筹划实务》、《非财务经理的财务管理》、《财务管理沙盘模
拟》、《公共关系与商务礼仪》、《企业营销理念与技巧》、《团队建设
与管理》、《非人力资源经理的人力资源管理》、《打造强势执行力》等
课程深受业内人士好评。接受过章先生培训指导的部分客户有:中国电信
、中国石油、中国石化、扬子江动力、宏福集团、亚星客车、奔驰汽车、
赛德电气、华山光电、恒诚织布、威克生物、星火锻压、红旗电缆、中机
环建、中油天工、正大饲料、广兴达集团、鹰游集团、京江大酒店、万科
房产、德美化工、深圳和立泰集团、珠海威丝曼服饰、安徽古井集团、河
南航空食品、上海三电、江都市发展与改革委员会、台州市经济与贸易委
员会……等上千企业,均受到客户的一致赞扬。
   授课风格:旁征博引,诙谐幽默,深入浅出。 

◇课--程--大--纲:
企业内部审计篇
一、内部审计的基本概念
(一)内部审计的概念
1)概念
2)目的
3)内部审计与外部审计的比较
(二)内部审计的发展阶段
1)控制
2)控制结构
3)企业风险
4)企业风险管理流程
(三)内部审计的角色
1)监督者
2)检察员
3)协助者
4)咨询师
(四)内部审计过程
1)理解期望
2)分析经营状况
3)确认程序与风险
4)分析程序与风险
5)汇报与跟踪
(五)基本审计方法
1)与管理层讨论
2)实地观察
3)审阅书面资料
4)抽样测试

二、内部审计与外部审计共同涉及的几大专业问题
1)审计通知书与审计业务约定书 
2)审计计划
3)重要性与审计风险
4)内外部审计的评价、协调与专家的使用
5)审计抽样
6)审计证据
7)审计工作底稿
8)审计报告
9)审计质量控制

三、内部审计具体准则讲解
1)内部控制审计
2)舞弊的预防检查与报告
3)后续审计
4)内部审计督导
5)结果沟通
6)遵循性审计
7)分析性复核
8)风险管理审计
10)人际关系
11)内部审计的控制自我评估法
12)内部审计机构与董事会或最高管理层的关系
13)内部审计机构的管理
14)经济性审计
15)效果性审计
16)效率性审计 

四、内部审计实施中需要关注的几个问题
1)符合性测试与实质性测试
2)重要性、审计风险与审计抽样
3)不同类型审计的特殊考虑

企业内部控制篇
一、内部控制概论
(一)内部控制的概念
1)内部控制的一般概念
2)COSO报告的定义
3)内部控制的种类
(二)内部控制的属性
1)职责分工
2)实物接触控制
3)内部核查
4)充分的书面记录
5)恰当的授权
(三)内部控制的种类
1)按控制性质分
2)按控制内容分
3)按控制地位分
4)按控制功能分
5)按控制时序分
(四)内部控制的设计原则
1)相互牵制
2)协调配合
3)岗位匹配
4)成本效益
5)整体结构
(五)控制点与控制技巧
1)一般控制点应建立在尽可能接近行动发生之处
2)一般控制技巧
总结:内部控制的局限

二、内部会计控制规范总揽
(一)内部会计控制规范(试行)
1)基本规范
2)货币资金
3)销售与收款
4)采购与付款
5)工程项目
6)担保
7)对外投资 
 (二)内部会计控制规范(征求意见稿)
1)成本费用
2)存货
3)预算
4)固定资产
5)筹资 

三、业务流程重组
(一)流程重组的症状
1)市场份额下降
2)交货期延长
3)竞争能力降低
4)生产率降低
5)客户满意度降低
6)环境剧变
(二)流程重组的步骤及各步骤的操作要点
1)制定重组策略
2)流程设计
3)实施
4)效果评估
(三)流程重组各步骤操作要点(最佳管理实践)
1)了解市场和客户
2)制定愿景和战略
3)设计产品和服务
4)市场营销
5)生产和配送产品及提供服务
6)向客户开票收款及提供服务
7)人力资源管理
8)财务管理
(四)业务流程图
1)业务流程涉及的部门
2)工作内容及步骤
3)部门间的相互关系
4)业务文件
5)业务流程图操作手册示例

四、内部控制实务
(一)常见的舞弊类型
1)虚报冒领
2)阴阳发票
3)无中生有
4)侵吞不报
5)模仿签字
6)假公济私
7)瞒天过海
8)里应外合
9)暗渡陈仓
10)混水摸鱼
11)偷梁换柱
12)张冠李戴
13)监守自盗
(二)内部控制的设计步骤
1)确定控制目标
2)整合控制流程
3)鉴别控制环节
4)确定控制措施
(三)内部控制实例详解
1)货币资金内控设计
2)销售与收款业务内控设计 
3)生产循环内控设计
4)采购与付款业务内控设计 
5)筹资与投资内控设计
6)预算控制制度
7)成本控制规范 
(四)建立内部控制系统必须考虑的重要因素
1)控制环境
2)内部牵制
3)内部审计
4)财务内控

企业财务风险及防范篇
一、财务风险的一般概念、种类、特征及其成因分析 
(一)财务风险的一般概念
1)财务风险的概念
2)财务风险与经营风险的区别
(二)财务风险的种类 
1)筹资风险
2)投资风险
3)资金回收风险
4)收益分配风险。 
(三)财务风险的特征 
1)客观性
2)全面性
3)不确定性
4)激励性
(四)企业财务风险成因分析
1)环境影响
2)资产结构与资本结构不合理
3)财务决策失误
4)管理人员认知偏差

二、财务风险的评估与控制
(一)财务风险的评估(Z-SCORE模型)
(二)财务风险的控制与防范措施
1)分配法
2)回避法 

3)转移法
4)降低法 
---
★主-办-单-位:中--培--信--息--网

★学-习-费-用: 2600元/人(含指定教材、午餐、茶点费等)

★认-证-费-用:500元/人(不参加认证考试的学员无须交纳此费用)。

★报-名-咨-询:T E L: (0755) 61280152(深 圳)

★报-名-咨-询:T E L: (0 2 1) 51083290(上 海)
---
 【报―名―回―执―表】

   F A X:(07 55)61280153 或 (0 2 1) 51083296

我单位共_人报名参加2010年___月__日在□上海、□深圳举办的:

《内部审计及内部控制与财务风险管理》;

单位名称:_ 参会人数:_人 

联系人: 电 话:_ 传 真:

参会费用 ¥:___元   邮 件:___

参 会 人:_

付款方式: □1、现金 □2、转帐 

预订项目:□是、□否 住宿(请选择打“√”)

预订项目:□是、□否 参加资格认证(请选择打“√”)

备注:请您把报名回执回传我司,��确保您报名无误,请您再次电话确认!


[PHP] Question about SQL and Graph nodel trees

2010-07-21 Thread Tim Gallagher
I cannot be the only one that is having this problem, what are you using for 
DAG (Direct Acrylic Graph)?  I need to have a mesh node edge graph and am 
having trouble with this?  I see that Neo4j has a rest server and I can do this 
in Java but I want to do it in PHP with a MYSQL or postgresql.  If you are 
doing something like this, can you please tell me how you are doing this.  I 
can do a relationship with a parent child or a nested tree, but I need to do a 
DAG.

Thanks for the help,
timgerr


[PHP] Extending Exception

2010-07-21 Thread Christoph Boget
Ok, so taking the sample code that is on the page

http://us3.php.net/manual/en/language.exceptions.extending.php

Literally, just cutting and pasting the code.  When I try to

throw new Exception( 'My Message' );

PHP spits out the following fatal error:

Fatal error: Wrong parameters for Exception([string $exception [, long $code ]])

and the line number it dies on is the line in the
MyException::__construct() where it is calling the parent's
constructor.  So what's going on?  Is the documentation wrong?  Is
this a bug?  Am I doing something wrong?

I'm using PHP 5.2.9.

thnx,
Christoph

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



Re: [PHP] Extending Exception

2010-07-21 Thread Ashley Sheridan
On Wed, 2010-07-21 at 11:10 -0400, Christoph Boget wrote:

 Ok, so taking the sample code that is on the page
 
 http://us3.php.net/manual/en/language.exceptions.extending.php
 
 Literally, just cutting and pasting the code.  When I try to
 
 throw new Exception( 'My Message' );
 
 PHP spits out the following fatal error:
 
 Fatal error: Wrong parameters for Exception([string $exception [, long $code 
 ]])
 
 and the line number it dies on is the line in the
 MyException::__construct() where it is calling the parent's
 constructor.  So what's going on?  Is the documentation wrong?  Is
 this a bug?  Am I doing something wrong?
 
 I'm using PHP 5.2.9.
 
 thnx,
 Christoph
 


Well, it's not really a copy and paste job, as you've omitted the second
argument to the Exception method, which is what the error is complaining
about.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Extending Exception

2010-07-21 Thread Richard Quadling
On 21 July 2010 16:10, Christoph Boget jcbo...@hotmail.com wrote:
 Ok, so taking the sample code that is on the page

 http://us3.php.net/manual/en/language.exceptions.extending.php

 Literally, just cutting and pasting the code.  When I try to

 throw new Exception( 'My Message' );

 PHP spits out the following fatal error:

 Fatal error: Wrong parameters for Exception([string $exception [, long $code 
 ]])

 and the line number it dies on is the line in the
 MyException::__construct() where it is calling the parent's
 constructor.  So what's going on?  Is the documentation wrong?  Is
 this a bug?  Am I doing something wrong?

 I'm using PHP 5.2.9.

 thnx,
 Christoph

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



As of V5.3.0, exceptions can be nested [1].

The example code will generate the following errors.

V5.0.x : Fatal error: Argument 3 must not be null
V5.1.0 - V5.1.1 : Fatal error: Wrong parameter count for
exception([string $exception [, long $code ]])
V5.1.1 - V5.2.x : Fatal error: Wrong parameters for Exception([string
$exception [, long $code ]])

The nesting is controlled by the 3rd parameter to the constructor.
Removing this will allow the code to work on your version.

?php
class MyException extends Exception
{
// Redefine the exception so message isn't optional
public function __construct($message, $code = 0) {
// some code

// make sure everything is assigned properly
parent::__construct($message, $code);
}

// custom string representation of object
public function __toString() {
return __CLASS__ . : [{$this-code}]: {$this-message}\n;
}

public function customFunction() {
echo A custom function for this type of exception\n;
}
}

?


Regards,

Richard Quadling.

[1] http://us3.php.net/manual/en/migration53.new-features.php

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



Re: [PHP] Extending Exception

2010-07-21 Thread Richard Quadling
On 21 July 2010 16:14, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
 On Wed, 2010-07-21 at 11:10 -0400, Christoph Boget wrote:

 Ok, so taking the sample code that is on the page

 http://us3.php.net/manual/en/language.exceptions.extending.php

 Literally, just cutting and pasting the code.  When I try to

 throw new Exception( 'My Message' );

 PHP spits out the following fatal error:

 Fatal error: Wrong parameters for Exception([string $exception [, long $code 
 ]])

 and the line number it dies on is the line in the
 MyException::__construct() where it is calling the parent's
 constructor.  So what's going on?  Is the documentation wrong?  Is
 this a bug?  Am I doing something wrong?

 I'm using PHP 5.2.9.

 thnx,
 Christoph



 Well, it's not really a copy and paste job, as you've omitted the second
 argument to the Exception method, which is what the error is complaining
 about.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk




Ashley, the second argument is optional, hence the [] around the [, long $code].

The issue is one of BC as I've described above. Removing the BC allows
the code to work as documented.

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



Re: [PHP] Question about SQL and Graph nodel trees

2010-07-21 Thread Andrew Ballard
On Wed, Jul 21, 2010 at 11:04 AM, Tim Gallagher tgallag...@danati.com wrote:
 I cannot be the only one that is having this problem, what are you using for 
 DAG (Direct Acrylic Graph)?  I need to have a mesh node edge graph and am 
 having trouble with this?  I see that Neo4j has a rest server and I can do 
 this in Java but I want to do it in PHP with a MYSQL or postgresql.  If you 
 are doing something like this, can you please tell me how you are doing this. 
  I can do a relationship with a parent child or a nested tree, but I need to 
 do a DAG.

 Thanks for the help,
 timgerr


A basic approach would be to use two tables - one to store the nodes
and second table to store the edges between the nodes. As far as
traversing the graph, the best approach I have seen expands this a bit
to store the full transitive closure of the graph, rather than just
the direct edges:

http://www.codeproject.com/KB/database/Modeling_DAGs_on_SQL_DBs.aspx

It is written for SQL Server, but the idea works OK (and I
successfully tested it once) in MySQL. (I imagine the same would be
true for PostgreSQL.)

The idea is to store the transitive closure (every possible path) of
the entire graph. For instance, if you have a basic graph

A - B - C - D

it stores these paths:

A - B
B - C
C - D
A - C
B - D
A - D

The obvious downside is that edge table can get incredibly large
depending on the nature of the graph you are modeling. (The article
provides much more detail.) I did, however, import a good chunk of an
Active Directory tree (just users and groups, not the full list of
attributes) into this pattern just to test the concept, and I found
that in that case the size of the transitive closure table did not get
out of hand.


Andrew

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



Re: [PHP] Extending Exception

2010-07-21 Thread Richard Quadling
On 21 July 2010 16:30, Christoph Boget jcbo...@hotmail.com wrote:
 [1] http://us3.php.net/manual/en/migration53.new-features.php

 Thanks for this.  And thanks for your explanation.  I think it would have
 been nice for there to have been some mention anywhere near/around example
 #2 on http://us3.php.net/manual/en/language.exceptions.extending.php to have
 mentioned it would only work on 5.3+.  :/
 Again, thanks.
 thnx,
 Christoph

http://svn.php.net/viewvc?view=revisionrevision=301446

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



[PHP] What are the curly brackets around variables in SQL statements for?

2010-07-21 Thread Dotan Cohen
Take for example:
INSERT INTO table ( field ) VALUES ('{$variable}' )

Why the curly brackets? Where in the fine manual is this addressed? I
started from [1] but did not find the relevant info.

[1] http://il2.php.net/manual/en/book.mysql.php

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

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



Re: [PHP] What are the curly brackets around variables in SQL statements for?

2010-07-21 Thread Daniel Brown
On Wed, Jul 21, 2010 at 14:59, Dotan Cohen dotanco...@gmail.com wrote:
 Take for example:
 INSERT INTO table ( field ) VALUES ('{$variable}' )

 Why the curly brackets? Where in the fine manual is this addressed? I
 started from [1] but did not find the relevant info.

 [1] http://il2.php.net/manual/en/book.mysql.php

That's just basic variable parsing on the PHP side, it's not
MySQL-specific.  Check out the variable parsing heading at
http://php.net/string .

-- 
/Daniel P. Brown
UNADVERTISED DEDICATED SERVER SPECIALS
SAME-DAY SETUP
Just ask me what we're offering today!
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/

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



Re: [PHP] What are the curly brackets around variables in SQL statements for?

2010-07-21 Thread Dotan Cohen
On Wed, Jul 21, 2010 at 22:07, Daniel Brown danbr...@php.net wrote:
    That's just basic variable parsing on the PHP side, it's not
 MySQL-specific.  Check out the variable parsing heading at
 http://php.net/string .


Thanks, Daniel. It seems unnecessary, then, as the quote character is
not a valid character in a variable name.


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

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



Re: [PHP] What are the curly brackets around variables in SQL statements for?

2010-07-21 Thread Nathan Nobbe
On Wed, Jul 21, 2010 at 1:17 PM, Dotan Cohen dotanco...@gmail.com wrote:

 On Wed, Jul 21, 2010 at 22:07, Daniel Brown danbr...@php.net wrote:
 That's just basic variable parsing on the PHP side, it's not
  MySQL-specific.  Check out the variable parsing heading at
  http://php.net/string .
 

 Thanks, Daniel. It seems unnecessary, then, as the quote character is
 not a valid character in a variable name.


the single quote is not part of the variable name in the example you posted
and further more the curly braces won't be evaluated as part of a variable
name unless the string expression is wrapped in double quotes (which probly
also evaluates in heredocs  nowdocs).  in this case, i would say you are
right, the curly braces seem gratuitous; again as dan suggested, read the
docs for clarification ...

http://us.php.net/manual/en/language.types.string.php#language.types.string.parsing

-nathan


Re: [PHP] What are the curly brackets around variables in SQL statements for?

2010-07-21 Thread Dotan Cohen
On Wed, Jul 21, 2010 at 22:27, Nathan Nobbe quickshif...@gmail.com wrote:
 the single quote is not part of the variable name in the example you posted
 and further more the curly braces won't be evaluated as part of a variable
 name unless the string expression is wrapped in double quotes (which probly
 also evaluates in heredocs  nowdocs).  in this case, i would say you are
 right, the curly braces seem gratuitous; again as dan suggested, read the
 docs for clarification ...
 http://us.php.net/manual/en/language.types.string.php#language.types.string.parsing

Thanks, Nathan, I _just_finished_ reading that page!



-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

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



Re: [PHP] What are the curly brackets around variables in SQL statements for?

2010-07-21 Thread Nathan Nobbe
On Wed, Jul 21, 2010 at 1:32 PM, Daniel Brown danbr...@php.net wrote:

 On Wed, Jul 21, 2010 at 15:27, Nathan Nobbe quickshif...@gmail.com
 wrote:
 
 [snip!]
  name unless the string expression is wrapped in double quotes (which
 probly
  also evaluates in heredocs  nowdocs).
 [snip!]

Close.  HEREDOC, yes.  NOWDOC, no.  There's zero parsing done on
 NOWDOC strings.


word.

-nathan


Re: [PHP] What are the curly brackets around variables in SQL statements for?

2010-07-21 Thread Daniel Brown
On Wed, Jul 21, 2010 at 15:27, Nathan Nobbe quickshif...@gmail.com wrote:

[snip!]
 name unless the string expression is wrapped in double quotes (which probly
 also evaluates in heredocs  nowdocs).
[snip!]

Close.  HEREDOC, yes.  NOWDOC, no.  There's zero parsing done on
NOWDOC strings.

-- 
/Daniel P. Brown
UNADVERTISED DEDICATED SERVER SPECIALS
SAME-DAY SETUP
Just ask me what we're offering today!
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/

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



RE: [PHP] Question about SQL and Graph nodel trees

2010-07-21 Thread Tim Gallagher
Thank you for the informaiton.  I did see that code but it looks like it is 
formatted for MSSQL and was unable to get it to work for Mysql.

Tim 


From: Andrew Ballard [aball...@gmail.com]
Sent: Wednesday, July 21, 2010 11:40 AM
To: Tim Gallagher
Cc: php-general@lists.php.net
Subject: Re: [PHP] Question about SQL and Graph nodel trees

On Wed, Jul 21, 2010 at 11:04 AM, Tim Gallagher tgallag...@danati.com wrote:
 I cannot be the only one that is having this problem, what are you using for 
 DAG (Direct Acrylic Graph)?  I need to have a mesh node edge graph and am 
 having trouble with this?  I see that Neo4j has a rest server and I can do 
 this in Java but I want to do it in PHP with a MYSQL or postgresql.  If you 
 are doing something like this, can you please tell me how you are doing this. 
  I can do a relationship with a parent child or a nested tree, but I need to 
 do a DAG.

 Thanks for the help,
 timgerr


A basic approach would be to use two tables - one to store the nodes
and second table to store the edges between the nodes. As far as
traversing the graph, the best approach I have seen expands this a bit
to store the full transitive closure of the graph, rather than just
the direct edges:

http://www.codeproject.com/KB/database/Modeling_DAGs_on_SQL_DBs.aspx

It is written for SQL Server, but the idea works OK (and I
successfully tested it once) in MySQL. (I imagine the same would be
true for PostgreSQL.)

The idea is to store the transitive closure (every possible path) of
the entire graph. For instance, if you have a basic graph

A - B - C - D

it stores these paths:

A - B
B - C
C - D
A - C
B - D
A - D

The obvious downside is that edge table can get incredibly large
depending on the nature of the graph you are modeling. (The article
provides much more detail.) I did, however, import a good chunk of an
Active Directory tree (just users and groups, not the full list of
attributes) into this pattern just to test the concept, and I found
that in that case the size of the transitive closure table did not get
out of hand.


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



Re: [PHP] php array in different OS

2010-07-21 Thread fyang
Dear Bob McConnell,
   Thank you for your reply.
   I really post the same message eight times because of the first e-mail 
authentication.please remove the extra e-mail in your free time.
   There are two servers ,the first installation of 32-bit linux(RHEL),the 
second installlation 64-bit linux(CENTOS).
   PHP version on 32-bit linux(RHEL):5.2.7
   PHP version on 64-bit linux(CENTOS):5.2.13
  I found this problem,because the software transplantation.In the 64-bit 
systems,the array seems to always have limited capacity. I'm not sure that is 
php version problem or need other configurations.
  Please give further guidance, thank you very much!


best wishs,

Yang Fei
2010-7-22








发件人: Bob McConnell 
发送时间: 2010-07-21  20:06:36 
收件人: fyang; php-general@lists.php.net 
抄送: 
主题: RE: [PHP] php array in different OS 
 
From: fyang

 I have a simple test code in different OS ,but it give me a
different 
 result.
 the code as follows:
 ?php
 $n= 5;
 for($i=0;$i $n;$i++)
 {
  $data[]=array(,$i,$i/1000);
  echo $i,  ,$data[$i][1], br ;
 }
 echo count:,count($data);
? 
OS1:  Red Hat Enterprise Linux Server release 5.1
  Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux
test result:  the result is correct,it can display 5 data and 
 count:5.
 
OS2: CentOS release 5.4
 Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux
test result: the result is wrong,it can only display 31148 data and
it 
 can not display count value.
I'm not sure the result relate to array capacity in different OS.
Please give me some tips,thanks in advance.

Did you really have to post the same message eight times?

CentOS is Red Hat minus the proprietary elements, so you actually have
two releases of the same OS here. The bigger question is what version of
PHP are you running on each of them and how are they configured?

Bob McConnell