Re: [PHP] Reseting the auto-increment number in a MySQL database.

2013-06-27 Thread adriano


holes in sequence of auto increment happen using transaction for insert 
new record but you don't commit transaction itself

it seems that the autoincrement is incremented anyway
at least this is my case.


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



[PHP] Performance Problem

2008-02-27 Thread Adriano Manocchia

Hi all,

I've been chasing what I think is the same performance issue for about
a year and it's driving me batty. First off, the server is a dual core
2.8 P4 with 2G RAM running RHEL5 hosted at The Planet and is under
very light load. This problem started last year while the server was
RHEL4 and I completely rebuilt it with RHEL5.

The PHP-based sites hosted on the server have shown intermittent
performance issues when loading. A page might load fine 2 or 3 times,
then take 5-10 seconds to complete the next page load.

I've gone through everything top-to-bottom to try to eliminate
possibilities:

First thought was MySQL, so I took that out of the equation and tested
pages that didn't use the database and that had no effect.

Second though was httpd, so I compared straight HTML with PHP, and
found the problem only occurred with the PHP pages. Straight html had
no issues, so it's definitely a PHP problem.

I've been compiling my own PHP with MySQL binary releases, so to make
sure I wasn't causing the problem, I rolled back to RHEL5 httpd, php,
and mysql. I even used the RPM's php.ini to try to rule everything
out. To try and quantify the issue, I made a PHP page that just had a
one-line echo and compared it with a regular html page and ran httperf
tests with the following values (run from the server to take network
issues out of the equation):

httperf --hog --num-conn 100 --ra 10 --timeout 5

The html page always ran with no errors:
Connection time [ms]: min 0.2 avg 0.4 max 13.7 median 0.5 stddev 1.4
Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0


On the other hand, the PHP on successive attempts:
Connection rate: 6.9 conn/s (145.0 ms/conn, =31 concurrent connections)
Connection time [ms]: min 83.3 avg 585.4 max 2215.0 median 406.5
stddev 510.6
Reply status: 1xx=0 2xx=70 3xx=0 4xx=0 5xx=0
Errors: total 30 client-timo 30 socket-timo 0 connrefused 0 connreset 0

Connection rate: 10.0 conn/s (99.7 ms/conn, =6 concurrent connections)
Connection time [ms]: min 25.7 avg 232.1 max 1443.4 median 141.5
stddev 244.0
Reply status: 1xx=0 2xx=100 3xx=0 4xx=0 5xx=0
Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0

Connection rate: 6.8 conn/s (148.0 ms/conn, =47 concurrent connections)
Connection time [ms]: min 107.4 avg 1066.1 max 1989.7 median 1201.5
stddev 519.5
Reply status: 1xx=0 2xx=22 3xx=0 4xx=0 5xx=0
Errors: total 78 client-timo 78 socket-timo 0 connrefused 0 connreset 0

As you can see, it's all over the place and it shouldn't really be
taxing it enough to cause problems on that server. At this point, I
don't know what else to do. If anyone can shed any light on this, I'd
be forever grateful. I'll try anything and do whatever I can on my end
to fix this. Thanks in advance.

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



Re: [PHP] Performance Problem

2008-02-27 Thread Adriano Manocchia
I know my original post was long-winded, but I did mention that my php  
tests were run on a single-line PHP script that simply echoed hi so  
it couldn't get much simpler than that. But for thoroughness' sake,  
I've run the tests against a test file with a php extension with no  
PHP code at all, and it suffers the same performance problems/ The  
only modules loaded for the tests were gd, mysql, pdo.


For what it's worth, I help manage several RHEL servers at my day job  
that run similar hardware and far more bloated PHP builds that have no  
performance issues whatsoever. And also, for what it's worth, none of  
the other services on the server have problems.


On Feb 27, 2008, at 1:00 PM, Daniel Brown wrote:

On Wed, Feb 27, 2008 at 12:39 PM, Adriano Manocchia [EMAIL PROTECTED] 
 wrote:

Hi all,

I've been chasing what I think is the same performance issue for  
about
a year and it's driving me batty. First off, the server is a dual  
core

2.8 P4 with 2G RAM running RHEL5 hosted at The Planet and is under
very light load. This problem started last year while the server was
RHEL4 and I completely rebuilt it with RHEL5.

