[PHP] mysql adapter and DAL

2011-09-17 Thread shahrzad khorrami
hi all,
I'm looking for a mysql adapter for create my dal..
where can I find a good one? and have you ever written a dal with a mysql
adapter?
in my dal I want to pass parameters to sql sting, for example like
following:
$db-query($sql, array($name, $family))

thanks,
Shahrzad Khorrami


Re: Re: [PHP] mysql adapter and DAL

2011-09-17 Thread shahrzad khorrami
mysqli - it's what I wanted. thanks


[PHP] recursive

2010-07-17 Thread shahrzad khorrami
hi all :)
here is a xml file:

directive
   rule
  rules
 rule  /rule
 rule  /rule
  /rules
   /rule
/directive

directive
   rule
  rules
 rule  /rule
 rule  /rule
  /rules
   /rule
/directive
.
.
.
.
I have a xml file with a name for example(test.xml)..
and 3 tables of database, (group,directives,rules)
group is for recording the name of the opened xml file,  directives is for
storing the attributes of directive tag and rules is for 'rule' tag's
attributes.

I know I must use of recursive function.. but how? first read name of the
xml file and store it in group table, then the content of the file and fill
the directive and rules table...


directive  .*... attrs go to directives table..*.
   rule * ...attrs go to rules table...*.
  rules * ..no attrs.*.
 rule   *...attrs go to rules table...*.  /rule
 rule  *...attrs go to rules table..*..  /rule
  /rules
   /rule
/directive


how to implement it in php?

Thanks,
Shahrzad


[PHP] simplexml_load_file problem

2010-05-24 Thread shahrzad khorrami
hi all,

$results is a xml format string,
I want to get this string as a real xml file
$nodes = simplexml_load_file($results);
but $nodes is empty array...
how can I do that?
nodes must be an object contains xml


Thanks,
Shahrzad Khorrami


Re: [PHP] simplexml_load_file problem

2010-05-24 Thread shahrzad khorrami
by using of ' simplexml_load_string' instead of file, I solved my problem :)
thanks


[PHP] Zend_Soap_Client --HOw to pass what function to call from wsdl

2010-05-24 Thread shahrzad khorrami
hi all,


Is it possible to define (pass a argument  'function name') that we can
change the function to call from soap? for example here we can pass getList
and then = $client-geList()  must call... it means pass what function to
call from wsdl...

$this-_helper-results('this func must call from wsdl')



class Zend_Controller_Action_Helper_Results extends
Zend_Controller_Action_Helper_Abstract
{


$client = new Zend_Soap_Client('http://192.168.200.18/neuron.wsdl',
$options);
$result = $client-*getUsers*();




Regards,
Shahrzad Khorrami


[PHP] Re: Zend_Soap_Client --HOw to pass what function to call from wsdl

2010-05-24 Thread shahrzad khorrami
ok friends, solved ;)
$funName = 'getAssetHostsList';
$results = $this-_helper-results($funName);



$result = $client-$funName();

Thanks
shahrzad


Re: [PHP] create tree from arrays

2010-05-15 Thread shahrzad khorrami
Thanks to all, it works now:

function mktree_array($arr, $id = 0)
{
   $result = array();
   foreach ($arr as $a) {
   if ($id == $a['parentID']) {
   $a['children']  = $this-mktree_array($arr, $a['nid']);
   $result[] = $a;
   }
   }
   return $result;
}


merci

Shahrzad ;)


[PHP] create tree from arrays

2010-05-13 Thread shahrzad khorrami
hi all,

I want to create an array from another array to create json file in my
format and pass it to a js libraryok.
I just know that I have to use recursive function... but how? it's hard for
me to create the new array..

main array:

