Re: [PHP] Back from the dead with a racing question!

2009-07-17 Thread Thorsten Suckow-Homberg
Jason, 

Do I need to be reading up on locking tables/rows? Or in my situation  
as I've briefly described it do I not have to worry about it? Or is  
there a third door with the magic bullet that will solve all my  
problems? :)

Any advice is greatly appreciated as always, RTFMing is good as well,  
as long as M is defined :)



When using mysql along with PHPs mysql_insert_id() 
(http://de.php.net/manual/en/function.mysql-insert-id.php), the docs say:
quote
Note: 
   
Because mysql_insert_id() acts on the last performed
query, be sure to call mysql_insert_id() immediately 
after the query that generates the value.
   
/quote

So yes, from my point of view (which is in that case very paranoid), I'd say 
race conditions are possible to happen. One solution would be to save the user 
id along with the saved record, then fetch the last inserted record by this 
user and return the id for this record. A timestamp (microtime()) might also 
help.

On the other hand - yes, there is still the possbility of locking the table.

Regards

Thorsten


-- 
Thorsten Suckow-Homberg
Jakobstrasse 214-216
52064 Aachen
http://www.siteartwork.de

Tel.:  0151 -10927135
Email: t...@siteartwork.de

You should follow me on Twitter: http://twitter.com/ThorstenSuckow

Sent with conjoon. Visit http://www.conjoon.org

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



Re: [PHP] Re: [PROJECT HELP] - JotBug - A Project Management Issue Tracker written 100% with Zend Framework

2009-01-28 Thread Thorsten Suckow-Homberg

Colin Guthrie schrieb:

'Twas brillig, and rcastley at 27/01/09 23:26 did gyre and gimble:
I am looking (begging!) for help/testing/feedback etc etc etc on my 
JotBug

project


A few years ago we had similiar in mind with phrac - it's over at 
phrac.tigris.org. I put a lot of effort into writing the WebDAV adapter 
that allows to query SVN information over HTTP/WebDAV - without the need 
of having a local SVN client running. It was never finished, but feel 
free to take whatever you need.



--
Thorsten Suckow-Homberg
http://www.siteartwork.de
http://www.conjoon.org


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



Re: [PHP] PHP Dev Facts

2008-10-17 Thread Thorsten Suckow-Homberg

 *Procedural or OOP?*
OOP 

 *Dev OS*
Windows XP 

 *Dev PHP Version*
5.2.6 

 *Live Server OS*
- 

 *Live Server PHP Version*
- 

 *Which HTTP Server Software (+version)?*
Apache 2.2 

 *IDE / Dev Environment*
UltraEdit 

 *Preferred Framework(s)?*
Zend Framework, Ext JS 

 *Do you Unit Test?*
Of course. 

 *Most Used Internal PHP Class*
PDO 

 *Preferred OS CMS*
Wordpress ;) 



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



Re: [PHP] Plotting Tool

2008-10-07 Thread Thorsten Suckow-Homberg
Hey there,

 Anyone have any suggestions on a plotting package for PHP?
 Nothing too crazy and fancy - just easy to read plots/graphs.
 We were using PHPlot on our old server but it's requiring too many
 lib's/util's to install on a new server.

 

JPGraph:
http://www.aditus.nu/jpgraph/


HTH

Thorsten


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



Re: [PHP] Does this seem wrong to anyone else?

2008-08-20 Thread Thorsten Suckow-Homberg



1055function mkdir_recursive($pathname, $mode)
1056{
1057is_dir(dirname($pathname)) ||
mkdir_recursive(dirname($pathname), $mode);
1058return is_dir($pathname) || @mkdir($pathname, $mode);
1059}
  
Is this function defined within a class? From which scope do you call 
this method? Where is the method defined and from where do you call it?


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



Re: [PHP] Help with an error...

2008-07-24 Thread Thorsten Suckow-Homberg

Daniel already answerd regarding your error, but...

?php
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
  
... if you call the script via cron I'm pretty sure $_SERVER won't be 
available since the script is not used in a running webserver process 
context.


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



Re: [PHP] Changing PHP.ini

2008-07-15 Thread Thorsten Suckow-Homberg


By visiting php.info in a web browser I have confirmed the location of 
my php.ini file as /usr/local/php5/lib/php.ini. I open that file and 
edit the line:


; - display_errors = Off

and change it to

display_errors = On