[snip all of the good stuff --- thanks for a well-written question!]

   Adriano,

   It really depends on what PHP is expected to do prior to serving
the content.  Some things to consider:
   Are you loading a bunch of modules in your php.ini?
   What is the script doing?  Is it reading/writing files?
Including files?  If so, are they local or remote?
   What happens if you take a static HTML page and rename it with
a .php extension and compare load times?

   The last of the questions will be of the most help in determining
which of the first two would be more applicable, because when you
rename the extension, PHP will be loaded by Apache.  This means:
   a.) If the performance is degraded by comparison, it's a
slow-loading PHP engine.
   b.) If the benchmarks are comparable, then it's likely
something in your PHP script(s).

--
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?


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



Re: [PHP] Performance Problem

2008-02-27 Thread Adriano Manocchia
I'm trying to get it working but it doesn't seem to want to write the  
profile info at the moment. Correct me if I'm wrong, but wouldn't this  
just show problems within actual code? If the problem is occurring on  
a PHP file with no PHP in it whatsoever, it seems to fall outside the  
scope of what xdebug would show.


On Feb 27, 2008, at 1:32 PM, Eric Butera wrote:


Try using Xdebug[1] with the xdebug.profiler_aggregate = 1 switch.

This will allow you to see a generalized overview of all the different
requests of your site.  This way you can spot a weakness in your
bootstrapping problem vs a single page being slow.

[1] http://www.xdebug.com/


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



Re: [PHP] Performance Problem

2008-02-27 Thread Adriano Manocchia
OK. I just went through about 10 minutes' worth of cachegrinds,  
including several httperf tests on that empty php file (which had the  
usual poor results). According to the cachegrind files, nothing  
(including the other active web pages) took more than 15ms and the  
empty php file never exceeded 1ms. Clearly it's not having problems  
once it gets to processing the files. The issue seems to lie elsewhere  
with PHP.


On Feb 27, 2008, at 1:32 PM, Eric Butera wrote:


Try using Xdebug[1] with the xdebug.profiler_aggregate = 1 switch.

This will allow you to see a generalized overview of all the different
requests of your site.  This way you can spot a weakness in your
bootstrapping problem vs a single page being slow.

[1] http://www.xdebug.com/


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



Re: [PHP] Performance Problem

2008-02-27 Thread Adriano Manocchia
Well, I just spent more time messing with httpd's conf and it the  
problem seems to have resolved itself by turning off hostname lookups.  
I know there's overhead associated with it, but I don't really  
understand why it only affected PHP, and so drastically. At any rate,  
I guess this issue is solved. Thanks for the help.


Adriano

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



Re: [PHP] Performance Problem

2008-02-27 Thread Adriano Manocchia
Whoa. No need to get snippy. I was being sincere in my gratitude for  
the suggestions. If nothing else, I'm sure I'll be making more use of  
Xdebug in the future.


On Feb 27, 2008, at 3:55 PM, Shawn McKenzie wrote:


Adriano Manocchia wrote:

Well, I just spent more time messing with httpd's conf and it the
problem seems to have resolved itself by turning off hostname  
lookups. I
know there's overhead associated with it, but I don't really  
understand
why it only affected PHP, and so drastically. At any rate, I guess  
this

issue is solved. Thanks for the help.

Adriano


Yes, we all knew exactly what your problem was.  Sorry we didn't post
quicker ;-)

-Shawn

--
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] Date Question

2006-03-17 Thread adriano ghezzi
on the fly:
use date_format function  in select statement,  format should be a string
like %d%m%y not sure about  it check on manual.

hth

adriano


2006/3/17, Tom Chubb [EMAIL PROTECTED]:

 Please can you help me. I've created a page where problems are posted into
 a
 database and I am using the datetime format in MySQL and trying to find
 the
 best way to display it in the 17/03/06 format.
 I've found a way of doing it (so you don't think I haven't googled, RTFM)
 but don't think it's the best way.
 Any help would be appreciated.

 (Current Code:)

 ?php
 $datestr = $row_rsSnags['date'];
 $arr1 = str_split($datestr, 2);
 echo $arr1 [2];
 echo /;
 echo $arr1 [1];
 echo /;
 echo $arr1 [0];
 //  echo $row_rsSnags['date'];
 ?