Array
(
[0] = Array
(
[nid] = 1
[parentID] = 0
[text] = Dashboard
[cls] = x-btn-icon
[icon] = lib/extjs/resources/images/default/icon/Dashboard.png
[singleClickExpand] = 1
[leaf] = 0
[id] = Dashboard
)

[1] = Array
(
[nid] = 2
[parentID] = 1
[text] = Dashboard
[cls] = firstExpanded
[icon] = lib/extjs/resources/images/default/tree/s.gif
[singleClickExpand] = 1
[leaf] = 0
[id] =
)

[2] = Array
(
[nid] = 3
[parentID] = 2
[text] = Dashboard
[cls] = x-btn-icon
[icon] = lib/extjs/resources/images/default/tree/s.gif
[singleClickExpand] = 1
[leaf] = 1
[id] = dashboard
)
...


-- The array I want to create: 

[0] = Array
(
[nid] = 1
[parentID] = 0
[text] = Dashboard
[cls] = x-btn-icon
[icon] = lib/extjs/resources/images/default/icon/Dashboard.png
[singleClickExpand] = 1
[leaf] = 0
[id] = Dashboard
[children] = Array(
 [0] = Array
(
[nid] = 2
[parentID] = 1
[text] = Dashboard
[cls] = firstExpanded
[icon] =
lib/extjs/resources/images/default/tree/s.gif
[singleClickExpand] = 1
[leaf] = 0
[id] =
[children] = Array(
[0] = Array
(
  [nid] = 3
  [parentID] = 2
  [text] = Dashboard
  [cls] = x-btn-icon
  [icon] =
lib/extjs/resources/images/default/tree/s.gif
  [singleClickExpand] =
1
  [leaf] = 1
  [id] = dashboard
  )
)
)
)
)

.
wow!
it means that by nid and parentID, I'll notice where I must add children
item to array...

Thanks,
Shahrzad


Re: [PHP] create tree from arrays

2010-05-13 Thread shahrzad khorrami
Thanks Rechard :) I'm testing it... merccc


Re: [PHP] create tree from arrays

2010-05-13 Thread shahrzad khorrami
Dear Richard,
 we have more than one parentID  with value 0 in main array, your
code is so good but show me just the children of first parentID 0.

:)

Thanks,
Shahrzad


[PHP] Re: -----json and php----help

2010-05-11 Thread shahrzad khorrami
thanks Nathan, I think this is a good way


Re: [PHP] Strange MySQL Problem

2009-12-14 Thread shahrzad khorrami
Salaaam

$sql = INSERT INTO BOOK(bookname, authorsname, ISBN) VALUES
('.$_POST[bookname].'' , '.$_POST[authorsname].',''.$_POST[ISBN].');

above line is correct, your code is wrong ,$_POST[ISBN]');

and add
$host = 'localhost';
$con = mysql_connect($host, $username, $password);

you can also check this page:
http://php.net/manual/en/function.mysql-connect.php

Regards,
Shahrzad


Re: [PHP] Best ajax library

2009-12-12 Thread shahrzad khorrami
salam ;)

JQuery is good one.



-- 
Shahrzad Khorrami


Re: [PHP] alpha/beta/gamma TO $var['alpha']['beta'] = 'gamma'

2009-06-07 Thread shahrzad khorrami
:D


[PHP] Pointer for csv files

2009-05-30 Thread shahrzad khorrami
hi,

Is there any function in php to get data of a csv file from a line to
another line that we say?
for example get me data   from  line  400  to  line  1400  of a csv file. if
no function, what you recommend to get data?

Thanks in advance,
Shahrzad


[PHP] Background Process

2009-05-26 Thread shahrzad khorrami
Hi,
I have two php scripts, first one must pass arguments to second(the php
script that will take more time to process for example inserting 100
records to db, data come from first script). I search around web and find
below function:



function execInBackground($path, $exe, $additional) {
global $conf;

if (file_exists($path . $exe)) {
chdir($path);
if (substr(php_uname(), 0, 7) == Windows){
echo 'going Windows';
pclose(popen(start \bla\ \ . $exe . \   . $additional,
r));   } else {
exec(./ . $exe .   .  $additional .   /dev/null
);   }
}
}

But I don't know how to pass variables to the second file? and how to use of
this function?
in *windows* enviroment... and return value of second file to first..

Thanks in advance
shahrzad


Re: [PHP] fgets function for very large files

2009-05-25 Thread shahrzad khorrami
in the following loop:

$row = 1;
while (($line = fgets($handle, 1024)) !== FALSE )
{
$line = str_replace(SEPARATOR, ,, $line);

$data = explode(,, $line);

   $row++;
}

How put 1000 by 1000 lines of csv file to new ones?
and you know I think this works slowly
what do you recommend?