I then retstart Appache and visit php.info which still reports 
display_errors = Off. What else can I do?


Should be simple: create a script with the following code:

?php
phpinfo();
?

Then open that script in your browser. The generated output does also 
provide information about the path of the loaded php.ini.


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



Re: [PHP] MySpace stuff?

2006-06-11 Thread Thorsten Suckow-Homberg


Has anyone made some classes for automating MySpace activities: a 
friend adder, comment poster, etc.? Thanks...




http://blog.phpdoc.info/archives/39-MySpace-Welcome-to-Web-0.5-and-a-Y!Maps-toy.html


I don't know if it will help you, but it is worth the read :D

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



Re: [PHP] Inserting data at runtime (php,mysql)

2006-03-21 Thread Thorsten Suckow-Homberg



The connection is successful but the data are not getting inserted into the 
table. I need to insert all the words into the table.
When I change the insert statement with one insert at a time, I can  insert 
values to the database. For exampel:

$qure = INSERT INTO dict VALUES (1,'apple');

Do I need to check the formatted data in the file?

Can any one help me in this regard?

I have been working in VC++ for some time.


 


Replace

$str =  mysql_query($qure);

with

$str =  mysql_query($qure) or die(mysql_error());

I bet there is an enquoting problem with the data you want to insert...

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



Re: [PHP] Re: Where can I find nice Web icons for custom admin interface?

2006-03-02 Thread Thorsten Suckow-Homberg



www.icons-to-make-my-stuff-shiny-and-professional.com

You probably should get somone that is one, or learn it.

If the website above works, then there is one otherwise no.


What a valuable response... oO

Nicolas, you should google for Linux-Themes (KDE etc.), most of the icon 
collections come with an appropriate license (Crystal theme came AFAICR 
with the GPL bundled)...


HTH


Thorsten

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



Re: [PHP] Only 4 of 5...

2006-03-02 Thread Thorsten Suckow-Homberg

Because of this:


$dbArray = mysql_fetch_array($querys);


This will fill $dbArray with the first row fetched from the table. 4 are 
left which you are calling in your loop at the end of your code example. 
What's your reason anyway to call mysql_fetch_array() here?

Delete this line and I'd bet you're getting your 5 results ;)

HTH

Thorsten

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



Re: [PHP] usort(): The argument should be an array

2006-02-28 Thread Thorsten Suckow-Homberg



$row[4];

  $res[$i]['size'] = $row[5];

  $res[$i]['weight'] = $result_array[$row[0]];

  $i++;

 }
 usort($res, cmp); 


 echo mysql_error();

 $res['maxweight'] = $maxweight;

 $res['results'] = $results;

 return $res;

/**/

}

?

 

That's not enough, we need the part that sits above and in between the 
brace where $res gets filled.

You could also put mysql_error(); above the usort-statement.
Is it possible that $res has once been the return-value of mysql_query() ?

Don't forget to var_dump() your values _before_ the error can occur.

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



Re: [PHP] Object Function-call handling in PHP5

2005-09-28 Thread Thorsten Suckow-Homberg

This is a toughy I've been working over for a bit. I was wondering if
there is a way to cause objects to have certain behaviors when builtin
functions are called, or maybe a way of setting, for example, a
primary string which is used whenever a function requiring a string
calls it.


Take a look at http://www.php.net/php5, section Magic Methods

In your case the __toString() method would be valuable...


Regards

Thorsten Suckow-Homberg

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



Re: [PHP] Is PHP the language for me???

2005-09-23 Thread Thorsten Suckow-Homberg

Yep, PHP can certainly do that, and once you start you wont find a
friendlier place
if you need help...without this list I wouldnt be a programming in PHP
todayokay, maybe I would
but it would be a LOT harder :-)


Sooo... how much did they pay you to make you say this? :P

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



Re: [PHP] Re: Retrieving variable name?

2005-09-21 Thread Thorsten Suckow-Homberg

Short Answer : No
Longer Answer : Maybe, if you have knowledge of PHP internals and a 
willingness to write an extension. Even then it may not work.. g



Well, PHP5's magic methods __get()/ __set() could be used to resolve the 
variable's name...


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



Re: [PHP] session

2005-09-20 Thread Thorsten Suckow-Homberg

and when i click on link always I have in $count value 1 but I need
value 2,3,
how to do it ?


?php
session_start();