Re: [PHP] Str to Int

2006-01-20 Thread adriano ghezzi
well I don't well understand the problem hope these two snippets can solve
your problem: i tested them seems fine

file 1 form.php

html

head
meta http-equiv=Content-Language content=it
meta http-equiv=Content-Type content=text/html; charset=windows-1252
titleenter tour code/title
/head

body

pnbsp;/p
penter tour code/p
form method=POST action=get_card.php
 table border=1 width=47% id=table1
  tr
   td width=186user/td
   tdinput type=text name=txt_user size=20/td
  /tr
  tr
   td width=186code/td
   tdinput type=text name=txt_id size=20/td
  /tr
  tr
   td colspan=2
   p align=centerinput type=submit value=Invia name=B1
   input type=reset value=Reimposta name=B2/td
  /tr
 /table
 p dir=ltrnbsp;/p
/form
pnbsp;/p

/body

/html



file 2
--

get_card.php

html

head
meta http-equiv=Content-Type content=text/html; charset=windows-1252
titleNuova pagina 1/title
/head

body

?php

print string value:::.$_POST['txt_id'].br;

$int_id=intval(trim($_POST['txt_id']));

print integer value:::$int_id.br;

print type returned:.gettype($int_id).br;

?


/body

/html











2006/1/20, Ron Eggler (Paykiosks) [EMAIL PROTECTED]:

 Hi,

 I need to do a type cast from string to int in folllowing code:
 [php]
 getPIN cardID='.intval(trim($cardID)).' quantity=1 /
 [/php]
 I need $cardID have converted to int. I thought it should work that way
 but it does not!
 But it's working if I'm putting
 [php]
 getPIN cardID=180 quantity=1 /
 [/php]
 in there. I got card ID as a var that is passed as get like:
 [php]
 $cardID = $HTTP_GET_VARS[cardID];
 [/php]

 Can anyone help me in that issue? Thank you!

 __

 Ron Eggler
 Intern
 866-999-4179
 www.paykiosks.net






Re: [PHP] insert to DB

2005-12-26 Thread adriano ghezzi
pls could you point out which instruction should insert record in db
thanks...


2005/12/18, Anasta [EMAIL PROTECTED]:

 It just wont insert new data into DB--any ideas as i have gone over and
 over.



 ?
 mysql_connect(localhost,anasta,silteren);

 mysql_select_db(mytipperv1);

 if(!isset($cmd))
 {
   $result = mysql_query(select * from leaderboard order by ID);

   while($r=mysql_fetch_array($result))

   {
  //grab the title and the rating of the entry
  $id=$r[ID];//take out the id
   $Name=$r[Name];//take out the Name
   $Rating=$r[Rating];//take out the Rating


echo $Name a href='edit.php?cmd=editID=$id' Edit/abr;


}
 }
 ?
 ?
 if($_GET[cmd]==edit || $_POST[cmd]==edit)
 {
   if (!isset($_POST[submit]))
   {
  $id = $_GET[ID];
  $sql = SELECT * FROM leaderboard WHERE ID=$id;
  $result = mysql_query($sql);
  $myrow = mysql_fetch_array($result);
  ?

  form action=../craigs_DB/edit.php method=post
  input type=hidden name=ID value=?php echo $myrow[ID] ?

  Name: INPUT TYPE=TEXT NAME=Name  VALUE=?php echo
 $myrow[Name]
 ? SIZE=15 maxlength=15brbr
  Rating: INPUT TYPE=TEXT NAME=Rating  VALUE=?php echo
 $myrow[Rating] ? SIZE=3 maxlength=3brbr
  input type=hidden name=cmd value=edit
  input type=submit name=submit value=submit
  /form

 ? } ?
 ?
   if ($_POST[$submit])
   {
  $Name = $_POST[Name];
   $Rating = $_POST[Rating];

   $sql = UPDATE leaderboard SET Name='$Name', Rating='$Rating' WHERE
 ID=$id;
  //replace news with your table name above
  $result = mysql_query($sql);
  echo Thank you! Information updated.;
 }
 }
 ?

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




Re: [PHP] Help with the copy command...

