Re: [PHP] preventing duplicate rows?

2006-04-13 Thread Georgi Ivanov
You have several opportunities here :
1.If you use mysql 4.1.x you can use 
insert into .. on duplicate key update  (check the correct syntax)

2.You can make unique key from the two columns and check for error number 1062 
(duplicate key) like this :

myusql_query($qins) or $errno=mysql_errno();
if ($errno==0)P
OK!
}
elseif($errno ==1062){
Dupliacte!
}
else{
die(mysql_error());
}

On Thursday April 13 2006 09:54, William Stokes wrote:
 Hello,

 I'm updating a table with following SQL statement

  $sql = INSERT INTO x_ikaluokat (ryhma, ikaluokka)
VALUES ('$ryhma','$ikaluokka');

 What would be the best way to test that similar rows doesn't get created to
 the table? I can't make both columns unique.

 Thanks
 -Will

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



Re: [PHP] Internal Server Error

2006-04-13 Thread Georgi Ivanov
Do you have access to server logs ?
If yes, what they say ?
PHP as module or as CGI/FastCGI ?
When the error occurs ? immediately  or after some time ?

On Thursday April 13 2006 17:00, Rahul S. Johari wrote:
 Ave,

 This is something I don¹t understand.
 I have 3 php scripts that run fine on my localhost server, but when I
 upload the 3 files to my Internet Server (Hosting Account), I get the 500
 Internal Server Error. I am able to access them fine on my machine here
 (Running Apache Web Server)... But on my internet server, it just keeps
 giving me the 500 Internal Server Error. Any reason why it would be doing
 so?

 Rahul S. Johari
 Coordinator, Internet  Administration
 Informed Marketing Services Inc.
 500 Federal Street, Suite 201
 Troy NY 12180

 Tel: (518) 687-6700 x154
 Fax: (518) 687-6799
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com

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



[PHP] HTML_AJAX and formSubmit method

2006-04-05 Thread Georgi Ivanov
Hi List !
I'm playing around with HTML_AJAX PEAR module and came to a strange 
situation .
Consider following code :
div id=target style=border:solid 1pxnbsp;This is where the result will 
be printed /div
center
form onsubmit=return !HTML_AJAX.formSubmit(this,'target'); 
action=/ajax/test1.php method=post name=frmTest id=frmTest
div
table border=0
tr
td style=white-space: nowrap; background-color: #CC; 
align=left 
valign=top colspan=2bcenterLogin/center/b/td
/tr
tr
td align=right valign=topbUser:/b/td
td valign=top align=leftinput name=user type=text 
//td
/tr
tr
td align=right valign=topbPassword:/b/td
td valign=top align=leftinput name=pass 
type=password //td
/tr
tr
td align=right valign=topb/b/td
td valign=top align=leftinput name= 
value=Authenticate 
type=submit //td
/tr
/table
/div
/form/center

Nothing special here. This actually works. 
HTML_AJAX.formSubmit(this,'target')
send the request and get what is printed from test1.php in the DIV with 
ID=target.
The problem is when i try to change the ID of the DIV with something else . 
Whatever ID i choose the script does not work as expected. It does not change 
the innerHTML of the div but the content of the FORM. 
Looking at the generated code from server.php i notice this:

