[PHP] class object vs array for db table model

2010-10-11 Thread Tommy Pham
Hi everyone,

It's been a couple years since I've did a project in PHP.  The current
project I'm working on is for PHP 5.3 and I noticed a performance issue.  Is
it just me or is there a BIG difference in performance between class object
vs array for PHP 5.3?  Below is the sample:

class MyTable
{
private $_id; // int
private $_name; // varchar
private $_description; // text

public  function __construct() {}

public function getId()
{
return $this->_id;
}
public function getName()
{
return $this->_name;
}
public function getDescription()
{
return $this->_description;
}

public function setId($id)
{
$this->_id = $id;
}
public function setName($name)
{
$this->_name = $name;
}
public function setDescription($description)
{
$this->_description = $description;
}
}

$my_table = array ('id' => 'id value', 'name' => 'name value', 'description'
=> 'long description text');

The above are representations for my table as class and as array,
respectively.  The only difference is how I represent the results from db:

1) as class object
$list = array();
while ($row = $db->fetch($result))
{
$my_table = new MyTable();
$my_table->setId($row['id']);
$my_table->setName($row['name']);
$my_table->setDescription($row['description']);

$list[$my_table->getId()] = $my_table;
}

2) as table
$list = array();
while ($row = $db->fetch($result))
{
$my_table['id'] = $row['id'];
$my_table['name'] = $row['name'];
$my_table['description'] = $row['description'];

$list[$my_table['id'] = $my_table;
}

The performance difference I get is about 1.4 seconds with the array in the
lead!!!  Does anyone have the same problem? 

Thanks,
Tommy

PS: The above executed in 4.2 sec and 1.8 sec (on average) respectively w/o
actually showing the results to html, while my ASP.NET project executes it
and displays in html in about 2 seconds for all 3684 rows, using class
similar to the MyTable.  All codes, PHP & ASP.NET C#, access the same MySQL
DB on the same development box.


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



RE: [PHP] Unknown Table i field list

2010-10-11 Thread Tommy Pham
> -Original Message-
> From: Kranthi Krishna [mailto:kranthi...@gmail.com]
> Sent: Monday, October 11, 2010 5:40 PM
> To: Gary
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Unknown Table i field list
> 
> echo $query;
> before
> $result = mysqli_query($dbc, $query);
> might be of help to understand what is going wrong
> 
> copy that query and execute in phpMyAdmin
> 

Or if you're on Windows, use the MySQL workbench (I don't know if it's
available on other platform) to create your sql statements.  For select, you
can do a test run of the query to see how well your DB & sql query is
optimized ;) so you'll get the idea of where any performance bottleneck is
later on :).  For example, my 2 table join select statement of 3684 rows has
initial execution time of 0.031 sec with fetch of 0.016 sec.  Subsequent
runs have 0.000 and 0.000, respectively.  Also, if you use the workbench, it
will encapsulate the fields and table(s) with ` so you know that your will
query should run without any possible mishap such as where you may have a
column name of 'name'.  Another plus is speed of which you can accurately
create your queries on the workbench.

Regards,
Tommy


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



[PHP] Re: Unknown Table i field list Solved

2010-10-11 Thread Gary

""Gary""  wrote in message 
news:75.f4.27779.7f063...@pb1.pair.com...
>I am getting an error of "unkown talbe "formcom" in field list".
>
> I dont understand this.  I have a talbe called formcom in the database, in 
> fact I created this talbe to replace the first one named comments just in 
> case the table name comments was not allowed.
>
> I have used this same script a number of time, this is the first time I am 
> getting this error
>
> Here is the scritpt
>
>
> $dbc = mysqli_connect('server','username',password','db name')
> or die('Error connecting to MySQL server');
>
> $query = "INSERT INTO formcom(fname, lname, email, comment, ip)" . "VALUES 
> ('$fname','$lname','$email'.'$comment','$ip')"
> or die('error in query');
>
> $result = mysqli_query($dbc, $query)
> or die('Error in Result');
>
> mysqli_close($dbc);
>
> I have also tried formcom.fname, formcom.lname, formcomemail, 
> formcomcomment, formcom.ip
>
> I have double triple quad checked to make sure I did not have comment and 
> comments mix up.
>
> Anyone be able to help me?
>
> Thank you
>
> Gary
I put the database into a serperate function and it seems to work nowgo 
figure.


$dbc = mysql_connect(server,'username,'pw')
or die('Error connecting to MySQL server');
mysql_select_db("db",$dbc);

 $query = "INSERT INTO formcom(fname, lname, email, comment, ip)" . "VALUES 
('$fname','$lname','$email','$comment','$ip')"
or die('error in query');


  $result = mysql_query($query, $dbc)
or die('Error in Result');

Thanks for all your help

Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5522 (20101011) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Unknown Table i field list

2010-10-11 Thread Kranthi Krishna
echo $query;
before
$result = mysqli_query($dbc, $query);
might be of help to understand what is going wrong

copy that query and execute in phpMyAdmin

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



Re: [PHP] Unknown Table i field list

2010-10-11 Thread Gary

Ashley

I have used the concatenation before and I believe that since I closed the 
INSERT INTO with a ", I needed to add the ." for the VAULES.


My post is laced with typo's, I just came back from an impromtu hosptial 
stay and they had given me the "good stuff",so I was a little cloudier than 
usual.


Thank you again for trying to help.

Gary


 wrote in message 
news:40.00.07410.a0783...@pb1.pair.com...

That's the same query.

One thing I did notice (and I wasn't sure if it was a typo as I saw a few 
in the original post) but you've used a period instead of a comma to 
separate the values in the query.


It shouldn't produce the error you're seeing, but sometimes you never 
know!


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

- Reply message -
From: "sueandant" 
Date: Mon, Oct 11, 2010 22:26
Subject: [PHP] Unknown Table i field list
To: "Gary" 
Cc: "PHP" 


Have you tried :
$query = "INSERT INTO formcom(fname, lname, email, comment, ip) VALUES

('$fname','$lname','$email'.'$comment','$ip')"
or die('error in query');

tholland
- Original Message - 
From: "Gary" 

To: 
Sent: Monday, October 11, 2010 8:09 PM
Subject: [PHP] Unknown Table i field list



I am getting an error of "unkown talbe "formcom" in field list".

I dont understand this.  I have a talbe called formcom in the database, 
in

fact I created this talbe to replace the first one named comments just in
case the table name comments was not allowed.

I have used this same script a number of time, this is the first time I 
am

getting this error

Here is the scritpt


$dbc = mysqli_connect('server','username',password','db name')
or die('Error connecting to MySQL server');

$query = "INSERT INTO formcom(fname, lname, email, comment, ip)" . 
"VALUES

('$fname','$lname','$email'.'$comment','$ip')"
or die('error in query');

$result = mysqli_query($dbc, $query)
or die('Error in Result');

mysqli_close($dbc);

I have also tried formcom.fname, formcom.lname, formcomemail,
formcomcomment, formcom.ip

I have double triple quad checked to make sure I did not have comment and
comments mix up.

Anyone be able to help me?

Thank you

Gary


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





__ Information from ESET Smart Security, version of virus signature 
database 5521 (20101011) __

The message was checked by ESET Smart Security.

http://www.eset.com




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



Re: [PHP] break out of

2010-10-11 Thread Govinda

If I understand the question correctly, I think the answer is yes.


great!!  Next time I will save myself so much time!
Thank you guys!
-G


"Alternative syntax for control structures"




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



Re: [PHP] break out of

2010-10-11 Thread Joshua Kehn
If I'm understanding the question right, yes you can.

if($AlertUser2success != 0)
{
   ?>
   
   
   
   
   
   
   http://joshuakehn.com

On Oct 11, 2010, at 7:05 PM, Govinda wrote:

> Hi everyone,
> 
> - newbie preface 
> -
> I finally got some time to come back to learning a little more PHP... and I 
> am looking forward to lots more in coming months, with any luck.  Anyway, as 
> I was working towards the last deadline with the PHP project I was working 
> on, I uncovered several issues I did not know the answer to.. and I just 
> hacked around them  to avoid taking more time while I was under the 
> clock/meter.  Now on my own time, I want to ask, so I learn more deeply what 
> was more ideal understanding/technique.
> - /newbie preface 
> -
> 
> Here's one of those Q's:
> 
> I was working on a system ("MoveableType", A.K.A. "MT") that writes db data 
> to static text files (web pages) whenever the CMS admin tells it to 
> "publish".  That system writes out the PHP code that I tell it to, in each 
> page of the site.  There was one place in my PHP code (marked with ***MT***, 
> below) where I needed to include a chunk of data that would not be known (or 
> written out) until the admin next published the page (i.e. I could not 
> include the code inline).   I needed to display it only in case of a PHP 
> comparison evaluating to true.  I was tempted to break out of PHP at that 
> point, and then go back into PHP within that ***MT*** block itself, _only_ 
> when/where in the few places that block needs PHP.. in order to reduce the 
> head pressure (of the less-technical admin using the MT CMS) having to wade 
> through so many PHP print/echo statements  (I could not get heredoc to work 
> right, but that is another topic/post ;-).  But despite the temptation, I did 
> not attempt that because I thought it might break the logic of the if { } .  
> On the other hand, I vaguely remember reading something that made me think 
> something like that is possible.. but I don't know where I saw it.
> 
> To better summarize my Q:
> 
> could the below "" (which contains a long block 
> of HTML sprinkled with a little PHP whose contents are  known only at 
> runtime) be *broken out of* of the  wrapper that surrounds the if 
> { } statement, and have it still only get displayed on the final webpage when 
> the if { } statement evaluates to true?  The reason I want that is so that I 
> can just keep the HTML straight and simple in that MT block, instead of using 
> PHP string-printing statements to spit out it's mostly-pure-HTML contents.  
> The admin using the system is using a WYSIWYG HTML editable textarea 
> interface, kind of like FCKEditor.
> 
> if($AlertUser2success != 0) {
>   echo ''."\n";
>   echo ' src="images/BehindBox01.png" alt="" />'."\n";
>   echo ''."\n";
>   /*---  here is the ***MT*** 
> block/include ---> ---*/ 
>   echo ''."\n";
>   echo ''."\n";
> } else {
> ...
> 
> 
> Govinda
> govinda(DOT)webdnatalk(AT)gmail(DOT)com
> 
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



Re: [PHP] break out of

2010-10-11 Thread Micky Hulse
If I understand the question correctly, I think the answer is yes.

Maybe something like this:





Normal HTML, or MT tags, here.



Normal HTML, or MT tags, here.



Normal HTML, or MT tags, here.





"Alternative syntax for control structures"


"PHP Shorthand and Alternate Syntax: A quickie!"


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



Re: [PHP] Unknown Table i field list

2010-10-11 Thread Gary

""sueandant""  wrote in message 
news:4c8c262adea3459d815fe3e70ae10...@sueandantpc...
> Have you tried :
> $query = "INSERT INTO formcom(fname, lname, email, comment, ip) VALUES
>> ('$fname','$lname','$email'.'$comment','$ip')"
>> or die('error in query');
> tholland
> - Original Message - 
> From: "Gary" 
> To: 
> Sent: Monday, October 11, 2010 8:09 PM
> Subject: [PHP] Unknown Table i field list
>
>
>>I am getting an error of "unkown talbe "formcom" in field list".
>>
>> I dont understand this.  I have a talbe called formcom in the database, 
>> in fact I created this talbe to replace the first one named comments just 
>> in case the table name comments was not allowed.
>>
>> I have used this same script a number of time, this is the first time I 
>> am getting this error
>>
>> Here is the scritpt
>>
>>
>> $dbc = mysqli_connect('server','username',password','db name')
>> or die('Error connecting to MySQL server');
>>
>> $query = "INSERT INTO formcom(fname, lname, email, comment, ip)" . 
>> "VALUES ('$fname','$lname','$email'.'$comment','$ip')"
>> or die('error in query');
>>
>> $result = mysqli_query($dbc, $query)
>> or die('Error in Result');
>>
>> mysqli_close($dbc);
>>
>> I have also tried formcom.fname, formcom.lname, formcomemail, 
>> formcomcomment, formcom.ip
>>
>> I have double triple quad checked to make sure I did not have comment and 
>> comments mix up.
>>
>> Anyone be able to help me?
>>
>> Thank you
>>
>> Gary
>>
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php



Just tried it, still the same message...

Thank you for trying

Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5521 (20101011) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



[PHP] break out of

2010-10-11 Thread Govinda

Hi everyone,

- newbie preface  
-
I finally got some time to come back to learning a little more PHP...  
and I am looking forward to lots more in coming months, with any  
luck.  Anyway, as I was working towards the last deadline with the PHP  
project I was working on, I uncovered several issues I did not know  
the answer to.. and I just hacked around them  to avoid taking more  
time while I was under the clock/meter.  Now on my own time, I want to  
ask, so I learn more deeply what was more ideal understanding/technique.
- /newbie preface  
-


Here's one of those Q's:

I was working on a system ("MoveableType", A.K.A. "MT") that writes db  
data to static text files (web pages) whenever the CMS admin tells it  
to "publish".  That system writes out the PHP code that I tell it to,  
in each page of the site.  There was one place in my PHP code (marked  
with ***MT***, below) where I needed to include a chunk of data that  
would not be known (or written out) until the admin next published the  
page (i.e. I could not include the code inline).   I needed to display  
it only in case of a PHP comparison evaluating to true.  I was tempted  
to break out of PHP at that point, and then go back into PHP within  
that ***MT*** block itself, _only_ when/where in the few places that  
block needs PHP.. in order to reduce the head pressure (of the less- 
technical admin using the MT CMS) having to wade through so many PHP  
print/echo statements  (I could not get heredoc to work right, but  
that is another topic/post ;-).  But despite the temptation, I did not  
attempt that because I thought it might break the logic of the if  
{ } .  On the other hand, I vaguely remember reading something that  
made me think something like that is possible.. but I don't know where  
I saw it.


To better summarize my Q:

could the below "" (which contains a  
long block of HTML sprinkled with a little PHP whose contents are   
known only at runtime) be *broken out of* of the  wrapper  
that surrounds the if { } statement, and have it still only get  
displayed on the final webpage when the if { } statement evaluates to  
true?  The reason I want that is so that I can just keep the HTML  
straight and simple in that MT block, instead of using PHP string- 
printing statements to spit out it's mostly-pure-HTML contents.  The  
admin using the system is using a WYSIWYG HTML editable textarea  
interface, kind of like FCKEditor.


if($AlertUser2success != 0) {
echo ''."\n";
			echo ''."\n";

echo ''."\n";
	/*---  here is the ***MT*** block/include ---> ---*/ name="PageMoreNoCRLF">

echo ''."\n";
echo ''."\n";
} else {
...


Govinda
govinda(DOT)webdnatalk(AT)gmail(DOT)com






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



Re: [PHP] Unknown Table i field list

2010-10-11 Thread a...@ashleysheridan.co.uk
That's the same query.

One thing I did notice (and I wasn't sure if it was a typo as I saw a few in 
the original post) but you've used a period instead of a comma to separate the 
values in the query.

It shouldn't produce the error you're seeing, but sometimes you never know!

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

- Reply message -
From: "sueandant" 
Date: Mon, Oct 11, 2010 22:26
Subject: [PHP] Unknown Table i field list
To: "Gary" 
Cc: "PHP" 


Have you tried :
$query = "INSERT INTO formcom(fname, lname, email, comment, ip) VALUES
> ('$fname','$lname','$email'.'$comment','$ip')"
> or die('error in query');
tholland
- Original Message - 
From: "Gary" 
To: 
Sent: Monday, October 11, 2010 8:09 PM
Subject: [PHP] Unknown Table i field list


>I am getting an error of "unkown talbe "formcom" in field list".
>
> I dont understand this.  I have a talbe called formcom in the database, in 
> fact I created this talbe to replace the first one named comments just in 
> case the table name comments was not allowed.
>
> I have used this same script a number of time, this is the first time I am 
> getting this error
>
> Here is the scritpt
>
>
> $dbc = mysqli_connect('server','username',password','db name')
> or die('Error connecting to MySQL server');
>
> $query = "INSERT INTO formcom(fname, lname, email, comment, ip)" . "VALUES 
> ('$fname','$lname','$email'.'$comment','$ip')"
> or die('error in query');
>
> $result = mysqli_query($dbc, $query)
> or die('Error in Result');
>
> mysqli_close($dbc);
>
> I have also tried formcom.fname, formcom.lname, formcomemail, 
> formcomcomment, formcom.ip
>
> I have double triple quad checked to make sure I did not have comment and 
> comments mix up.
>
> Anyone be able to help me?
>
> Thank you
>
> Gary
>
>
> -- 
> 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



Re: [PHP] Unknown Table i field list

2010-10-11 Thread sueandant

Have you tried :
$query = "INSERT INTO formcom(fname, lname, email, comment, ip) VALUES

('$fname','$lname','$email'.'$comment','$ip')"
or die('error in query');

tholland
- Original Message - 
From: "Gary" 

To: 
Sent: Monday, October 11, 2010 8:09 PM
Subject: [PHP] Unknown Table i field list



I am getting an error of "unkown talbe "formcom" in field list".

I dont understand this.  I have a talbe called formcom in the database, in 
fact I created this talbe to replace the first one named comments just in 
case the table name comments was not allowed.


I have used this same script a number of time, this is the first time I am 
getting this error


Here is the scritpt


$dbc = mysqli_connect('server','username',password','db name')
or die('Error connecting to MySQL server');

$query = "INSERT INTO formcom(fname, lname, email, comment, ip)" . "VALUES 
('$fname','$lname','$email'.'$comment','$ip')"

or die('error in query');

$result = mysqli_query($dbc, $query)
or die('Error in Result');

mysqli_close($dbc);

I have also tried formcom.fname, formcom.lname, formcomemail, 
formcomcomment, formcom.ip


I have double triple quad checked to make sure I did not have comment and 
comments mix up.


Anyone be able to help me?

Thank you

Gary


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



Re: [PHP] Scripts running twice

2010-10-11 Thread Alexis
Thanks for perservingnope just the two entries per script..one start 
and one stopalso checked the multi tab and that is set to just the 
once as well.
One thing I forgot to say before is that even if I run the scripts 
manually, then they still run the twice.sorry about missing that bit 
out...


On 11/10/10 14:27, Richard Quadling wrote:

On 11 October 2010 21:20, Alexis  wrote:

Thanks for the quick response...checked and no duplicates Richard

On 11/10/10 14:14, Richard Quadling wrote:


On 11 October 2010 21:10, Alexiswrote:


Hi,

A very vague question here I am afraidI have quite a number of php
scripts running on a WinXp box using the built in Scheduler.

Everything worked fine for years until one day an update was
done...cannot
remember if it was on PHP, Apache, Mysql or the firefox browser, but now
most but not all, of the scripts run twice!

I was going to say any help would be appreciated, but due to the nature
of
my vagueness as to what was updated, that question becomes a little
moot.Or
does it?

Is there any way of finding out what exactly is triggering the scripts to
run, specifically the second trigger.

I am not even sure if the script finishes running and then restarts, or
whether two instances of it are started at the same time.

Cheers
Alexis

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




Take a look in C:\windows\tasks.

Do you have a load of "Copy of " versions?

If you see multiple versions, just delete them.

You may need to do this via a command prompt to see the copies.



OK. When they run, are they running at the same time? If you check the
scheduled task log file ... C:\WINDOWS\SchedLgu.TXT

Take a look through the task setup. See if it has been set to run
twice. On the Schedule tab, there is an option at the bottom - "Show
multiple schedules".

If this option is set, then the top of the page has a drop down/list
showing the scheduled versions. Are there more than 1? Is the checkbox
checked?




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



Re: [PHP] Scripts running twice

2010-10-11 Thread Richard Quadling
On 11 October 2010 21:20, Alexis  wrote:
> Thanks for the quick response...checked and no duplicates Richard
>
> On 11/10/10 14:14, Richard Quadling wrote:
>>
>> On 11 October 2010 21:10, Alexis  wrote:
>>>
>>> Hi,
>>>
>>> A very vague question here I am afraidI have quite a number of php
>>> scripts running on a WinXp box using the built in Scheduler.
>>>
>>> Everything worked fine for years until one day an update was
>>> done...cannot
>>> remember if it was on PHP, Apache, Mysql or the firefox browser, but now
>>> most but not all, of the scripts run twice!
>>>
>>> I was going to say any help would be appreciated, but due to the nature
>>> of
>>> my vagueness as to what was updated, that question becomes a little
>>> moot.Or
>>> does it?
>>>
>>> Is there any way of finding out what exactly is triggering the scripts to
>>> run, specifically the second trigger.
>>>
>>> I am not even sure if the script finishes running and then restarts, or
>>> whether two instances of it are started at the same time.
>>>
>>> Cheers
>>> Alexis
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> Take a look in C:\windows\tasks.
>>
>> Do you have a load of "Copy of " versions?
>>
>> If you see multiple versions, just delete them.
>>
>> You may need to do this via a command prompt to see the copies.
>>

OK. When they run, are they running at the same time? If you check the
scheduled task log file ... C:\WINDOWS\SchedLgu.TXT

Take a look through the task setup. See if it has been set to run
twice. On the Schedule tab, there is an option at the bottom - "Show
multiple schedules".

If this option is set, then the top of the page has a drop down/list
showing the scheduled versions. Are there more than 1? Is the checkbox
checked?


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

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



Re: [PHP] Scripts running twice

2010-10-11 Thread Alexis

Thanks for the quick response...checked and no duplicates Richard

On 11/10/10 14:14, Richard Quadling wrote:

On 11 October 2010 21:10, Alexis  wrote:

Hi,

A very vague question here I am afraidI have quite a number of php
scripts running on a WinXp box using the built in Scheduler.

Everything worked fine for years until one day an update was done...cannot
remember if it was on PHP, Apache, Mysql or the firefox browser, but now
most but not all, of the scripts run twice!

I was going to say any help would be appreciated, but due to the nature of
my vagueness as to what was updated, that question becomes a little moot.Or
does it?

Is there any way of finding out what exactly is triggering the scripts to
run, specifically the second trigger.

I am not even sure if the script finishes running and then restarts, or
whether two instances of it are started at the same time.

Cheers
Alexis

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




Take a look in C:\windows\tasks.

Do you have a load of "Copy of " versions?

If you see multiple versions, just delete them.

You may need to do this via a command prompt to see the copies.



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



Re: [PHP] Scripts running twice

2010-10-11 Thread Richard Quadling
On 11 October 2010 21:10, Alexis  wrote:
> Hi,
>
> A very vague question here I am afraidI have quite a number of php
> scripts running on a WinXp box using the built in Scheduler.
>
> Everything worked fine for years until one day an update was done...cannot
> remember if it was on PHP, Apache, Mysql or the firefox browser, but now
> most but not all, of the scripts run twice!
>
> I was going to say any help would be appreciated, but due to the nature of
> my vagueness as to what was updated, that question becomes a little moot.Or
> does it?
>
> Is there any way of finding out what exactly is triggering the scripts to
> run, specifically the second trigger.
>
> I am not even sure if the script finishes running and then restarts, or
> whether two instances of it are started at the same time.
>
> Cheers
> Alexis
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Take a look in C:\windows\tasks.

Do you have a load of "Copy of " versions?

If you see multiple versions, just delete them.

You may need to do this via a command prompt to see the copies.

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

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



[PHP] Scripts running twice

2010-10-11 Thread Alexis

Hi,

A very vague question here I am afraidI have quite a number of php 
scripts running on a WinXp box using the built in Scheduler.


Everything worked fine for years until one day an update was 
done...cannot remember if it was on PHP, Apache, Mysql or the firefox 
browser, but now most but not all, of the scripts run twice!


I was going to say any help would be appreciated, but due to the nature 
of my vagueness as to what was updated, that question becomes a little 
moot.Or does it?


Is there any way of finding out what exactly is triggering the scripts 
to run, specifically the second trigger.


I am not even sure if the script finishes running and then restarts, or 
whether two instances of it are started at the same time.


Cheers
Alexis

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



Re: [PHP] Unknown Table i field list

2010-10-11 Thread Gary

"Ashley Sheridan"  wrote in message 
news:1286826713.3415.3.ca...@localhost.localdomain...
> On Mon, 2010-10-11 at 15:46 -0400, Gary wrote:
>
>> I used, and have always used phpmyadmin to create the tables.  As I say, 
>> it
>> is not the first time doing this, but I believe it is the first time 
>> getting
>> the error.
>>
>> To Alexander, yes I had, ,in fact I simply C/p the script from anohter
>> scritp into the same db...
>>
>> Thank you
>>
>> Gary
>>
>>
>>
>> "Ashley Sheridan"  wrote in message
>> news:1286826171.3415.2.ca...@localhost.localdomain...
>> > On Mon, 2010-10-11 at 15:09 -0400, Gary wrote:
>> >
>> >> I am getting an error of "unkown talbe "formcom" in field list".
>> >>
>> >> I dont understand this.  I have a talbe called formcom in the 
>> >> database,
>> >> in
>> >> fact I created this talbe to replace the first one named comments just 
>> >> in
>> >> case the table name comments was not allowed.
>> >>
>> >> I have used this same script a number of time, this is the first time 
>> >> I
>> >> am
>> >> getting this error
>> >>
>> >> Here is the scritpt
>> >>
>> >>
>> >> $dbc = mysqli_connect('server','username',password','db name')
>> >> or die('Error connecting to MySQL server');
>> >>
>> >> $query = "INSERT INTO formcom(fname, lname, email, comment, ip)" .
>> >> "VALUES
>> >> ('$fname','$lname','$email'.'$comment','$ip')"
>> >> or die('error in query');
>> >>
>> >>  $result = mysqli_query($dbc, $query)
>> >> or die('Error in Result');
>> >>
>> >> mysqli_close($dbc);
>> >>
>> >> I have also tried formcom.fname, formcom.lname, formcomemail,
>> >> formcomcomment, formcom.ip
>> >>
>> >> I have double triple quad checked to make sure I did not have comment 
>> >> and
>> >> comments mix up.
>> >>
>> >> Anyone be able to help me?
>> >>
>> >> Thank you
>> >>
>> >> Gary
>> >>
>> >>
>> >>
>> >
>> >
>> > What's the create table syntax that was used to create that table. Can
>> > you get it from the software you're using to create/modify the DB 
>> > rather
>> > than type it to reduce the chance of omitting any errors that were
>> > introduced?
>> >
>> > Thanks,
>> > Ash
>> > http://www.ashleysheridan.co.uk
>> >
>> >
>> >
>> >
>> >
>> > __ Information from ESET Smart Security, version of virus
>> > signature database 5521 (20101011) __
>> >
>> > The message was checked by ESET Smart Security.
>> >
>> > http://www.eset.com
>> >
>> >
>>
>>
>>
>> __ Information from ESET Smart Security, version of virus 
>> signature database 5521 (20101011) __
>>
>> The message was checked by ESET Smart Security.
>>
>> http://www.eset.com
>>
>>
>>
>>
>>
>
>
>
> But can you post the create table syntax it used to create that table?
> In phpMyAdmin you can get this by going to the export tab.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>


-- phpMyAdmin SQL Dump
-- version 2.11.9.4
-- http://www.phpmyadmin.net
--
-- Host: 10.8.11.213
-- Generation Time: Oct 11, 2010 at 01:59 PM
-- Server version: 5.0.91
-- PHP Version: 5.2.8

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `sanatized`
--

-- 

--
-- Table structure for table `formcom`
--

CREATE TABLE `formcom` (
  `id` int(11) NOT NULL auto_increment,
  `fname` varchar(20) NOT NULL,
  `lname` varchar(20) NOT NULL,
  `email` varchar(50) NOT NULL,
  `comment` varchar(4000) NOT NULL,
  `ip` varchar(20) NOT NULL,
  `submitted` timestamp NOT NULL default '-00-00 00:00:00' on update 
CURRENT_TIMESTAMP,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `formcom`
--

Here you go.

Thank you

Gary



__ Information from ESET Smart Security, version of virus signature 
database 5521 (20101011) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Unknown Table i field list

2010-10-11 Thread Ashley Sheridan
On Mon, 2010-10-11 at 15:46 -0400, Gary wrote:

> I used, and have always used phpmyadmin to create the tables.  As I say, it 
> is not the first time doing this, but I believe it is the first time getting 
> the error.
> 
> To Alexander, yes I had, ,in fact I simply C/p the script from anohter 
> scritp into the same db...
> 
> Thank you
> 
> Gary
> 
> 
> 
> "Ashley Sheridan"  wrote in message 
> news:1286826171.3415.2.ca...@localhost.localdomain...
> > On Mon, 2010-10-11 at 15:09 -0400, Gary wrote:
> >
> >> I am getting an error of "unkown talbe "formcom" in field list".
> >>
> >> I dont understand this.  I have a talbe called formcom in the database, 
> >> in
> >> fact I created this talbe to replace the first one named comments just in
> >> case the table name comments was not allowed.
> >>
> >> I have used this same script a number of time, this is the first time I 
> >> am
> >> getting this error
> >>
> >> Here is the scritpt
> >>
> >>
> >> $dbc = mysqli_connect('server','username',password','db name')
> >> or die('Error connecting to MySQL server');
> >>
> >> $query = "INSERT INTO formcom(fname, lname, email, comment, ip)" . 
> >> "VALUES
> >> ('$fname','$lname','$email'.'$comment','$ip')"
> >> or die('error in query');
> >>
> >>  $result = mysqli_query($dbc, $query)
> >> or die('Error in Result');
> >>
> >> mysqli_close($dbc);
> >>
> >> I have also tried formcom.fname, formcom.lname, formcomemail,
> >> formcomcomment, formcom.ip
> >>
> >> I have double triple quad checked to make sure I did not have comment and
> >> comments mix up.
> >>
> >> Anyone be able to help me?
> >>
> >> Thank you
> >>
> >> Gary
> >>
> >>
> >>
> >
> >
> > What's the create table syntax that was used to create that table. Can
> > you get it from the software you're using to create/modify the DB rather
> > than type it to reduce the chance of omitting any errors that were
> > introduced?
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
> >
> >
> > __ Information from ESET Smart Security, version of virus 
> > signature database 5521 (20101011) __
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> >
> > 
> 
> 
> 
> __ Information from ESET Smart Security, version of virus signature 
> database 5521 (20101011) __
> 
> The message was checked by ESET Smart Security.
> 
> http://www.eset.com
> 
> 
> 
> 
> 



But can you post the create table syntax it used to create that table?
In phpMyAdmin you can get this by going to the export tab.

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




Re: [PHP] Unknown Table i field list

2010-10-11 Thread Gary
I used, and have always used phpmyadmin to create the tables.  As I say, it 
is not the first time doing this, but I believe it is the first time getting 
the error.

To Alexander, yes I had, ,in fact I simply C/p the script from anohter 
scritp into the same db...

Thank you

Gary



"Ashley Sheridan"  wrote in message 
news:1286826171.3415.2.ca...@localhost.localdomain...
> On Mon, 2010-10-11 at 15:09 -0400, Gary wrote:
>
>> I am getting an error of "unkown talbe "formcom" in field list".
>>
>> I dont understand this.  I have a talbe called formcom in the database, 
>> in
>> fact I created this talbe to replace the first one named comments just in
>> case the table name comments was not allowed.
>>
>> I have used this same script a number of time, this is the first time I 
>> am
>> getting this error
>>
>> Here is the scritpt
>>
>>
>> $dbc = mysqli_connect('server','username',password','db name')
>> or die('Error connecting to MySQL server');
>>
>> $query = "INSERT INTO formcom(fname, lname, email, comment, ip)" . 
>> "VALUES
>> ('$fname','$lname','$email'.'$comment','$ip')"
>> or die('error in query');
>>
>>  $result = mysqli_query($dbc, $query)
>> or die('Error in Result');
>>
>> mysqli_close($dbc);
>>
>> I have also tried formcom.fname, formcom.lname, formcomemail,
>> formcomcomment, formcom.ip
>>
>> I have double triple quad checked to make sure I did not have comment and
>> comments mix up.
>>
>> Anyone be able to help me?
>>
>> Thank you
>>
>> Gary
>>
>>
>>
>
>
> What's the create table syntax that was used to create that table. Can
> you get it from the software you're using to create/modify the DB rather
> than type it to reduce the chance of omitting any errors that were
> introduced?
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
>
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5521 (20101011) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
> 



__ Information from ESET Smart Security, version of virus signature 
database 5521 (20101011) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Unknown Table i field list

2010-10-11 Thread Alexander Schrijver

On Mon, Oct 11, 2010 at 03:09:35PM -0400, Gary wrote:
> I have used this same script a number of time, this is the first time I am 
> getting this error

did you also check the db name is correct?

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



Re: [PHP] Unknown Table i field list

2010-10-11 Thread Ashley Sheridan
On Mon, 2010-10-11 at 15:09 -0400, Gary wrote:

> I am getting an error of "unkown talbe "formcom" in field list".
> 
> I dont understand this.  I have a talbe called formcom in the database, in 
> fact I created this talbe to replace the first one named comments just in 
> case the table name comments was not allowed.
> 
> I have used this same script a number of time, this is the first time I am 
> getting this error
> 
> Here is the scritpt
> 
> 
> $dbc = mysqli_connect('server','username',password','db name')
> or die('Error connecting to MySQL server');
> 
> $query = "INSERT INTO formcom(fname, lname, email, comment, ip)" . "VALUES 
> ('$fname','$lname','$email'.'$comment','$ip')"
> or die('error in query');
> 
>  $result = mysqli_query($dbc, $query)
> or die('Error in Result');
> 
> mysqli_close($dbc);
> 
> I have also tried formcom.fname, formcom.lname, formcomemail, 
> formcomcomment, formcom.ip
> 
> I have double triple quad checked to make sure I did not have comment and 
> comments mix up.
> 
> Anyone be able to help me?
> 
> Thank you
> 
> Gary 
> 
> 
> 


What's the create table syntax that was used to create that table. Can
you get it from the software you're using to create/modify the DB rather
than type it to reduce the chance of omitting any errors that were
introduced?

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




[PHP] Unknown Table i field list

2010-10-11 Thread Gary
I am getting an error of "unkown talbe "formcom" in field list".

I dont understand this.  I have a talbe called formcom in the database, in 
fact I created this talbe to replace the first one named comments just in 
case the table name comments was not allowed.

I have used this same script a number of time, this is the first time I am 
getting this error

Here is the scritpt


$dbc = mysqli_connect('server','username',password','db name')
or die('Error connecting to MySQL server');

$query = "INSERT INTO formcom(fname, lname, email, comment, ip)" . "VALUES 
('$fname','$lname','$email'.'$comment','$ip')"
or die('error in query');

 $result = mysqli_query($dbc, $query)
or die('Error in Result');

mysqli_close($dbc);

I have also tried formcom.fname, formcom.lname, formcomemail, 
formcomcomment, formcom.ip

I have double triple quad checked to make sure I did not have comment and 
comments mix up.

Anyone be able to help me?

Thank you

Gary 



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



Re: [PHP] References in Sessions

2010-10-11 Thread Alexander Schrijver
On Mon, Oct 11, 2010 at 04:43:06PM +0200, Sebastian Detert wrote:
> Why don't you write a small function checking for invalid IDs and
> delete them and referenced subIDs? If you guess it's to hard/slow to
> find out all referenced subIDs you could change your Session array
> to an multi-dimensional array, with all referenced IDs on lower
> levels
> 
> array ( sector_id => array ( company_id => array (location_id) ) );
> 
> like
> 
> array ( 1 => array (17,4 => array(2)) would mean that loction 2
> inside company 4 inside section 1 was selected. This way you only
> need to delete an old entry, and all referenced IDs dissapear
> 
> Sebastian

Hi Sebastian,

My explanation might've been unclear.

The problem isn't deleting a row and its dependencies. The problem is that i
can't delete both the reference from the database search trough all the
sessions for references (using the file mechanism). And even if i could, it
wouldn't be done atomically so it would be useless because a race could happen.

I would like to have a function which either deletes a row, or if it is
referenced by a session, fails.

And if the session would be stored in the database MySQL could take care of
this. However, the $_SESSION abstraction doesn't allow this to be implemented
properly. I think an implementation is possible, it would however be very ugly.

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



Re: [PHP] References in Sessions

2010-10-11 Thread Sebastian Detert

Alexander Schrijver schrieb:

Hi list,

I'm working on a project which uses a MySQL database to store some data. The
database looks something like this:

Companies
- id (PK)
- name
- sector_id -> Sectors (id)
- etc

Locations
- id (PK)
- company_id -> Companies (id)
- name
- etc

Sectors
- id (PK)
- name
- etc

And we're using a Session to store references (not actual PHP references
ofcourse just the identifying integers) to these tables.

For example a list of companies and locations which are selected in the GUI is
kept in the session state.

The session would look something like this when filled up. The integers are the
PKs of the companies and sectors tables respectively.

Companies = Array (1,2,3,4,etc)
Sectors = Array (1,2,3,4,etc)

The problem is: when there are 2 clients one administrative and one user,
and the user has selected a company (or something else, it doesn't really
matter). And then the administrative user comes along and deletes the row which
the user just selected from the company table. There is an invalid reference in
the Session of the user.

I figured if I saved the session in the database and used constraints (foreign
keys) to enforce this. This could work. However, the PHP session abstraction
makes it very difficult to implement this properly. (I looked at
session_set_save_handler)

How do you guys deal with this problem?

Thanks,

Alexander

  
Why don't you write a small function checking for invalid IDs and delete 
them and referenced subIDs? If you guess it's to hard/slow to find out 
all referenced subIDs you could change your Session array to an 
multi-dimensional array, with all referenced IDs on lower levels


array ( sector_id => array ( company_id => array (location_id) ) );

like

array ( 1 => array (17,4 => array(2)) would mean that loction 2 inside 
company 4 inside section 1 was selected. This way you only need to 
delete an old entry, and all referenced IDs dissapear


Sebastian

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



[PHP] References in Sessions

2010-10-11 Thread Alexander Schrijver
Hi list,

I'm working on a project which uses a MySQL database to store some data. The
database looks something like this:

Companies
- id (PK)
- name
- sector_id -> Sectors (id)
- etc

Locations
- id (PK)
- company_id -> Companies (id)
- name
- etc

Sectors
- id (PK)
- name
- etc

And we're using a Session to store references (not actual PHP references
ofcourse just the identifying integers) to these tables.

For example a list of companies and locations which are selected in the GUI is
kept in the session state.

The session would look something like this when filled up. The integers are the
PKs of the companies and sectors tables respectively.

Companies = Array (1,2,3,4,etc)
Sectors = Array (1,2,3,4,etc)

The problem is: when there are 2 clients one administrative and one user,
and the user has selected a company (or something else, it doesn't really
matter). And then the administrative user comes along and deletes the row which
the user just selected from the company table. There is an invalid reference in
the Session of the user.

I figured if I saved the session in the database and used constraints (foreign
keys) to enforce this. This could work. However, the PHP session abstraction
makes it very difficult to implement this properly. (I looked at
session_set_save_handler)

How do you guys deal with this problem?

Thanks,

Alexander

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



Re: [PHP] Creating a WebService-Provider using an existing WSDL via SOAP

2010-10-11 Thread Richard Quadling
On 11 October 2010 14:47, Kai Meder  wrote:
> Hello
>
> after having paused any PHP development in the last 2 years I'm just coming 
> back
> to PHP 5.3. Could somebody clarify what the current state of WebService
> Development with PHP is?
>
> We have a rather complex, generated WSDL-Document fully describing a 
> WebService-
> Interface. What is the PHP-way to create a WebService-Provider for this WSDL-
> document? Are there any Code-Generation Tools to create the WSDL-Defined
> Structures and DataTypes?
>
> Any advice appreciated, thanks!
> Kai

Generating a provider is not something I've done in the past.

Well, not from a WSDL file. Instead, I've created my services, added
docblocks and used Zend Framework's AutoDiscover (with some small
patches) to create my WSDL file.

>From there, I've used sourceforge's wsdl2php [1]  and [2] (again, with
some patches - see RazorsEdgeUK's patches on the sourceforge site) to
create my consumer classes.

But creating the server from the WSDL file ... interesting.

To a degree, it won't be a lot different to the consumer side. The
whole point being that the XML and SOAP conversation is all wrapped up
in the classes.

Currently wsdl2php will create all the complex types as classes and a
SoapClient class with all the methods. The code in the methods will be
to take any parameters and push them through to the SoapClient.

>From a SoapServer perspective, it should be just a case of changing
the SoapClient to SoapServer and amending the code in the methods to
do the real work.

I've helped others make client side code using wsdl files. An example is at [3]

As you can see, the main class is simply routing things to SoapClient.

Which routes to SoapServer (eventually) which could route to a class
with methods of the same name.


The way I've described this is how my soap services look. Sure, you
could get fancy with more routing but it works for me.

Regards,

Richard.

[1] http://www.urdalen.no/wsdl2php/
[2] http://pastebin.com/r1BfRysT
[3] http://pastebin.com/8Gq7gD0X

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

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



[PHP] Creating a WebService-Provider using an existing WSDL via SOAP

2010-10-11 Thread Kai Meder
Hello

after having paused any PHP development in the last 2 years I'm just coming 
back 
to PHP 5.3. Could somebody clarify what the current state of WebService 
Development with PHP is?

We have a rather complex, generated WSDL-Document fully describing a WebService-
Interface. What is the PHP-way to create a WebService-Provider for this WSDL-
document? Are there any Code-Generation Tools to create the WSDL-Defined 
Structures and DataTypes?

Any advice appreciated, thanks!
Kai 


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



[PHP] Search inside file :)

2010-10-11 Thread Jordan Jovanov

Hello everybody,

I create one site where user can upload .zip files, but now I have one 
interesting problem. I need me PHP script where can have one edit box 
and button, user can input same text in edit box and when press on 
button he need to find the document who have text from edit button.
Do you same body have script or more on script who can search inside in 
same file (zip file with word document, presentation etc).


Thanks a lot. :)

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