2005-12-16 Thread adriano ghezzi
just put the wrong lines in a file and run it from the shell
with php -f
you should get more info about what's going wrong

hyh
ciao!


2005/12/16, Tim Meader [EMAIL PROTECTED]:

 What difference are you seeing in the files I give in the example? Are
 they not identical paths?

 Thanks.

 Hristo Yankov wrote:
  The two examples you give are not the same? I see
  different files. Please, doublecheck.
 
  --- Tim Meader [EMAIL PROTECTED] wrote:
 
  Okay, this seems like a ridiculously easy question
  which shouldn't even
  need asking, but I'm having trouble getting the
  builtin copy command to
  work properly. It seems to work fine as long as I
  feed it a full
  constant string path for each argument (ie - in the
  form
  /the/path/to/the/file). However, if I try to feed
  it two variables as
  the arguments, it craps out somewhere along the
  line. Here are the two
  different sets of calls I'm making:
 
  These two work perfectly:
 
 
 
 copy(/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline,
 
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline.bak)
  ;
 
 
 copy(/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp,
 
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp.bak);
  These two fail:
 
  $l_stLastRun =
 
 
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp;
  $l_stSnapshotBase =
 
 
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline;
  copy($l_stSnapshotBase, $l_stSnapshotBase..bak);
  copy($l_stLastRun, $l_stLastRun..bak);
 
  Can anyone offer any insight on what the problem
  might be with this? The
  unlink function seems to accept the variable
  inputs with absolutely no
  problem, so I can't understand the discrepancy
  between the two.
 
  Thanks in advance.
 
  Tim
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
  ===
  Hristo Yankov, Developer at Portellus, Inc.
  ICQ - 191445567
  Yahoo! - yankov_hristo
 
  __
  Do You Yahoo!?
  Tired of spam?  Yahoo! Mail has the best spam protection around
  http://mail.yahoo.com
 

 --
 Tim
 [EMAIL PROTECTED]

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




Re: [PHP] Declaring arrays? Good practice?

2005-12-14 Thread adriano ghezzi
imho
I agree always declare all kinds of variables before using

in the specific situation you have to consider that you are using two
different variables

rthe $foo inside the function and the $foo outside  the function I think
its' correct to declar both, imho you should use different names

if you want to check all variables are properly declared you can turn on
error reporting for all during development and wwitch it off again in
production







2005/12/14, Michael Hulse [EMAIL PROTECTED]:

 Sorry if this question sounds noobish:

 $foo = array(); // Declare first, good practice.
 $foo = array('one', 'two', 'three');

 Using above as example, is it good to always declare the array first?

 I usually/always declare my arrays first, but sometimes I get a bit
 confused... for example:

 function give_foo() {
$the_foo = array(); // Declare first, good practice.
$the_foo = array('one', 'two', 'three');
// Do some stuff here...
return $the_foo;
 }
 $foo = give_foo(); // Declare $foo also?

 So, should I declare $foo as array and then give it the value of the
 function? Example:

 $foo = array(); // Declare first, good practice.
 $foo = give_foo();

 That seems kinda redundant. Thoughts?

 Sorry if this is a stupid question... I am self-taught, and I am trying
 to shake all my bad coding habits.

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




Re: [PHP] question

2005-11-27 Thread adriano ghezzi
server and client are logical definitions, in the environment here
normally discussed these are meanings

server : a pc (cpu) where a web server is running (usually apache) and
php is parsing pages served to the client

client: is a pc (cpu), normally remote, who is asking for a page to the server

is it enough, do I well understand the question ?

cheers.