Thanks in advance,
shahrzad







 1: http://php.net/fgetcsv
 2: if( ($row % 1) == 0 ) {
 3: http://php.net/fputcsv





[PHP] executing background process from php

2009-05-25 Thread shahrzad khorrami
Hi friends,
I am newbie with this subject and really need to know it...
I need a good and clear samples of 'executing background process from
phphttp://www.webdeveloper.com/forum/showthread.php?t=90061'

where can I find it?

Thanks in advance,
Shahrzad


Re: [PHP] fgets function for very large files

2009-05-24 Thread shahrzad khorrami
How to divide a large csv file to small ones?

Thanks,
Shahrzad


Re: [PHP] fgets function for very large files

2009-05-24 Thread shahrzad khorrami
:-o
I want to divide this large csv file with programming to small one!


[PHP] fgets function for very large files

2009-05-23 Thread shahrzad khorrami
hi all,

I have a csv file with more than 100,000 lines. I want to insert each line
as a record in a
database. but for the reason of very number of lines,
I put a button with caption Next,  when we click on it, 1000 line will
insert into db and then again click next button
and insert next 1000 line and
 is this good way? what do you recommend? and how can I do that?


Thanks in advance,
shahrzad


Re: [PHP] fgets function for very large files

2009-05-23 Thread shahrzad khorrami
one thing!  I need four fields of  7 fields in each line,
in my code from original csv file first four of fields choose(mappping these
fields with columns of table in db)
for example:
a line in csv file:
a,b,c,d,e,f,g

in table of database 4 column : name,ext,tel,date
that 4 field of csv file must map to these column

then I can't directly import my csv file into db. some process must do to
insert  just my selected fields of csv file...

Thanks,
Shahrzad


[PHP] soft Phone

2009-03-10 Thread shahrzad khorrami
Hi all :-)

I want to use of *soft phone* application in my php codes..First is it
possible? has php a module for this purpose?
if it hasn't... By the way I think I must use of something else such as a
java application in my php codes...
now how can I embed this application to my program? and do you know where I
can find this application source code?


Thanks in advance,
shahrzad khorrami


[PHP] phpMailer Problem!

2009-01-18 Thread shahrzad khorrami
hi all,

I want to send email using SMTP Authentication with PHPMailer,
I searched more and more but I can't find anything of my problem

///
include_once('class.phpmailer.php');
include(class.smtp.php); // optional, gets called from within
class.phpmailer.php if not already loaded

$mail = new PHPMailer();
$mail-IsSMTP();

$mail-Host   = mail.xx.com;  // sets GMAIL as the SMTP
server
$mail-Port   = 80;

$mail-Username = webs...@xxx.com;  // SMTP username
$mail-Password = x; // SMTP password

$mail-From   = webs...@xx.com;
$mail-FromName   = First Last;

$mail-Subject= PHPMailer Test Subject via smtp;

$mail-AltBody= To view the message, please use an HTML compatible
email viewer!; // optional, comment out and test

$mail-MsgHTML(h);

$mail-AddAddress(xx...@gmail.com, John Doe);

//$mail-AddAttachment(images/phpmailer.gif); // attachment

if(!$mail-Send()) {
  echo Mailer Error:  . $mail-ErrorInfo;
} else {
  echo Message sent!;
}


result is nothing, no error but didn't send
then I remove Username   password, but didn't work!...



thanks,
shahrzad khorrami


[PHP] phpMailer Problem!

2009-01-18 Thread shahrzad khorrami
I tested with port 25, but it didn't work.
I confuse, I don't know what problem is
 it works well with gmail...

thanks for reply :)


Re: [PHP] phpMailer Problem!

2009-01-18 Thread shahrzad khorrami
thanks chris :)


Re: [PHP] Thank you everyone, What a wonderful world

2009-01-02 Thread shahrzad khorrami
I'm sorry for there are no rules in the world  no real men to help them. May
*Allah* help them
as we see what happened in *Iraq* who started war with Iran and just he can!
I believe because I can't see any power in men to do that. America is
behind Israel and other countries really are too weak and timid to help.
just pray for them..
thanks behzad


[PHP] Control Over Printer Queue On Windows

2008-11-01 Thread shahrzad khorrami
Hi all,

I am writing a script to print a few thousand pdf documents and I need
to have some control over the number of jobs that are sent to the
printer queue at time ...

I can not see how to get print queue information eg the number of
jobs pending .. at least my attempts are failing..

any ideas?

Thanks in advance


[PHP] strrev() for persian language!

2008-09-29 Thread shahrzad khorrami
hi all,

for reversing of characters, strrev() is good. but for persian characters
it doesn't work!

Thanks


[PHP] Re: strrev() for persian language!

2008-09-29 Thread shahrzad khorrami
Thanks alot
I tested what you said and
IT WORKS!

Thanks Maciek :-)


[PHP] Fwd: strrev() for persian language!

2008-09-29 Thread shahrzad khorrami
hi all,

is there any function to return us the lanuage of a word in the sentence?

for example : My name is شهرزاد .

when it sees شهرزاد notice that is a persian language.


Thanks


[PHP] return language of a word

2008-09-29 Thread shahrzad khorrami
hi all,

is there any function to return us the lanuage of a word in the sentence?

for example : My name is شهرزاد .

when it sees شهرزاد notice that is a persian language.


Thanks


[PHP] Re: return language of a word

2008-09-29 Thread shahrzad khorrami
Thanks for reply

U+103A0 ... U+103DF

How can I use of it?