formSubmit: function (form, target, customRequest)
{
if (typeof form == 'string') {
form = document.getElementById(form);
if (!form) {
// let the submit be processed normally
return false;
}
}
if (typeof target == 'string') {
//I think we MUST go here but it seems we don't...
target = document.getElementById('target');
}
if (!target) {
//I guess we enter here but we shouldn't.
target = form;
}
..
The script seems to be OK but...
So generally this script works ONLY if the DIV is with ID=target and function 
called like this : HTML_AJAX.formSubmit(this,'target')
If i change the div with ID=alabala and call the script with : 
HTML_AJAX.formSubmit(this,'alabala') it does not work.
Any ideas ?

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



Re: [PHP] Error when compiling PHP from source on Mac OS X 10.4 server

2006-04-05 Thread Georgi Ivanov
I think you are missing httpd-devel package. At least on Linux is called 
something like this.
Also look for /usr/sbin/apxs(2)
If you are with apache 2.x you should use --with-apxs2[=/usr/sbin/apxs2]

Good luck

On Wednesday April 5 2006 12:54, Frank Arensmeier wrote:
 Hello.

 I try to compile PHP 4.4.2 from source on Mac OS X 10.4 server but I
 am getting error messages. The the install configuration runs just
 fine using the following options:

 ./configure
 --prefix=/usr/local/php
 --with-config-file-path=/usr/local/php/lib
 --with-apxs --with-iconv=/usr/local/php
 --with-zlib=/usr
 --with-mysql
 --enable-cgi
 --with-gd
 --with-png-dir=/usr/local/php
 --with-freetype-dir=/usr/local/php
 --with-t1lib=/usr/local/php
 --with-jpeg-dir=/sw
 --with-tiff-dir=/usr/local/php
 --with-curl=/usr/local/php
 --with-mcrypt=/usr/local/php
 --with-mhash=/usr/local/php
 --with-expat-dir=/usr/local/php
 --with-gettext=/usr/local/php
 --with-dom=/usr/local/php
 --with-dom-xslt=/usr/local/php
 --with-dom-exslt=/usr/local/php
 --with-xslt-sablot=/usr/local/php
 --enable-xslt
 --with-ldap
 --with-xmlrpc
 --with-xml
 --with-iodbc
 --enable-sockets
 --enable-trans-sid
 --enable-exif
 --enable-wddx
 --enable-ftp
 --enable-mbstring
 --with-mime-magic

 I might also add that the current PHP installed on the server is the
 one from entropy.ch. This install would be absolutely perfect for my
 needs, except the fact that PDFlib is compiled directly into PHP. I
 do not want pdfLIB compiled into PHP, because I like to update PDFlib
 to 6.0.3.

 The make command fires always an error saying that In file included
 from /path/to/php/source/sapi/apache/sapi_apache.c:24: followed by
 ten or more lines saying ... error: httpd.h: No such file or
 directory and last line: make: [sapi/apache/sapi_apache.lo) Error 1.

 I also tried a very basic install of PHP:
 ./configure --with-apxs

 but the error remains. Looking into the file sapi_apache.lo I saw
 that it wants some source files from the Apache distribution, right?
 I tried to just copy those files into the same directory as
 sapi_apache.lo is in but then I get other error messages.

 I am not that familiar with compiling from source so please be
 patient with me.

 Google was not my friend...

 What can I do?

 Regards,
 frank

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



Re: [PHP] HTML_AJAX and formSubmit method - Yes ! But why ?

2006-04-05 Thread Georgi Ivanov
 does the following make it work? ...
Yes it did ! But why ?
I'm passing string ... not variable...
I don't understand 


 Georgi Ivanov wrote:

 ...

  formSubmit: function (form, target, customRequest)
  {
  if (typeof form == 'string') {
  form = document.getElementById(form);
  if (!form) {
  // let the submit be processed normally
  return false;
  }
  }
  if (typeof target == 'string') {
  //I think we MUST go here but it seems we don't...
  target = document.getElementById('target');

 target = document.getElementById(target);

   //   ^-- no quotes!

  }
  if (!target) {
  //I guess we enter here but we shouldn't.
  target = form;
  }
  ..
  The script seems to be OK but...
  So generally this script works ONLY if the DIV is with ID=target and
  function called like this : HTML_AJAX.formSubmit(this,'target')
  If i change the div with ID=alabala and call the script with :
  HTML_AJAX.formSubmit(this,'alabala') it does not work.
  Any ideas ?

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



[PHP] no,no,no,Re: [PHP] HTML_AJAX and formSubmit method - Yes ! But why ?

2006-04-05 Thread Georgi Ivanov
I didn't  understood what are you saying at first.

I don't control the JS code . It is generated from the HTML_AJAX code.

The problem was fixed when calling formSubmit method like this :
HTML_AJAX.formSubmit(this,target) // No quotes here; target is just a string !

instead of :

HTML_AJAX.formSubmit(this,'target') // This was in the example i've used for 
testing

So i didn't changed the HTML_AJAX code. Just the client code.
Now the problem is fixed but i still don't understand why ...

On Wednesday April 5 2006 16:05, Georgi Ivanov wrote:
  does the following make it work? ...

 Yes it did ! But why ?
 I'm passing string ... not variable...
 I don't understand 

  Georgi Ivanov wrote:
 
  ...
 
   formSubmit: function (form, target, customRequest)
   {
   if (typeof form == 'string') {
   form = document.getElementById(form);
   if (!form) {
   // let the submit be processed normally
   return false;
   }
   }
   if (typeof target == 'string') {
 //I think we MUST go here but it seems we don't...
   target = document.getElementById('target');
 
  target = document.getElementById(target);
 
  //   ^-- no quotes!
 
   }
   if (!target) {
 //I guess we enter here but we shouldn't.
   target = form;
   }
   ..
   The script seems to be OK but...
   So generally this script works ONLY if the DIV is with ID=target and
   function called like this : HTML_AJAX.formSubmit(this,'target')
   If i change the div with ID=alabala and call the script with :
   HTML_AJAX.formSubmit(this,'alabala') it does not work.
   Any ideas ?

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



Re: [PHP] Looping information into a table

2006-04-04 Thread Georgi Ivanov
A little OT but i think it is important :
I really would not write this code like this .
You are making too many queries to the database . If u have 100 rows in first 
table and 200 rows returned from  second query , you make 100*200 queries to 
the database !
Try using SQL Joins. Like this :

?php
$query =select * from cforum cf INNER JOIN scforum;
$res=mysql_query($query);

while ($line=mysql_fetch_array($res)){
?
 table width=94% border=-1 bordercolor=black cellspacing=1
 cellpadding=0 align=center tr
 td
 table width=100% border=0 cellspacing=0 cellpadding=0
 bgcolor=#ff6600 tr
 tdfont face=tahoma size=1 color=white?php echo(font face =tahoma 
color=black size=1b$line[cname];/b/fontbr);
 ?/font/td td align=rightfont face=tahoma size=1
 color=whiteForum Mods Will Go Here/font/td /tr
 /table
 /td
 /tr
 tr
 td
 table width=98% border=0 cellspacing=2 cellpadding=0
 align=center tr
 tdfont face=tahoma color=black size=1
 ?php echo(font face =tahoma color=black size=1b-- Topic Name:
 /b$line[scname] br b-- Topic Description:/b line[scdesc]br); ?

 /td
 /tr
 /table
 /td
 /tr
 /tablebr
?php
}

You may want to use LEfT Join ..
This way you will make just ONE query to the database 

On Monday April 3 2006 06:31, benifactor wrote:
 i am creating a forum and i am having trouble getting the database
 information in to an html table

 i believe it has somthing to do with the placement of the while loops
 because they repeat the segment of code over untill the statment returns
 false, thus adding extra html.. you guys are the experts so if you could
 help i would appreaciate it. i will give you the code and an example of how
 its shows up and then how i need it to show up and if you could point me in
 the right direction it would be awsome...


 //code
 ?
 $query = mysql_query(select * from cforum);
 while ($query1 = mysql_fetch_array($query)) {
 $lid = $query1[id];

 $query2 = mysql_query(select * from scforum where cfid = '$lid');
 while ($query3 = mysql_fetch_array($query2)) {

 ?
 table width=94% border=-1 bordercolor=black cellspacing=1
 cellpadding=0 align=center tr
 td
 table width=100% border=0 cellspacing=0 cellpadding=0
 bgcolor=#ff6600 tr
 tdfont face=tahoma size=1 color=white?php echo(font face
 =tahoma color=black size=1b$query1[cname];/b/fontbr);
 ?/font/td td align=rightfont face=tahoma size=1
 color=whiteForum Mods Will Go Here/font/td /tr
 /table
 /td
 /tr
 tr
 td
 table width=98% border=0 cellspacing=2 cellpadding=0
 align=center tr
 tdfont face=tahoma color=black size=1
 ?php echo(font face =tahoma color=black size=1b-- Topic Name:
 /b$query3[scname] br b-- Topic Description:/b
 $query3[scdesc]br); ?

 /td
 /tr
 /table
 /td
 /tr
 /tablebr



 ?
 }
 }

 ?

 //end code

 //here is how it displays

 General;
Forum Mods Will Go Here

 -- Topic Name: General
 -- Topic Description: blagh l adsklhdfkhadklfhaklsdhf sdhlkh





 Other;
Forum Mods Will Go Here

 -- Topic Name: Other
 -- Topic Description: sdfdsjl;asdf





 Other;
Forum Mods Will Go Here

 -- Topic Name: Another Other
 -- Topic Description: sdafkasdhkdhas





 other;
Forum Mods Will Go Here

 -- Topic Name: yet another other
 -- Topic Description: Talk about all aspects of other. oh wait
 There is another forum just for that!





 Bug Reports;
Forum Mods Will Go Here

 -- Topic Name: Web Site Bug Reports
 -- Topic Description: Report bugs here. Please include
 information like, how the problem was encountered, the nature of the bug
 e.x. Spelling error on the forum page. Please give us steps on how to
 re-create the bug so we can fix it.




 // see this looks ok, but the 'others' should be grouped together

 like this
 Other; forum Mods Will Go Here
 -- Topic Name: Another Other
 -- Topic Description: sdafkasdhkdhas

 -- Topic Name: Other
 -- Topic Description: sdfdsjl;asdf


 -- Topic Name: yet another other
   -- Topic Description: Talk about all aspects of other.
 oh wait There is another forum just for that!




  if you get what i mean and can offer any help i would appreaciate it thank
 you in advance!

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



Re: [PHP] Looping information into a table

2006-04-04 Thread Georgi Ivanov
Sorry . 
The correct SQL should be:
 $query =select * from cforum cf INNER JOIN scforum ON  
cforum.id=scforum.cfid;

:) 

On Tuesday April 4 2006 11:58, Georgi Ivanov wrote:
 A little OT but i think it is important :
 I really would not write this code like this .
 You are making too many queries to the database . If u have 100 rows in
 first table and 200 rows returned from  second query , you make 100*200
 queries to the database !
 Try using SQL Joins. Like this :

 ?php
 $query =select * from cforum cf INNER JOIN scforum ON ;
 $res=mysql_query($query);

 while ($line=mysql_fetch_array($res)){
 ?
table width=94% border=-1 bordercolor=black cellspacing=1
  cellpadding=0 align=center tr
  td
  table width=100% border=0 cellspacing=0 cellpadding=0
  bgcolor=#ff6600 tr
  tdfont face=tahoma size=1 color=white?php echo(font face
 =tahoma color=black size=1b$line[cname];/b/fontbr);
  ?/font/td td align=rightfont face=tahoma size=1
  color=whiteForum Mods Will Go Here/font/td /tr
  /table
  /td
  /tr
  tr
  td
  table width=98% border=0 cellspacing=2 cellpadding=0
  align=center tr
  tdfont face=tahoma color=black size=1
  ?php echo(font face =tahoma color=black size=1b-- Topic Name:
  /b$line[scname] br b-- Topic Description:/b line[scdesc]br);
 ?

  /td
  /tr
  /table
  /td
  /tr
  /tablebr
 ?php
 }

 You may want to use LEfT Join ..
 This way you will make just ONE query to the database

 On Monday April 3 2006 06:31, benifactor wrote:
  i am creating a forum and i am having trouble getting the database
  information in to an html table
 
  i believe it has somthing to do with the placement of the while loops
  because they repeat the segment of code over untill the statment returns
  false, thus adding extra html.. you guys are the experts so if you could
  help i would appreaciate it. i will give you the code and an example of
  how its shows up and then how i need it to show up and if you could point
  me in the right direction it would be awsome...
 
 
  //code
  ?
  $query = mysql_query(select * from cforum);
  while ($query1 = mysql_fetch_array($query)) {
  $lid = $query1[id];
 
  $query2 = mysql_query(select * from scforum where cfid = '$lid');
  while ($query3 = mysql_fetch_array($query2)) {
 
  ?
  table width=94% border=-1 bordercolor=black cellspacing=1
  cellpadding=0 align=center tr
  td
  table width=100% border=0 cellspacing=0 cellpadding=0
  bgcolor=#ff6600 tr
  tdfont face=tahoma size=1 color=white?php echo(font face
  =tahoma color=black size=1b$query1[cname];/b/fontbr);
  ?/font/td td align=rightfont face=tahoma size=1
  color=whiteForum Mods Will Go Here/font/td /tr
  /table
  /td
  /tr
  tr
  td
  table width=98% border=0 cellspacing=2 cellpadding=0
  align=center tr
  tdfont face=tahoma color=black size=1
  ?php echo(font face =tahoma color=black size=1b-- Topic Name:
  /b$query3[scname] br b-- Topic Description:/b
  $query3[scdesc]br); ?
 
  /td
  /tr
  /table
  /td
  /tr
  /tablebr
 
 
 
  ?
  }
  }
 
  ?
 
  //end code
 
  //here is how it displays
 
  General;
 Forum Mods Will Go Here
 
  -- Topic Name: General
  -- Topic Description: blagh l adsklhdfkhadklfhaklsdhf sdhlkh
 
 
 
 
 
  Other;
 Forum Mods Will Go Here
 
  -- Topic Name: Other
  -- Topic Description: sdfdsjl;asdf
 
 
 
 
 
  Other;
 Forum Mods Will Go Here
 
  -- Topic Name: Another Other
  -- Topic Description: sdafkasdhkdhas
 
 
 
 
 
  other;
 Forum Mods Will Go Here
 
  -- Topic Name: yet another other
  -- Topic Description: Talk about all aspects of other. oh
  wait There is another forum just for that!
 
 
 
 
 
  Bug Reports;
 Forum Mods Will Go Here
 
  -- Topic Name: Web Site Bug Reports
  -- Topic Description: Report bugs here. Please include
  information like, how the problem was encountered, the nature of the bug
  e.x. Spelling error on the forum page. Please give us steps on how to
  re-create the bug so we can fix it.
 
 
 
 
  // see this looks ok, but the 'others' should be grouped together
 
  like this
  Other; forum Mods Will Go Here
  -- Topic Name: Another Other
  -- Topic Description: sdafkasdhkdhas
 
  -- Topic Name: Other
  -- Topic Description: sdfdsjl;asdf
 
 
  -- Topic Name: yet another other
-- Topic Description: Talk about all aspects of other.
  oh wait There is another forum just for that!
 
 
 
 
   if you get what i mean and can offer any help i would appreaciate it
  thank you in advance!

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



Re: [PHP] Can't get XSLT on PHP

2006-03-30 Thread Georgi Ivanov
I have it working with :
--with-xsl
--enable-xslt
--with-xslt-sablot

Do you have the libxslt-devel package ?
I'm not sure if it compiles it as module...
If it is module make sure it is enabled in php.ini


On Wednesday March 29 2006 22:17, MARG wrote:
 Anthony Ettinger wrote:
  obvious one, but did you restart apache?

 Sure :)

 -- AM

  On 3/29/06, MARG [EMAIL PROTECTED] wrote:
 Hi,
 
 I'm trying to get XSLT support on PHP, but i'm not able :(
 
 I've compiled Sablotron 1.0.2 successfully and compiled PHP 5.1.2 with
 --enable-xslt \
 --with-xslt-sablot
 
 I get no errors and PHP works fine, but i get no XSLT support (confirmed
 via phpinfo()).
 
 Any ideas ?
 
 Any help would be apreciated.
 
 Warm Regards,
 MA
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
  --
  Anthony Ettinger
  Signature: http://chovy.dyndns.org/hcard.html

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



[PHP] Class constructor

2006-01-31 Thread Georgi Ivanov
Hi,
I'm writing a simple class. In order to be compatible with php4 and php5 I've 
done this :

class test{
function Test(){
//This will be called in PHP4
}
function __construct(){
//This will be called in PHP5
$this-Test();
}
}

Is this a solution ? Is there a better way ?

Thanks.

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



Re: [PHP] Class constructor

2006-01-31 Thread Georgi Ivanov
Yes, I noticed that PHP5 call the old way constructor, but what if in future 
version they drop this feature ?
I think this is workaround for the problem . Or not ?

On Tuesday January 31 2006 15:52, David Grant wrote:
 Georgi,

 Drop __construct, PHP5 will call Test() anyway.

 From http://uk.php.net/manual/en/language.oop5.decon.php:

 For backwards compatibility, if PHP 5 cannot find a __construct()
 function for a given class, it will search for the old-style constructor
 function, by the name of the class.

 David
 --
 David Grant
 http://www.grant.org.uk/

 http://pear.php.net/package/File_Ogg0.2.1
 http://pear.php.net/package/File_XSPF   0.1.0

 WANTED: Junior PHP Developer in Bristol, UK

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



Re: [PHP] Re: [Bulk] Re: [PHP] PHP errors in Apache error logs

2005-12-20 Thread Georgi Ivanov
You need to compile php4-extensions or php5-extensions
/usr/ports/lang/

Good luck.

On Monday December 19 2005 22:32, Jose Borquez wrote:
 John Nichel wrote:
  Jose Borquez wrote:
  snip
 
  The Makefile configuration did have --disable-all included.  Here
  is the link to my phpinfo page;
  http://68.127.38.82/install/test.php
 
  You have no session support.

 I am not sure what to do now.  Do I need to uninstall and reinstall it
 with session support?  What is the configuration I need to specify?

 Thanks in advance,
 Jose

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



[PHP] IE and AJAX returning HTML with link stylesheet

2005-12-02 Thread Georgi Ivanov
Hi,
I have application that does this:
When one press a specific button, I'm calling JS function that make http(ajax) 
request to some php file . The php returns HTML like this :
--
link href=left.css rel=stylesheet type=text/css 
pSOME HTML HERE/p
--
The returned HTML i placed in div tag.
The logic is as follows:
When one click on link left, the php file returns link with specific CSS 
(left.css). If other button is clicked, the PHP returns html with other CSS 
linked.
 Everything is OK in Firefox. The problem is in IE . It appears that IE 
doesn't evaluate the CSS in link tag in returned HTML.
Any suggestions?

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



[PHP] imap_mail_move

2005-11-30 Thread Georgi Ivanov
Hi ,
I'm trying to move some mail from one dir to another:
$mbox=imap_open(...);
imap_mail_move($mbox,2,INBOX,Sent) or die (imap_last_error());

I get this error : 
error in imap command received by server .

I'm not sure what this error means. Any suggestions?
Thanks in advance.

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



Re: [PHP] GLOB sort order

2005-11-22 Thread Georgi Ivanov
On Tuesday 22 November 2005 11:41, Mark Lucas wrote:
 Can anyone help me please? I'm not an advanced PHP user!

 I'm looing for a way to sort the array returned by the GLOB function. I
 would like to be able to sort the result by filemtime.

 Any good ideas?

I think you can walk the array returned by glob and create a hash :
$arr=glob(..);
foreach($arr as $file){
$stat=stat($file);
$mtime=$stat[mtime];
$new[$file]=$mtime;
}

Now you should have array like this :
foo.txt = 19879823
foo1.txt = 1987987998
Now you can use array_sort function to sort the new  array.

Good luck.

 Thanks,

 Mark


 ___
__



   St John's Church, Polegate - Making Disciples of Jesus Christ

 ___
__



 This email is intended solely for the addressee and is strictly
 confidential.

 If you are not the addressee please delete the message from your computer.

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



[PHP] php5 call by refference

2005-11-21 Thread Georgi Ivanov
Hi,
AFAIK, in PHP5 one can't call function with function parameters .
The error is that you only can pass variables by reference.
foo(strlen('aaa'),strlen(''));

Is there some sort of workaround ?

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



Re: [PHP] Re: php5 call by refference

2005-11-21 Thread Georgi Ivanov
Thanks !
It's all clear now .
:)


On Monday 21 November 2005 14:45, Oliver Grätz wrote:
 Georgi Ivanov schrieb:
  Hi,
  AFAIK, in PHP5 one can't call function with function parameters .
  The error is that you only can pass variables by reference.
  foo(strlen('aaa'),strlen(''));
 
  Is there some sort of workaround ?

 First of all, the problem with this arises if your function foo is
 defined as

   function foo($a,$b) { ... }

 There is no problem if a and b are not reference parameters.
 So think a second about this: You tell in the definition of foo that you
 want to write to the position where a and b are stored. But by calling
 the funtion with strlen() you don't have a position in user space
 because the results of strlen() are just values which haven't been
 explicitly stored.

 Now you can decide if you don't write to your parameters a and b. Then
 there is no need for call by reference! It is not true that PHP copies
 the value and that you save memory by using references! The values of
 call-by-value parameters are copied if and only if you WRITE to them!
 The Zend Engine 2 is highly optimized for this.

 If you want to write to a and/or b then you must supply a storage
 container (also called variable *g*). Simplest way of supplying a
 temporary container:

   foo($t1=strlen('aaa'),$t2=strlen(''));

 Have Fun!
 OLLi

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



Re: [PHP] Fixing ID's in mySQL Table

2005-11-08 Thread Georgi Ivanov
You van do this :
1.Create new table with exactly the same structure as orig table.
2.Create little php script which does this :
select * from origTBL
while($line=mysql_fecth_array($res)){
insert into newtbl values()
}

In the new tbl yuo will have the records ordered.
Than just rename the tables. 

On Tuesday 08 November 2005 16:28, Rahul S. Johari wrote:
 Ave,

 This is what I need to do.
 Let's say, my ID's in a table look like this:

 1
 7
 9
 11
 12
 19
 26
 27
 29
 30

 I need to alter the table so that the ID's are in a sequence like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10

 It's easy to manually do this if you have a table with 10 records, but you
 can't do it manually in a table with 5000 records.

 I know that I can DELETE the ID Column and recreate it and that will Fix
 this problem, but doing that over and over with all the tables isn't what
 I'm really looking for. I just feel there should be a way in PHP to execute
 a logical query to do this. If not of course I can do the delete/recreate
 using phpmyadmin, but I just want to see if there's a php script way to do
 it.

 Thanks.

 On 11/8/05 9:22 AM, Gustav Wiberg [EMAIL PROTECTED] wrote:
  Hi there!
 
  Do you want an orderby-statement to be done on ID-field? Is that what you
  mean?
  I would go to phpmyadmin and fix that in the database-structure. (or some
  kind of database-utility)
 
  /G
  http://www.varupiraten.se/
 
 
 
  - Original Message -
  From: Rahul S. Johari [EMAIL PROTECTED]
  To: PHP php-general@lists.php.net
  Sent: Tuesday, November 08, 2005 2:37 PM
  Subject: [PHP] Fixing ID's in mySQL Table
 
 
 
  Ave,
 
  Is there a way to fix ID sequence in a MySQL table using PHP?
  Basically I have some tables with a  lot of records, 1000 to 5000. OID¹
  is the Primary Key column in these tables, and at the time the code was
  originally written, there weren¹t much verification of data being input
  going on. Thus a lot of junk records were being let in, which had to be
  deleted at some point or another. Now the ID sequence is all screwed up.
  It¹s not in sequence anymore.
 
  Is there a way to fix this?
 
  Thanks,
 
  Rahul S. Johari
  Coordinator, Internet  Administration
  Informed Marketing Services Inc.
  251 River Street
  Troy, NY 12180
 
  Tel: (518) 266-0909 x154
  Fax: (518) 266-0909
 
 
  Email: [EMAIL PROTECTED]
  http://www.informed-sources.com

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



Re: [PHP] Pictureupload

2005-11-04 Thread Georgi Ivanov
On Thursday 03 November 2005 19:12, twistednetadmin wrote:
My advise is not to use $_FILES['img']['type'] or use it with some switch 
statement.
Different browsers send different mime types for same image format. For 
example on mozila you have image/png on IE you have image/x-png (or vise 
versa)
Also the are different mimes for JPEG
image/jpg
image/jpeg
..
image/gif
image/x-gif


You better see what is the type of the image when the error occurs.


 The errormessage is from this part of the script.

 echo Result:br\n;
 echo Now that didn't seem to work... br\n
 Did you try a wrong format or size? br\n
 File that failed-- (.$_FILES['guildimage']['name '].)br;

 So it seems that the file is wrong type or size, but as it works with the
 same picture from my own computer that is odd.

 The timeout part I have to check before I answer to, but I have 4mb
 connection and the last user it failed for has a 2mb connection. 300kb
 shouldn't make the script time out? Or could it? Where do I check the
 timeout settings btw? PHP.ini?
 Or can I run phpinfo() on it?

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



Re: [PHP] Upper case problem

2005-10-03 Thread Georgi Ivanov
?php
$par=$_GET['string'];

if ($par == strtoupper($par)){
//This is uppercase
}
else{
//it is not uppercase
}
?
On Monday 03 October 2005 16:28, Merlin wrote:
 Hi there,

 I am having problems with users who upload text that only contains upper
 case letters. For example SEARCHING FOR.  Is there a way to detect this
 via PHP?` I would like to have the script return him to the form and inform
 him that this is not allowed.
 So basicly I need a sort of regex which does detect upper case letters in a
 row. Has anybody ann idea how such an regex could look like?

 Thank you for any hint,

 Merlin

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



Re: [PHP] Size limits of mysql

2005-09-15 Thread Georgi Ivanov
There is [max allowed packet] variable in mysql. The default is 1MB in my 
config.
May be this is what stops you. Try increasing this value.


On Wednesday 14 September 2005 01:07, [EMAIL PROTECTED] wrote:
 Hi All,





 I have a simple database with one table with about 6 fields, just
 holding filenames, filepaths and sizes.  Very basic audit for management
 here.   Problem is I import a load of records into this table and it
 seems to only allow me to put in about 550,000 records.Maybe it's
 just mysqlFront that can only display that many records or something.
 Anybody know of a size or record limit in mysql tables?  The actual size
 of the database is about 70Mb.   Not huge really.





 Thanks



 Matthew


Re: [PHP] Apache Linux question

2005-09-06 Thread Georgi Ivanov
It is no clear which option you are looking for.
If it's PHP compile options use :
?php
echo phpinfo();
?
This will give you information you need.

On Tuesday 06 September 2005 16:39, Feris Thia C. wrote:
 Hi All,

 If I already install my Apache on linux system, then is it possible to
 check what configuration settings I provided when compiling the source ??

 Regards,

 Feris

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



[PHP] running process in the background

2005-08-31 Thread Georgi Ivanov
Hi,
I'm experiencing strange behavior when trying to run background process in 
PHP.
Code :
//Run_check.php
foreach ($_POST as $kid){
`php run.php param1 param2  /dev/null `;
}
In this case PHP waits all the instances of the process to complete.
I don't understand why.

I have a workaround here, but anyway i don't understand why the above example 
doesn't work.

If i don't run the cycle here , but run other file and there run the cycle 
that runs the the background processes everything is OK.


/*This file gets $_POST , implodes it , and passes the string to the other 
script */
//Run_check.php
$ids=implode(',',$_POST);
` php run1.php $ids`;



/*This script takes the input , explodes it and runs a cycle that runs the 
background process*/
//run1.php :

$kwid=explode(',',$argv[1]);
foreach ($kwid as $kid){
`php run.php param1 param 2  /dev/null `;
}

Everything is OK.

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



[PHP] display error line in object method

2005-08-10 Thread Georgi Ivanov
Hi,
I have a db wrapper class.
I use it like this :
$db-query(SQL HERE) or die ($db-error());
Is there a way to display the line on which $db-error() is executed without 
doing die (__LINE__. .$db-error() )?
If i put __LINE__ in the class the line number is always the line in the class 
file.

I want when i call $db-error() to display the current line number.

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



Re: [PHP] display error line in object method

2005-08-10 Thread Georgi Ivanov
Thank you for the replay.
I know i can pass __LINE to $db-error().
This is not the idea. I want $db-error() to print the line on which it was 
executed .
$parent::__LINE__ 
Who is the $parent here ?


On Wednesday 10 August 2005 18:20, Mike Johnson wrote:
 From: Georgi Ivanov [mailto:[EMAIL PROTECTED]

  Hi,
  I have a db wrapper class.
  I use it like this :
  $db-query(SQL HERE) or die ($db-error());
  Is there a way to display the line on which $db-error() is
  executed without
  doing die (__LINE__. .$db-error() )?
  If i put __LINE__ in the class the line number is always the
  line in the class
  file.
 
  I want when i call $db-error() to display the current line number.

 Probably not the answer you're looking for, but I think your best option
 may be to pass __LINE__ as an arg to error() and use it there as you
 please. I don't know of any $parent::__LINE__ syntax, which is what it
 sounds like you're asking about...

 --
 Mike Johnson Smarter Living, Inc.
 Web Developerwww.smartertravel.com
 [EMAIL PROTECTED]   (617) 886-5539

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



Re: [PHP] function MAX with WHERE

2005-07-25 Thread Georgi Ivanov
What print_r($test_m) say ?
Or echo mysql_num_rows($test);
May be you get 0 records from your query.

On Monday 25 July 2005 09:06, Jesús Alain Rodríguez Santos wrote:
 I have someting like this:

 $test = mysql_query(SELECT MAX(dato) AS datos FROM tabla WHERE campo_mes
 = '$mes');
 $test_m = mysql_fetch_array($test);
 $test_mes = $test_m['datos'];

 print $test_mes

 where $mes is a value
 I need to know if something its wrong, because I don't recive any error,
 but I see nothing




 --
 Este mensaje ha sido analizado por MailScanner
 en busca de virus y otros contenidos peligrosos,
 y se considera que está limpio.

-- 
Regards
Georgi Ivanov

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



Re: [PHP] PDO Error

2005-07-15 Thread Georgi Ivanov
 Hi. When using this example from
 http://netevil.org/talks/index.php?t=pdos=20, the site of pdo's author I
 have this error:

 Fatal error: Call to a member function fetchAll() on a non-object in
 /www/home/testes/pdo_my1.php on line 17


Object creation :
 $dbh = new PDO('mysql:host=localhost;dbname=dbtest', 'user', 'pass');
 $stmt = $dbh-query(SELECT * FROM foo);
Here I think  $stmt is NOT an object.
$stmp should be RESOURCE or boolean value most likely.
So it should be $rows=$dbh-fetchAll();
 $rows = $stmt-fetchAll();
 $count = count($rows);
 foreach ($rows as $row) {
 print_r($row);
 }
 $stmt = null;

 Wht's wrong with the example?

 Greetings
 holografix

-- 
Regards
Georgi Ivanov

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



Re: [PHP] Display picture from MySQL

2005-06-27 Thread Georgi Ivanov
/*Fetch the image :*/
$res=mysql_query(select picture from pics_table where id=1) or die(err);
$line=mysql_fecth_array($res);
/*Send headers*/
header(content-type: image/png);
echo $line[picture];


On Monday 27 June 2005 15:38, Bagus Nugroho wrote:
 Hi All,

 I'm looking for tutorial/template/code, how to display a picture on web
 pages which the picture is stored on MySQl database.


 Thanks in advance,
 regards

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



Re: [PHP] domxml problem

2005-05-16 Thread Georgi Ivanov
On Friday 13 May 2005 20:03, Brian V Bonini wrote:
 On Fri, 2005-05-13 at 10:31, Georgi Ivanov wrote:
  But it gives me error on this line :
  $DomDocument = domxml_open_file($file);

 What's the error?

The error is :
Call to undefined function
I tried with the new function ( domxml_open_file) and depricated one 
(xmldocfile)
There is no dom_xml_file function .


 Try:

 $dom = dom_xml_file($file);


 --

 s/:-[(/]/:-)/g


 BrianGnuPG - KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
 ==
 gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
 Key Info: http://gfx-design.com/keys
 Linux Registered User #339825 at http://counter.li.org

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



[PHP] domxml problem

2005-05-13 Thread Georgi Ivanov
Hello,
I compiled PHP 5 with following ./configure line 

./configure \
--prefix=/usr/local/php5 \
--with-apxs2=/usr/sbin/apxs2-prefork \
--with-config-file-path=/etc/php5 \
--enable-mbstring \
--enable-mbregex \
--with-mysql \
--with-gd \
--enable-gd-imgstrttf \
--enable-gd-native-ttf \
--with-zlib-dir=/usr/lib \
--with-png-dir=/usr/lib \
--with-jpeg-dir=/usr/lib \
--with-tiff-dir=/usr/lib \
--with-ttf-dir=/usr/lib \
--with-freetype-dir=/usr/lib \
--enable-ftp \
--enable-memory-limit \
--enable-safe-mode \
--enable-bcmath \
--enable-calendar \
--enable-ctype \
--with-ftp \
--with-bz2 \
--enable-inline-optimization \
--with-iconv \
--with-xsl \
--with-bz2 \
--enable-soap \
--enable-sockets \
--enable-zend-multibyte \
--enable-magic-quotes \
--with-openssl \
--with-sqlite \
--enable-sqlite-utf8 \
--with-xmlrpc \
--enable-xslt \
--with-xslt-sablot \
--with-dom \
--with-dom-xslt \
--with-dom-exslt

phpinfo() say that i have DOM enabled 

DOM/XML enabled
DOM/XML API Version 20031129
libxml Version  2.6.17
HTML Supportenabled
XPath Support   enabled
XPointer Supportenabled
Schema Support  enabled
RelaxNG Support enabled


But it gives me error on this line :
$DomDocument = domxml_open_file($file);

Any ideas ?

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