2005/11/27, Stephen Leaf [EMAIL PROTECTED]:
 On Sunday 27 November 2005 12:34, cheeto borje wrote:
  Hello,
 
 I wanna ask you about :
 
 1. When you say server, does it mean my CPU?
 By CPU I assume you mean your computer and not the Central Processing Unit.
 being a CPU is the small chip inside your computer attached into the
 motherboard which every instruction gets sent to for processing.
 And yes a server is a computer.
 Technically what makes a server a server is the fact that it serves something.
 Take any computer out there say a 133MHz install a web server on it (apache)
 and boom you now have a server that serves webpages.

 2. Do i have to buy a seperate server besides my computer CPU?
 No but generally it's recommended if your wanting good server performance and
 a unshakable uptime. By using the computer for every day you work you expose
 the server/computer to performance hits and possible program crashes that may
 also affect the underlaying OS.

 3. Can i use the software to multiple web-domain that i will create
 and launch online?
 I assume you mean you want to be able to host websites from multiple domains
 and the answer is yes. Apache has that functionality and is well documented
 all over the place.

 4. How will i be able store those data coming from the threads?
 You store them using those threads however you feel like it? I guess I don't
 really understand this question.

 5. Can you provide a remote server to serve as a database?
 Php has support to connect to remote database servers yes. you may also run
 the database server locally to the server. I personally recommend PostgreSQL.
 Others I'm sure will recommend MySQL.
 
 Hoping for your kind response. Thank you.
 
 LOUIE
 
 
 
  -
   Yahoo! Music Unlimited - Access over 1 million songs. Try it free.

 --
 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] Re: $_GET and $_POST arrays not working

2005-11-25 Thread adriano ghezzi
could you give us all source lines, just cut and paste ?
hy

ag.