if (! isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
}

$_SESSION['count']++;

//session_destroy(); - don't do that! It destroys the 
//session associated with the current user


?

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



Re: [PHP] re: resource id #

2005-09-20 Thread Thorsten Suckow-Homberg
I was using the variable $link in a form. is it a reserved word or 
something??


Most likely the var $link is being used for db-operations (or similiar) 
previously, thus the return value of any resource-based operation is passed 
to the var $link. Check the all the scripts that are involved in presenting 
the script/form.


Best regards

Thorsten Suckow-Homberg 


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



Re: [PHP] resource id#

2005-09-20 Thread Thorsten Suckow-Homberg

When I try to insert a field into my database it shows as Resource id#21?

I must be doing something dim.



Some could would definetely help here...

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



Re: [PHP] help out a noob w/ include switch?

2005-09-20 Thread Thorsten Suckow-Homberg

Hi All,
   My very first post to this group as I'm a freshly spanked new born 
php

baby. Hope I have the correct stop for noob tech questions.

Welcome :)


[source]


First guess: On your live server the ini-value error_reporting is switched 
to report anything but notices and warnings or even completely turned off.
Second guess: in the switch statement you provided us as the bogus 
code-fragment you did really forget to use

'

so you should try

 case 'artist1':
...

instead of

 case artist1:

and, for integer values, use

case 1:
case 2:
case 3:
...

instead of

case 1,2,3:
...


I hope this was valuable, or, in other words: HTH

Best regards

Thorsten 


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



Re: [PHP] professional code quick tip

2005-09-20 Thread Thorsten Suckow-Homberg
in other languages it is possible use conditional epression in switch 
case

like
switch $n

case (0n=4):


but no in php


You could use the following statement:

?php
switch (true) {
case (0  $n = 4):
$f = 1;
break;
case (5  $n = 7):
$f = 2;
break;
case (8  $n = 12):
$f = 3;
break;
default:
$f = 4;
break;
}
?

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



Re: [PHP] help out a noob w/ include switch?

2005-09-20 Thread Thorsten Suckow-Homberg

[...]


Try the following:

1) include() will only trigger a warning if the requested file is not within 
the include path. Thus, to make sure the file is found, you should use 
require() which triggers a fatal error and prevends the script from being 
executed if the given filename as the parameter cannot be found. This will 
give you probably a hint if there's something wrong with the include-path


2) Another suggestion would be to prepend ./ to the file you try to 
include:

instead of
include(file.php);
you should use
include(./file.php);

./ indicates that php should lookup the requested file in the directory 
the php-file resists in which called the include()-function. 


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



Re: [PHP] professional code quick tip

2005-09-20 Thread Thorsten Suckow-Homberg

I'm certain that is illegal.


Wanna bet? :)

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



Re: [PHP] professional code quick tip

2005-09-20 Thread Thorsten Suckow-Homberg

$100... cuz I'm sure you didn't mean to compound those conditionals such
that PHP doesn't understand them ;)


nargh... yes you're right... send me your account information along with 
your paypal login. I'll send you the money asap ;) 


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



Re: [PHP] this may be a daft question but.....defining indexes

2005-09-19 Thread Thorsten Suckow-Homberg
This may be a daft question but I keep getting notices on undefined 
indexes



I'm sorry to tell you, but this implies bad programming-practice. ;)

First off: Leveling the error_reporting in the php-ini is NOT a good idea! 
Have you ever tested osCommerce with error_reporting set to E_ALL? You 
better don't!


So get used to write your applications in error_reporting E_ALL, because 
this will inform you of every not properly intialized var you are using.


Back to the index-problem:

The best way to check the indizes is:

$p = isset($myArray['this_index_doesnt_even_exist']) ? 
$myArray['this_index_doesnt_even_exist'] : null;


This will check if the index in the given array exists: If, the value will 
be assigned to the var $p, else null will be returned, thus $p holding null 
(or any other value you want to assign per default). This will prevend 
error-output. For more information read the isset()-entry in the official 
php manual.


However, if you are using a third party app and want to get rid of this 
annoying messages, you can tell php not to output E_NOTICE or E_WARNING 
levelled messages. You can do this by editing the php.ini-parameter 
error_reporting. But basically, this is something you should never ever 
do. Your code should run clean even with error_reporting set to E_ALL.


Best regards


Thorsten Suckow-Homberg 


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