2005/11/26, Matt Monaco [EMAIL PROTECTED]:
 Somewhat, but its what you need to do for the post and get arrays to work.
 What you need to do is make sure check the values in the global variables
 before you use them.  For example if on one page you have a form for a user
 signup and input type=text name='userName' on the next page
 $_POST['userName'] should be checked for things like quotes and other
 characters that will alter your SQL statement before you actually INSERT
 that value into your table.


 Unknown Unknown [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Doesn't that cause security problems?

 On 11/25/05, Matt Monaco [EMAIL PROTECTED] wrote:
 
  In php.ini (most likely located in your windows directory) look for the
  globals section and turn register_globals = on
 
  Matt
 
 
  Unknown Unknown [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
  Hello everyone, i am running PHP 5 on Windows XP Pro SP2, my $_GET and
  $_POST arrays do not seem to be working, I am Sure I am spelling them
  right,
  but i keep getting the errors:
  **
  *Notice*: Undefined index: Username in *
  D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *3*
 
  *Notice*: Undefined index: Password in *
  D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *4*
 
  *Notice*: Undefined index: EMail in *
  D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *5*
 
  Is this a problem with configuration or is there a bug in PHP, thanks in
  advance
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



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



[PHP] ignore: this is a test

2005-11-15 Thread adriano ghezzi
bye

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



Re: [PHP] php session in ie

2005-11-12 Thread adriano ghezzi
to be redirected to login must have at least one of (
if(!isset($_SESSION['student_username']) 
!isset($_SESSION['student_password'])) )

not set, which one (or both) fail under i.e. ???

hth

ag.





2005/11/11, sunaram patir [EMAIL PROTECTED]:
 Hi, i am having problem with internet explorer. i am working on a
 project on building a website where i need to keep track of the users
 i.e. i use a login system in there in short. with the following code i
 check whether the user is logged in or not.
 ?php
 session_start();

 $_SESSION['myurl']=$_SERVER['PHP_SELF'];
 if(!isset($_SESSION['student_username']) 
 !isset($_SESSION['student_password']))
header(Location: login.php);
 ?

 if the user is not logged in, it redirects to the login page login.php
 as is shown in the above code. now the user is allowed to log in
 through the following code:


 ?php
 session_cache_limiter('private_no_expire');
 session_set_cookie_params(0,/,schools.zenrays.com);
 session_start();



 if(isset($_POST['submit'])){
  include(../database.inc);
  $login=trim($_POST['login']);
  $pass=trim($_POST['pass']);
  $Effectivelogin=strtoupper($login);
  $auth=false;
  $connection=mysql_connect($host,$user,$password);
  mysql_select_db($database,$connection);
  $query=SELECT password FROM students WHERE userID='$Effectivelogin';
  $result=mysql_query($query);
  if(mysql_num_rows($result)){
   while($row=mysql_fetch_array($result))
  {

   if($row[0]!=$pass)
 echo (Wrong Username/Password!);
else
  $auth=true;
  }
  }


  if($auth){
$_SESSION[student_username]=$Effectivelogin;
$_SESSION[student_password]=$pass;
if(isset($_SESSION['myurl']))
   header(Location: http://schools.zenrays.com.$_SESSION['myurl']);
else
   header(Location: http://schools.zenrays.com/students;);

  }


 }
 ?
 html
 head
 titleUser Authentication/title
 /head
 body
 form method=post
 LoginID:
 input type=text name=loginbr
 Password:
 input type=password name=passbr
 input type=submit name=submit value=Login
 /form


 /body


 /html

 then the user is redirected back to the page he visited. it workd fine
 in firefox and msn explorer. in internet explorer, when i visit to a
 link in any page it asks for the login details again. could anyone
 please help me out?!

 --
 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] convert array to HTML GET request

2005-10-02 Thread adriano ghezzi
if i understand well you need to get an array from html post


if you use the same name for your html fields you automatically have
an array in $_POST

eg

input type=text  name=myfield value=field_1
input type=text name=myfield value=field_2

you'll get the array  ar_myfield = $_POS['myfield']

you should achieve the same result using myfield[key] in the name of html

hyh

by ag.


2005/10/2, Martin van den Berg [EMAIL PROTECTED]:
 Newbe question:

 How does one convert an array into a HTML GET request easely? Are
 there any standard functions?

 Same for HTML POST requests.

 Thanks,

 Martin.

 --
 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] creating a shopping cart.

2005-10-01 Thread adriano ghezzi
you need a db based approach, just setup a couple of tables in mysql

items table
one record per item

current cart table
one record per each item added to cart with unique session id

order table
one record per each item ordered with unique order id

you'll transfer records here from current cart when user checkout


hope help

adriano











2005/10/1, Emil Novak [EMAIL PROTECTED]:
 Hi!

 The best way is already presented in PHP manual:
 http://www.php.net/oop . In this example you create an object, which
 you can - naturaly pass over Session, etc.

 If you'll use OOP (Object-Oriented Programming), it is preffered in
 PHP5 to use OOP5 (OOP for PHP5). You can find details on
 http://www.php.net/oop5 .

 Emil NOVAK, Slovenia, EU

 --
 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] creating a shopping cart.

2005-10-01 Thread adriano ghezzi
depends imho there are a lot of reasons to use a db approach, unless
you are working on a really poor system,
first is persistent in any case you'll never lost an item
is the only way to make your software scalable to hundreds of users,
using array you have everything in memory, you must set up your
persistent system unless you trust a lot sessions that basically is a
file on disk
 but as everything it's up to you

I really suggest you to go on db I can't see any disadvantage
bye

2005/10/1, Robert Cummings [EMAIL PROTECTED]:
 On Sat, 2005-10-01 at 11:41, adriano ghezzi wrote:
  you need a db based approach, just setup a couple of tables in mysql
 
  items table
  one record per item
 
  current cart table
  one record per each item added to cart with unique session id
 
  order table
  one record per each item ordered with unique order id
 
  you'll transfer records here from current cart when user checkout

 A DB approach is nice, but not necessary. Serialization of a shopping
 cart array that contains the contents of the cart is sufficient. While a
 DB is a natural solution, I've heard of systems that use the file system
 or even email the request to a fulfillment address.

 Cheers,
 Rob.
 --
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'



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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread adriano ghezzi
did you tried to run the script from the shell as www-data user ?
(if not su www-data) an then run the script may be something regarding
permission

hth


2005/9/21, John Nichel [EMAIL PROTECTED]:
 [EMAIL PROTECTED] wrote:
  I have two programs on two servers, and they both have similar problems.
  In each one, I use 'exec' to call a helper program.  In one case, it is
  ecasound, which I use to resample an mp3.  In the other, it is convert,
  which creates a thumbnail of a very large image the user has uploaded.
  In both cases, the exec command fails.  Not all the time, but some
  times.  In both cases, the command that is being called by exec will
  work fine at the command line.  I assume that there is some memory /
  resource limit that is being breached when this happens, but I don't
  know what it is, or how to tell php to allow my programs to run.  Any
  ideas?

 Or is save mode on?

 --
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED]

 --
 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] Chat module

2005-09-20 Thread adriano ghezzi
should be not too difficult to setup using a couple of web pages
running on localhost e socket
hope help






2005/9/20, Vinicius Mapelli Schmaedek [EMAIL PROTECTED]:
 Somebody knows a chat module to be used for conversation between only
 two people?
 
 PS: sorry, my english is not very good  :P
 
 --
 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] BOOKING SYSTEM

2005-09-20 Thread adriano ghezzi
well I did it in the past, at the end after a lot of tests and
simulation i decided for

warehouse table

id_hotel, date, num_total_rooms, num_booked_rooms

this is day by day handling it is really flexible you can satisfy each
kind of request with very
simple queries
you also gain more flexibility in period definition you canalso easily
handling dsingle day workout and so on

 





2005/9/20, php @ net mines [EMAIL PROTECTED]:
 Hi all
 
 I have a hotel booking system where for sppecific periods we have specific
 availability
 
 e.g. hotel_id, hotel_name, hotel_fromperiod, hotel_toperiod,
 hotel_availablesinglerooms
 1, Hilton, 20/06/05, 20/08/05, 20
 
 We have a second table for recording the bookings
 
 e.g.hotel1_id, hotel1_name, hotel1_fromperiod, hotel1_toperiod,
 hotel1_availablesinglerooms
 1, Hilton, 01/07/05, 20/07/05, 1
 2, Hilton, 20/06/05, 25/07/05, 1
 3, Hilton, 25/06/05, 27/06/05, 19
 4, Hilton, 05/07/05, 05/08/05, 2
 
 Let's say that someone wants to book from the 25/06/05 - 29/06/05 what kind
 of function-SQL do I have to run to check whether there is availability?
 (in this example there should be availability between 27 and 29 but not
 between 25 and 27).
 
 Is this way of structuring the easiest and more efficient?
 
 Thank you
 
 Mario
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



[PHP] professional code quick tip

2005-09-20 Thread adriano ghezzi
hy guys this night I'm quite tired 

I need a little tip

 ok var n could be from 0 to 12

var f must be set 
f=1 if0n=4
f=2 if   5n=7
f=3 if  8n=12
f=4 if n12

due to my fatigue I coded four if-if else statement,

in other languages it is possible use conditional epression in switch case
like 
switch $n

case (0n=4):


but no in php

any suggestion for more professional coding then 4 if/else statement

tia

a.g.

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



Re: [PHP] professional code quick tip ---last---

2005-09-20 Thread adriano ghezzi
thx to all
-- final release  good nigh!

$f=0;

if ( $ar[0]0 and $ar[0]=12)
$f=1;


elseif ( $ar[0]12 and $ar[0]=14)
$f=2;

elseif ( $ar[0]14 and $ar[0]=18)
$f=3;

if ( $ar[0]18)
$f=4;







2005/9/21, Robert Cummings [EMAIL PROTECTED]:
 On Tue, 2005-09-20 at 19:20, adriano ghezzi wrote:
  hy guys this night I'm quite tired
 
  I need a little tip
 
   ok var n could be from 0 to 12
 
  var f must be set
  f=1 if0n=4
  f=2 if   5n=7
  f=3 if  8n=12
  f=4 if n12
 
  due to my fatigue I coded four if-if else statement,
 
  in other languages it is possible use conditional epression in switch case
  like
  switch $n
 
  case (0n=4):
  
 
  but no in php
 
  any suggestion for more professional coding then 4 if/else statement
 
 For such a small set I'd say that's as good as it gets. However if there
 were 100 intervals you could try the following:
 
 function f( $n )
 {
$map = array
(
// min,   max,f
array(   0, 4,1 ),
array(   5, 7,2 ),
array(   8,12,3 ),
array(  17,  null,4 ),
);
 
foreach( $map as $criteria )
{
if( $criteria[0] === null || $n  $criteria[0]

$criteria[1] === null || $n = $criteria[1] )
{
return $criteria[2];
}
}
 
return null;
 }
 
 I think your code is flawed by the way, the lower endpoints are only
 compared for greater than value and not equal to value meaning $n with
 value 4 would not match any f value.
 
 Cheers,
 Rob.
 --
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'
 


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



[PHP] linux embedded no db which way

2005-09-14 Thread adriano ghezzi
guys hi all, quite new in this list
I'm involved in a project with php in a linux embedded environment,
it's impossibile to use a db server,
any suggestion on how to handle few hundreds of simple records ?

tia

-
happy work with php!

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



Fwd: [PHP] linux embedded no db which way(2)

2005-09-14 Thread adriano ghezzi
-- Forwarded message --
From: Jasper Bryant-Greene [EMAIL PROTECTED]
Date: 14-set-2005 9.01
Subject: Re: [PHP] linux embedded no db which way
To: php-general@lists.php.net


adriano ghezzi wrote:
 guys hi all, quite new in this list
 I'm involved in a project with php in a linux embedded environment,
 it's impossibile to use a db server,
 any suggestion on how to handle few hundreds of simple records ?

A text file, comma-separated or similar?

http://php.net/fputcsv

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--
-
hy bryant 
-no space for db and no cpu power it is a really poor environment

looking for a template or framework csv may be ok but need to handle
all records management eg.: insert,delete,search
every time rewriting text file

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



[PHP] Format a currency values

2002-12-09 Thread Adriano Santos
What should I do in order to view a currency format field?
For example: I have a double-type field in my table that receives values in
currenct,
and I want to show the user the following message:

print Your monthly fee is R$50,00 ?

thanks



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




[PHP] Undefined Variable

2002-11-23 Thread Adriano Santos
Hi,

I'm with problem: Undefined Variable.
I'm using :
PHP 4.2.3
MySql 3.2.39
Windows 2000

How do I make to soluction my problem ?
thanks



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




[PHP] Re: Undefined Variable

2002-11-23 Thread Adriano Santos
My php.ini:  error_reporting = E_ALL  ~E_NOTICE

I have a form to send of the variables, but my page do not receive values.

This my code:

?php
$nome = StrToLower($nome);
$senha = StrToLower($senha);
?

thanks


Derick Rethans [EMAIL PROTECTED] escreveu na mensagem
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Adriano Santos wrote:
  Hi,
 
  I'm with problem: Undefined Variable.
  I'm using :
  PHP 4.2.3
  MySql 3.2.39
  Windows 2000
 
  How do I make to soluction my problem ?

 at the top of your script:
 error_reporting(E_ALL  ~E_NOTICE);

 or initialize your variables likes:
 $number = 0;
 $string = foo;

 Derick


 --

 -
   Derick Rethans http://derickrethans.nl/
   PHP Magazine - The PHP Magazine for Professionals - http://php-mag.net/
 -




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




[PHP] Re: Undefined Variable

2002-11-23 Thread Adriano Santos
Thanks.



[PHP] Re: Can it be Done?

2002-10-06 Thread Adriano

Hi people,
 Edwin wrore:

 'Not really sure, but perhaps, with Javascript.

 But I'd rather recommend you to give up iframes... ;)


Can you post an example of Javascript code checking for _parent frame?
By the way, what's wrong with iframes?
bye,
Adr




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




Re: [PHP] Re: Can it be Done?

2002-10-06 Thread Adriano

I understand and thank you Sascha.
Curiosity: why do you use the 'base64_encode' function to send querystring
arguments? I'd rather used urlencode...

Sascha Cunz [EMAIL PROTECTED] ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
To produce such a JavaScript:

define('_DOMBASE', 'http://yourdomain.com');

echo 'SCRIPT language=JavaScript type=text/javascript'.\n
.'if (document.location == top.location)'.\n
.'  top.location='._DOMBASE.'/index.php?goto='
   .base64_encode($_SERVER[REQUEST_URI]).';'.\n
.'/SCRIPT';

where the index.php works like:

? if (!isset($_GET['goto']))
 $goto = home.php; else
 $goto = base64_decode($_GET['goto']);
?
FRAMESET
  someframes
  FRAME src=http://yourdomain.com/? echo $goto; ?
/FRAMESET

As Stephen reported me recently, this also works with iframes.

Sascha

Am Sonntag, 6. Oktober 2002 21:37 schrieb Adriano:
 Hi people,

 @ Edwin wrore:
  'Not really sure, but perhaps, with Javascript.
 
  But I'd rather recommend you to give up iframes... ;)

 Can you post an example of Javascript code checking for _parent frame?
 By the way, what's wrong with iframes?
 bye,
 Adr




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