|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 29 Oct 2004 14:44:45 -0000 Issue 3081
php-general-digest-help
lists.php.net
Date: Fri Oct 29 2004 - 09:44:45 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 29 Oct 2004 14:44:45 -0000 Issue 3081
Topics (messages 200603 through 200645):
insert xml data into database
200603 by: mishin coleman
Re: What is wrong with next code
200604 by: John Holmes
200645 by: Vladimir Shiray
Bug-Tracking-System in PHP ?
200605 by: Michelle Konzack
200608 by: Reinhart Viane
Re: About File Paths [unresolved]
200606 by: Nick Wilson
Parsing a concatenated variable and string?
200607 by: Paul Evans
200610 by: Jack.van.Zanen.nuon.com
Re: trying 2 pull data out table and populate a list box
200609 by: Reinhart Viane
200614 by: Greg Donald
200615 by: Reinhart Viane
200616 by: Garth Hapgood - Strickland
200617 by: Reinhart Viane
Help needed
200611 by: suma parakala
200612 by: Greg Donald
200613 by: Graham Cossey
Splitting a webpage
200618 by: Nunners
200619 by: Greg Donald
exec() or system() to run *.exe and let php continue with code
200620 by: lleoneye
200622 by: Matt M.
Re: Date Calculation
200621 by: Robert Sossomon
Code help on a multi select list
200623 by: Stuart Felenstein
200624 by: Jay Blanchard
200626 by: Reinhart Viane
200627 by: Stuart Felenstein
200628 by: Ben Ramsey
200629 by: Reinhart Viane
200630 by: Ben Ramsey
200631 by: Jay Blanchard
200632 by: Ben Ramsey
200634 by: Stuart Felenstein
200635 by: Greg Donald
200636 by: Graham Cossey
200638 by: Jay Blanchard
200640 by: Jay Blanchard
200641 by: John Nichel
200644 by: John Nichel
Re: File uploads and handling
200625 by: Philip Thompson
SOAP w/PHP 4
200633 by: Dan Joseph
200637 by: Ben Ramsey
200639 by: Steve Brown
200643 by: Dan Joseph
Gawd I hate those useless error messages...
200642 by: -{ Rene Brehmer }-
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
any ideas how to do this?
i can get the php to print out all the details of the
xml but not sure how to input that data into a
database. - maybe using some sort of array?
its an annoying postgresql database that i need to
insert it into but any ideas on how to insert into any
database would be helpful.
thanks
// this function prints out a list of properties found
in the xml file
function print_houses()
{
global $obj;
echo '<table width="' . $this->TableWidth . '"
border="' . $this->TableBorder . '" cellpadding="' .
$this->TableCellpadding . '" cellspacing="' .
$this->TableCellspacing . '" class="' .
$this->TableClass . '">';
while (list($key, $val) =
each($obj->xml->XMLDATA->PROPERTIES->PROPERTY)) {
echo "<tr>\n";
echo "<td class=" . $this->TableRow1Class
. ">\n";
echo "<a href=\"./property.php?id=" .
$val->attr['PROPERTYID'] . "\" class=\"" .
$this->TableTxtProperties . "\">" . $val->SUBURB->data
. ", $" . $val->RENT->data . "</a>\n";
echo "</td>";
echo "</tr>\n";
} // while
echo '</table>';
reset($obj->xml->XMLDATA->PROPERTIES->PROPERTY);
}
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
attached mail follows:
Vladimir Shiray wrote:
> -------------------------------------------------
> Warning: mysql_query(): 4 is not a valid MySQL-Link resource in ...
> $result = mysql_query('SELECT 1+1', $db1);
> -------------------------------------------------
[snip]
> $db1 = mysql_connect ('localhost', 'test', '1');
> $db2 = mysql_connect ('localhost', 'test', '1');
> mysql_close($db2);
If you connect with the same parameters, PHP will just reuse the
previous connection. So you only have one connection and closing either
one will result in the connection being lost, hence the "invalid link
resource" message.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
I has noted specially:
It works OK in PHP 4.3.6 or when line "$db2 = 0;" had been commented
in all described versions of PHP.
So next example works perfect:
-------------------------------------------------
error_reporting(E_ALL);
$db1 = mysql_connect ('localhost', 'test', '1');
$db2 = mysql_connect ('localhost', 'test', '1');
mysql_close($db2);
$result = mysql_query('SELECT 1+1', $db1);
if ($result)
{
$row = mysql_fetch_row($result);
echo "Result: {$row[0]}\n";
}
-------------------------------------------------
root
gate:~/src/PHP# php -q mysql_connect3.php
Result: 2
On Thu, 28 Oct 2004 23:08:39 -0400
John Holmes <holmes072000
charter.net> wrote:
> Vladimir Shiray wrote:
> > -------------------------------------------------
> > Warning: mysql_query(): 4 is not a valid MySQL-Link resource in ...
> > $result = mysql_query('SELECT 1+1', $db1);
> > -------------------------------------------------
> [snip]
> > $db1 = mysql_connect ('localhost', 'test', '1');
> > $db2 = mysql_connect ('localhost', 'test', '1');
> > mysql_close($db2);
>
> If you connect with the same parameters, PHP will just reuse the
> previous connection. So you only have one connection and closing either
> one will result in the connection being lost, hence the "invalid link
> resource" message.
>
> --
>
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals _ www.phparch.com
>
>
attached mail follows:
Hello,
Curently I create my website and I need for my development project
a BTS like this one from <bugs.debian.org>.
I have only around 20 Debian Packages, so I do not need a big one
of BTS.
Curently I use E-Mails from my Provider like:
<package>-wired-stuff
freenet.de
with procmail and some BASH scripts :-)
Does anyone know a better solution in PHP4 ?
Maybe Webinterface included ?
The BASH scripts are working fine, but they are too heavy
Greetings
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBgbldC0FPBMSS+BIRAqoNAKDU9DrqIhJaEOLCZsq2mujhq79n6wCdHz69
e+lt36t+I5Tm4LiDEjjPwOc=
=CeRZ
-----END PGP SIGNATURE-----
attached mail follows:
Dunno if this is ok:
http://www.mantisbt.org/
-----Original Message-----
From: Michelle Konzack [mailto:linux4michelle
freenet.de]
Sent: vrijdag 29 oktober 2004 5:31
To: php-general
lists.php.net
Subject: [PHP] Bug-Tracking-System in PHP ?
Hello,
Curently I create my website and I need for my development project a BTS
like this one from <bugs.debian.org>.
I have only around 20 Debian Packages, so I do not need a big one of
BTS.
Curently I use E-Mails from my Provider like:
<package>-wired-stuff
freenet.de
with procmail and some BASH scripts :-)
Does anyone know a better solution in PHP4 ?
Maybe Webinterface included ?
The BASH scripts are working fine, but they are too heavy
Greetings
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
attached mail follows:
* and then Matthew Sims declared....
> > If a script is to be called with cron *outside* of the http directory,
> > how should file system paths be handled?
> >
> > Should I use
> >
> > fopen('a_path/relative_to/thescript.php');
> >
> > or
> >
> > fopen('/usr/var/www/absolute_file_path/thescript.php');
> >
> > Im not only using this for fopen. So does php work relative to the
> > script being called or not?
> >
> > Much thanks...
> > --
> > Nick W
>
> When in doubt, use absolute.
Fair enough, thanks Matthew..
--
Nick W
attached mail follows:
Hi,
I am new to PHP and cant seem to find a way to parse a concatenated string
and variable.
To explain:
I have a database to catalogue a composers works, one of the tables has a
list of instruments which I then access to dynamically display on a wep page
using checkboxes - if a particular instrument is used in the work then the
checkbox is checked.
<?php
//Select all instruments from the instrumentTbl in the correct order
$resultInstrument = mysql_query("SELECT * FROM instrumentTbl ORDER BY
sort_order");
//Load them into an array
if ($myrowInstrument = mysql_fetch_array($resultInstrument)) {
do {
echo $myrowInstrument['instrument'];
echo ": ";
?>
//This creates a checkbox for each instrument in the database
<input name="<?php echo $myrowInstrument['instrument']; ?>"
type="checkbox" value="<?php echo $myrowInstrument['instrument']; ?>">
So far so good.
The problem I am having is when I want to insert the number of instruments
used in the work.
<input name="<?php echo $myrowInstrument['instrument']; ?>number"
type="text" size="3">
This snipet of code produces a dynamically created form where the user can
enter the number of instruments required. (Ie 2 flutes)
Here is a part of the form created from the code above for the instrument
Flute:
<input name="Flutenumber" type="text" size="3">
To process the information in this form I think I need to concatenate
$instrument with the string 'number'. the only problem is that PHP reads
this literally and the output is just $Flutenumber and not the number
actually entered.
Here is the code I have at the moment
<?php
$resultInstrument_id = mysql_query("SELECT * FROM instrumentTbl ORDER BY
sort_order");
while ($myrowInstrument_id = mysql_fetch_array($resultInstrument_id))
{
$instrument = $myrowInstrument_id['instrument'];
if (strlen ($$instrument !='0'))
{
//this works fine and gives a list of all the checked instruments
print $$instrument;
//this just outputs the literal interpretation ie it will print
$Flutenumber not the actual number entered on the form.
print "$${$instrument}number";
}
}
?>
Any help would be greatly appreciated.
Thanks,
Paul.
attached mail follows:
Hi Paul
Try print $instrument."number";
jack
-----Original Message-----
From: Paul Evans [mailto:pevans
itmuse.com]
Sent: Friday, October 29, 2004 9:45 AM
To: php-general
lists.php.net
Subject: [PHP] Parsing a concatenated variable and string?
Hi,
I am new to PHP and cant seem to find a way to parse a concatenated string
and variable.
To explain:
I have a database to catalogue a composers works, one of the tables has a
list of instruments which I then access to dynamically display on a wep page
using checkboxes - if a particular instrument is used in the work then the
checkbox is checked.
<?php
//Select all instruments from the instrumentTbl in the correct order
$resultInstrument = mysql_query("SELECT * FROM instrumentTbl ORDER BY
sort_order");
//Load them into an array
if ($myrowInstrument = mysql_fetch_array($resultInstrument)) { do { echo
$myrowInstrument['instrument']; echo ": ";
?>
//This creates a checkbox for each instrument in the database
<input name="<?php echo $myrowInstrument['instrument']; ?>"
type="checkbox" value="<?php echo $myrowInstrument['instrument']; ?>">
So far so good.
The problem I am having is when I want to insert the number of instruments
used in the work.
<input name="<?php echo $myrowInstrument['instrument']; ?>number"
type="text" size="3">
This snipet of code produces a dynamically created form where the user can
enter the number of instruments required. (Ie 2 flutes)
Here is a part of the form created from the code above for the instrument
Flute:
<input name="Flutenumber" type="text" size="3">
To process the information in this form I think I need to concatenate
$instrument with the string 'number'. the only problem is that PHP reads
this literally and the output is just $Flutenumber and not the number
actually entered.
Here is the code I have at the moment
<?php
$resultInstrument_id = mysql_query("SELECT * FROM instrumentTbl ORDER BY
sort_order");
while ($myrowInstrument_id = mysql_fetch_array($resultInstrument_id))
{
$instrument = $myrowInstrument_id['instrument'];
if (strlen ($$instrument !='0'))
{
//this works fine and gives a list of all the checked instruments print
$$instrument;
//this just outputs the literal interpretation ie it will print
$Flutenumber not the actual number entered on the form.
print "$${$instrument}number";
}
}
?>
Any help would be greatly appreciated.
Thanks,
Paul.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I always do this with a script like this:
$sql="select * from ladders order by laddername";
$rsladders=mysql_query($sql);
$aantal_ladders=mysql_num_rows($rsladders);
for($x=0;$x<$aantal_ladders;$x++)
{
$rijladders["$x"]=mysql_fetch_array($rsladders);
}
And then to populate the list:
<select name="ladder" id="select">
<?PHP
for($x=0;$x<$aantal_ladders;$x++)
{
echo('<option value="'.$rijladders["$x"]["ladder_id"].'"');
echo('>'.$rijladders["$x"]["laddername"].'</option>');
}
?>
</select>
This works but I don't know if this is good coding
Greetz
Reinhart
-----Original Message-----
From: Garth Hapgood - Strickland [mailto:garth
redpoint.co.za]
Sent: donderdag 28 oktober 2004 17:19
To: php-general
lists.php.net
Subject: [PHP] trying 2 pull data out table and populate a list box
I am trying to pull all data out of a table called "province" which has
2 fields "ProvinceID" and "Description" respectively.
Now I want to populate a list with all the data in the "descriptions"
field.
Many thanx
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Fri, 29 Oct 2004 09:52:49 +0200, Reinhart Viane <rv
domos.be> wrote:
> I always do this with a script like this:
>
> $sql="select * from ladders order by laddername";
> $rsladders=mysql_query($sql);
> $aantal_ladders=mysql_num_rows($rsladders);
>
> for($x=0;$x<$aantal_ladders;$x++)
> {
> $rijladders["$x"]=mysql_fetch_array($rsladders);
> }
if ( mysql_num_rows( $rsladders ) )
{
while ( $rijladders = mysql_fetch_array( $rsladders ) )
{
echo <<<EOF
<option value="$rijladders[ladder_id]">$rijladders[laddername]</option>
EOF;
}
}
>
> And then to populate the list:
> <select name="ladder" id="select">
> <?PHP
> for($x=0;$x<$aantal_ladders;$x++)
> {
> echo('<option value="'.$rijladders["$x"]["ladder_id"].'"');
> echo('>'.$rijladders["$x"]["laddername"].'</option>');
Like I wrote above, I tend to use heredoc syntax for stuff like this.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/
attached mail follows:
>if ( mysql_num_rows( $rsladders ) )
>{
> while ( $rijladders = mysql_fetch_array( $rsladders ) )
> {
>echo <<<EOF
><option value="$rijladders[ladder_id]">$rijladders[laddername]</option>
>EOF;
> }
>}
>Like I wrote above, I tend to use heredoc syntax for stuff like this.
This indeed seems to be a faster way. Can you point me out the <<<EOF?
Or where I can find more information on this?
Thx
Reinhart Viane
attached mail follows:
Thanx so much Reinhart
It works fine now.
Ok so i have my list populated now. IF I want to diplay "select one" at the
top of the list box, not as an option, but just so that the user knows to
select an item. How will I put that in the code?
Greets
Garth
attached mail follows:
Try this:
And then to populate the list:
<select name="ladder" id="select">
<option value="">select one</option>
<?PHP
for($x=0;$x<$aantal_ladders;$x++)
{
echo('<option value="'.$rijladders["$x"]["ladder_id"].'"');
echo('>'.$rijladders["$x"]["laddername"].'</option>');
}
?>
</select>
-----Original Message-----
From: Garth Hapgood - Strickland [mailto:garth
redpoint.co.za]
Sent: vrijdag 29 oktober 2004 12:36
To: php-general
lists.php.net
Subject: Re: [PHP] trying 2 pull data out table and populate a list box
Thanx so much Reinhart
It works fine now.
Ok so i have my list populated now. IF I want to diplay "select one" at
the top of the list box, not as an option, but just so that the user
knows to select an item. How will I put that in the code?
Greets
Garth
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi
I developed a html form in which I have text box and combo box. Now my
problem is I have to pass the values of this page to another page. How can i
pass the values/variables to next page using href
Kindly help me
Thanks
Suma
_________________________________________________________________
Hey there NRIs! Desi news, films, ‘n more! http://www.msn.co.in/nri/ Stay
in the loop!
attached mail follows:
On Fri, 29 Oct 2004 15:22:29 +0530, suma parakala
<sumaparkala
hotmail.com> wrote:
> I developed a html form in which I have text box and combo box. Now my
> problem is I have to pass the values of this page to another page. How can i
> pass the values/variables to next page using href
> Kindly help me
You have to submit the form in some way, GET, POST, or a perhaps a
javascript invocation of either. Once the form is submitted to the
next page, the variables will be available via the $_GET or $_POST
arrays. You can view these arrays with print_r(). This is the
theory, but if you post your actual code, people will most likely help
you debug it.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/
attached mail follows:
>
> Hi
> I developed a html form in which I have text box and combo
> box. Now my
> problem is I have to pass the values of this page to another
> page. How can i
> pass the values/variables to next page using href
> Kindly help me
> Thanks
> Suma
As you've posted to a PHP list I will assume your second page is a PHP page.
Set your FORM action to the second page ie:
<FORM name="myForm" method="POST" action="page2.php">
<INPUT type="TEXT" name="field1">
Then within page2.php all the form fields will be available in the $_POST
array.
$field1 = $_POST['field1'];
You can also use GET in place of POST.
As for using href, well this isn't a form option as far as I am aware. If
you wish to subsequently pass variables using href:
<a href="pagex.php?var1=val1&var2=val2">Link Text</a>
--OR--
<?php
echo "<a href=\"pagex.php?var1=$var1&var2=$var2\">Link Text</a>";
?>
HTH
Graham
attached mail follows:
I'm trying to create an application that stores details from another
website.
I've successfully downloaded the webpage - that was the easy bit - now I
want to be able to pick out specific details from the page.
Unfortunately, the designer of the page didn't do nice things like put
summary bits in tables, or <!-- --> labelling to say what everything is
within the page!
So, I've got the following string, the info I want is the address (House,
Sandbrook Park<BR>Sandbrook Way <B>Rochdale</B> Lancashire OL11 1SA) and the
telephone no (Tel : 01706 745832).
Can someone suggest a way of going through the string to find the relevant
bits - is split the easiest way?
Cheers
James
<HTML>
<HEAD>
<TITLE>ABTAnet - Searching for ABTA Number V6896</TITLE>
</HEAD>
<CENTER>
<BODY BGCOLOR=#FFFFFF TEXT=#000000 LINK=#FF0000 VLINK=#0000FF ALINK=#F0FF4F
ONLOAD="">
<CENTER>
<font face="Arial">
<b>ABTAnet Search: ABTA Number</b>: "<b><font
color="#000080">V6896</font></b>"</font>
<BR>
<TABLE BGCOLOR="#FFFFFF" BORDER=0 CELLSPACING=0 CELLPADDING=2 WIDTH=500>
<TR> <TD VALIGN=TOP WIDTH=214>
<IMG src="/images/space.gif" BORDER=1 VSPACE=0 HEIGHT=1 WIDTH=214>
</TD>
<TD HEIGHT=1 WIDTH=110>
<IMG src="/images/space.gif" BORDER=1 VSPACE=0 HEIGHT=1 WIDTH=110>
</TD>
<TD HEIGHT=1 WIDTH=118>
<IMG src="/images/space.gif" BORDER=1 VSPACE=0 HEIGHT=1 WIDTH=118>
</TD>
<TD HEIGHT=1 WIDTH=58>
<IMG src="/images/space.gif" BORDER=1 VSPACE=0 HEIGHT=1 WIDTH=58>
</TD>
</TR>
<TR>
<TD VALIGN=TOP colspan=3><FONT FACE=ARIAL SIZE=-1><B>MyTravel Tour
Operations Ltd</B> Head Office<BR><A
HREF="link2000.mv?+433.00000+ans"> <IMG SRC="/images/web.gif" BORDER=0
ALT="Click here for member website" HEIGHT=14 WIDTH=51></A> Scandinavia
</FONT></TD>
<TD VALIGN=TOP align=right><FONT FACE="ARIAL" SIZE=2><B>V6896
</B></FONT></TD>
</TR>
<TR>
<TD valign=top><FONT FACE=ARIAL SIZE=2>Holiday House, Sandbrook
Park<BR>Sandbrook Way <B>Rochdale</B> Lancashire OL11 1SA</TD>
<TD ALIGN=LEFT VALIGN=TOP><FONT FACE=ARIAL SIZE=2></FONT></TD>
<TD COLSPAN=1 VALIGN=TOP align=LEFT><FONT FACE=ARIAL SIZE=2>Tel : 01706
745832</TD>
<TD ALIGN=RIGHT VALIGN=TOP></TD>
</TR>
<TR>
<TD valign=top colspan="4">
<BR>
<font face="ARIAL" size="-1">Additional Trading Names registered with
ABTA: <br>
<UL>
(V6896) Tradewinds<BR>
(V6896) Sun Cruises<BR>
(V6896) MyTravel<BR>
(V6896) Escapades<BR>
(V6896) Aspro Holidays<BR>
(V6896) Aspro<BR>
(V6896) Airtours Flight Warehouse<BR>
(V6896) Airtours Early Bookings<BR>
(V6896) Airtours Direct Lates<BR>
(V6896) Airtours Direct<BR>
(V6896) Airtours Cancellations<BR>
(V6896) Airtours<BR>
(V6896) Airtours Holidays<BR>
</font></TD>
</TR>
</TABLE>
</CENTER>
<P><FONT FACE="ARIAL" SIZE="-2"><CENTER>Search completed in 0
seconds</CENTER><BR>
</BODY>
</HTML>
attached mail follows:
On Fri, 29 Oct 2004 11:52:46 +0100, Nunners <webmaster
jnsolutions.co.uk> wrote:
> Can someone suggest a way of going through the string to find the relevant
> bits - is split the easiest way?
I would use preg_match().
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/
attached mail follows:
Hi all im new to PHP and im trying to let a process (*.exe file) to run in
background(localhost) and let php continue processing the script. But PHP
always stops and wait for the (*.exe) stops/close!
Anyone here can help me by giving me an simply example to let PHP run the
exe file and continue with code execution.
PS: Im on Windows usinf Apache 2.0.52 and PHP 5.0.2. And already enabled
communicate with desktop under windows apache service(for testing).
big THX in advanced
lleoneye
attached mail follows:
> Hi all im new to PHP and im trying to let a process (*.exe file) to run in
> background(localhost) and let php continue processing the script. But PHP
> always stops and wait for the (*.exe) stops/close!
>
> Anyone here can help me by giving me an simply example to let PHP run the
> exe file and continue with code execution.
check out http://us2.php.net/manual/en/function.exec.php
read through the user comments
found this on php.net
function execInBackground($path, $exe, $args = "") {
global $conf;
if (file_exists($path . $exe)) {
chdir($path);
if (substr(php_uname(), 0, 7) == "Windows"){
pclose(popen("start \"bla\" \"" . $exe . "\" " .
escapeshellarg($args), "r"));
} else {
exec("./" . $exe . " " . escapeshellarg($args) . " >
/dev/null &");
}
}
}
attached mail follows:
Wouldn't just making the script get 2 time stamps be more efficient, since you
are creating the database calls anyways? Or am I over simplifying it?
<?php
// current time at start of script
$before = strtotime("now");
//All your DB stuff
{
....
}
// current time at end of script
$after = strtotime("now");
$timed = ($after - $before);
echo 'Time for script to execute: ' . $timed .' seconds';
?>
Robert
<SNIP>
Mike Tuller is quoted as saying on 10/28/2004 5:19 PM:
> Ok, so here is what I have. Please check to see if there is a better
> way. There are a lot of database calls to me.
</SNIP>
--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
200 Ricks Hall, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax: 919/515-7812
robert_sossomon
ncsu.edu
attached mail follows:
I want to do a server side trap if a user selects more
from a mult select list then allowed. Just unsure and
didn't find any examples. Seems people rely more on
javascript these days.
So here is how I grab the array:
if ( is_array( $_REQUEST['LurkerIndustry'] ) ) {
$_SESSION['l_industry'] = array_unique(
array_merge( $_SESSION['l_industry'],
$_REQUEST['LurkerIndustry'] )
);
}
here is my somewhat hazy notion:
if
( is_array( $_REQUEST['LurkerIndustry'] ) ) {
$_SESSION['l_industry'] = array_unique(
if $l_industry > 5
( Here I'm guess I need to redirect back to page
with and error message)
else
array_merge( $_SESSION['l_industry'],
$_REQUEST['LurkerIndustry'] )
);
}
attached mail follows:
[snip]
I want to do a server side trap .... Seems people rely more on
javascript these days.
[/snip]
There is a reason for that. It is in the first chapter of the popular
book
Server Side is From Mars,
Client Side is From Venus.
"Make no mistake, people often confuse the two. You, being the smart
programmer that you are, know that PHP is a server-side language and
JavaScript (often known as ECMAScript 290) is a client-side language.
You must be in touch with both sides to become an effective programmer
in today's world."
Other languages are also mentioned.
attached mail follows:
I would choose javascript to to check this
-----Original Message-----
From: Stuart Felenstein [mailto:stuart4m
yahoo.com]
Sent: vrijdag 29 oktober 2004 15:13
To: php-general
lists.php.net
Subject: [PHP] Code help on a multi select list
I want to do a server side trap if a user selects more
from a mult select list then allowed. Just unsure and
didn't find any examples. Seems people rely more on
javascript these days.
So here is how I grab the array:
if ( is_array( $_REQUEST['LurkerIndustry'] ) ) { $_SESSION['l_industry']
= array_unique( array_merge( $_SESSION['l_industry'],
$_REQUEST['LurkerIndustry'] ) ); }
here is my somewhat hazy notion:
if
( is_array( $_REQUEST['LurkerIndustry'] ) ) { $_SESSION['l_industry'] =
array_unique( if $l_industry > 5
( Here I'm guess I need to redirect back to page
with and error message)
else
array_merge( $_SESSION['l_industry'], $_REQUEST['LurkerIndustry'] ) );
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
--- Reinhart Viane <rv
domos.be> wrote:
> I would choose javascript to to check this
>
This response I don't understand. There are 50
options and the intent is to allow 3 of those 50.
Then some "genius" comes along and turns off
javascripting and chooses all 50. I KNOW it will
happen. I wouldn't even dare to dream that it may
not.
Stuart
attached mail follows:
Stuart Felenstein wrote:
> I want to do a server side trap if a user selects more
> from a mult select list then allowed. Just unsure and
> didn't find any examples. Seems people rely more on
> javascript these days.
>
> So here is how I grab the array:
>
> if ( is_array( $_REQUEST['LurkerIndustry'] ) ) {
> $_SESSION['l_industry'] = array_unique(
> array_merge( $_SESSION['l_industry'],
> $_REQUEST['LurkerIndustry'] )
> );
> }
>
> here is my somewhat hazy notion:
>
> if
> ( is_array( $_REQUEST['LurkerIndustry'] ) ) {
> $_SESSION['l_industry'] = array_unique(
> if $l_industry > 5
> ( Here I'm guess I need to redirect back to page
> with and error message)
>
> else
> array_merge( $_SESSION['l_industry'],
> $_REQUEST['LurkerIndustry'] )
> );
> }
First of all, you didn't show your HTML code for the form, so I'm going
to assume that your SELECT form field is set up as an array with the
square brackets in the name:
<select name="foo[]" multiple="multiple">
Next, you'll want to check out the array functions at
<http://www.php.net/array> and study them. In particular, you'll want to
check out the count() function.
I'm not exactly sure of the logic behind your code, so I can't really
comment on what you're trying to do, but, assuming you're trying to only
count the unique values picked on the form, you'll want to do something
like this:
$l_industry = array_unique($_REQUEST['LurkerIndustry']);
if (count($l_industry) > 5) {
// ... do your stuff like redirecting back
// to the form or redisplaying your form
}
--
Regards,
Ben Ramsey
http://benramsey.com
---------------------------------------------------
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---------------------------------------------------
attached mail follows:
It is not my intention to start a discussion on this, however, some
things, as you surely know, are better handled with javascript. If you
turn it the way you say now, I can follow your idea and thus you are
correct. It has te be very closed it seems.
Will look into it :)
-----Original Message-----
From: Stuart Felenstein [mailto:stuart4m
yahoo.com]
Sent: vrijdag 29 oktober 2004 15:29
To: rv
domos.be; php-general
lists.php.net
Subject: RE: [PHP] Code help on a multi select list
--- Reinhart Viane <rv
domos.be> wrote:
> I would choose javascript to to check this
>
This response I don't understand. There are 50
options and the intent is to allow 3 of those 50.
Then some "genius" comes along and turns off
javascripting and chooses all 50. I KNOW it will
happen. I wouldn't even dare to dream that it may
not.
Stuart
attached mail follows:
Stuart Felenstein wrote:
>>I would choose javascript to to check this
>>
> This response I don't understand. There are 50
> options and the intent is to allow 3 of those 50.
> Then some "genius" comes along and turns off
> javascripting and chooses all 50. I KNOW it will
> happen. I wouldn't even dare to dream that it may
> not.
>
> Stuart
Precisely... you can't rely on the the client to do your checking. You
need to check from the server side to make sure no one's going to spoof
your code. With that in mind, you mind want to implement both
client-side and server-side checking. That way, it gives your legitimate
users a more user-friendly approach, while still ensuring from the
server-side that no one's going to spoof your form.
--
Regards,
Ben Ramsey
http://benramsey.com
---------------------------------------------------
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---------------------------------------------------
attached mail follows:
[snip]
--- Reinhart Viane <rv
domos.be> wrote:
> I would choose javascript to to check this
>
This response I don't understand. [/snip]
What is not to understand here...you are the one who said, "I want to do
a server side trap". JavaScript would be the only way to do that. I
agree with Ben who said to do both.
attached mail follows:
Jay Blanchard wrote:
> [snip]
>>I would choose javascript to to check this
>
> This response I don't understand. [/snip]
>
> What is not to understand here...you are the one who said, "I want to do
> a server side trap". JavaScript would be the only way to do that. I
> agree with Ben who said to do both.
I don't understand this response. ;-)
How is Javascript the /only way/ to do a /server-side/ trap? Javascript
is for the client side (unless you're coding in ASP and choose to use
JScript instead of VBScript).
--
Regards,
Ben Ramsey
http://benramsey.com
---------------------------------------------------
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---------------------------------------------------
attached mail follows:
--- Jay Blanchard
<jay.blanchard
niicommunications.com> wrote:
> What is not to understand here...you are the one who
> said, "I want to do
> a server side trap". JavaScript would be the only
> way to do that.
Sorry, I used the wrong terminology. I think my
statement was interpreted as using javascript at the
server level.
Stuart
attached mail follows:
On Fri, 29 Oct 2004 09:36:07 -0400, Ben Ramsey <lists
benramsey.com> wrote:
> Precisely... you can't rely on the the client to do your checking. You
> need to check from the server side to make sure no one's going to spoof
> your code. With that in mind, you mind want to implement both
> client-side and server-side checking. That way, it gives your legitimate
> users a more user-friendly approach, while still ensuring from the
> server-side that no one's going to spoof your form.
I agree. No sense in blasting a bad form post off to the server if
you can preempt it with javascript. Put the load on the client when
possible I say.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/
attached mail follows:
[snip]
> What is not to understand here...you are the one who said, "I want to do
> a server side trap". JavaScript would be the only way to do that.
[snip]
Jay, you may want to re-read what you typed as JavaScript, to the best of my
knowledge, is actually client side...
attached mail follows:
[snip]
-----Original Message-----
From: Ben Ramsey [mailto:lists
benramsey.com]
Sent: Friday, October 29, 2004 8:55 AM
To: php-general
lists.php.net
Subject: Re: [PHP] Code help on a multi select list
Jay Blanchard wrote:
> [snip]
>>I would choose javascript to to check this
>
> This response I don't understand. [/snip]
>
> What is not to understand here...you are the one who said, "I want to
do
> a server side trap". JavaScript would be the only way to do that. I
> agree with Ben who said to do both.
I don't understand this response. ;-)
How is Javascript the /only way/ to do a /server-side/ trap? Javascript
is for the client side (unless you're coding in ASP and choose to use
JScript instead of VBScript).
[/snip]
I don't understand this response. ;-)
The OP said JavaScript, so I couched it in those terms.
attached mail follows:
[snip]
[snip]
> What is not to understand here...you are the one who said, "I want to
do
> a server side trap". JavaScript would be the only way to do that.
[snip]
Jay, you may want to re-read what you typed as JavaScript, to the best
of my
knowledge, is actually client side...
[/snip]
I was just testing ya'll....and somebody caught it! And I am still
asleep.....
attached mail follows:
Graham Cossey wrote:
> [snip]
>
>>What is not to understand here...you are the one who said, "I want to do
>>a server side trap". JavaScript would be the only way to do that.
>
> [snip]
>
> Jay, you may want to re-read what you typed as JavaScript, to the best of my
> knowledge, is actually client side...
>
It's Friday, and Jay probably needs coffee. ;)
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
Jay Blanchard wrote:
<snip>
> I don't understand this response. ;-)
>
> The OP said JavaScript, so I couched it in those terms.
>
How do you respond to that response when the previous responder
responded? :)
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
[embarrassment]
Thanks all. Of course it was a dumb thing I was doing. I didn't give
the absolute path when "moving" the uploaded file. I got it to work
though!
[/embarrassment]
~Philip
On Oct 28, 2004, at 9:40 PM, Robby Russell wrote:
> On Thu, 2004-10-28 at 19:04 -0500, Philip Thompson wrote:
>> On Oct 26, 2004, at 7:06 AM, Jason Wong wrote:
>>
>>> On Tuesday 26 October 2004 03:45, Philip Thompson wrote:
>>>
>>>> I have a form to upload a file from a user's computer to the
>>>> server. I
>>>> want to then modify the file, and then let the user save it back.
>>>> However, I am having troubles opening the file. It says it doesn't
>>>> exist. Any suggestions?
>>>>
>>>> -------
>>>> if (is_uploaded_file($_FILES['userfile']['name']))
>>>> $handle = fopen($_FILES['userfile']['name'], "r");
>>>> else
>>>> echo $filename . " was not uploaded properly";
>>>> -------
>>>>
>>>> I know the actual filename shows up...
>>>
>>> In the above you are only referencing the *filename* and not the
>>> actual
>>> uploaded file itself.
>>>
>>>> but somehow it's not uploading.
>>>> Ideas?
>>>
>>> Read
>>>
>>> manual > Handling file uploads
>>>
>>> to see how it all works.
>>
>> Yeah, that was not useful at all. That's what I originally looked at.
>> If anyone has some "code" that shows how to reference the actual file,
>> then that would be helpful. I have pulled my hair out long enough over
>> this one.
>>
>> I did try this, but nothing changed (b/c it's just an array):
>>
>> if (is_uploaded_file(_FILES['userfile']))
>> $handle = fopen($_FILES['userfile'], "r");
>>
>> Tips would be wonderful. Thanks!
>
> Here is an example:
>
> http://blog.planetargon.com/index.php?/archives/
> 26_Uploading_images_into_PostgreSQL.html
>
> hth,
>
> Robby
>
> --
> /***************************************
> * Robby Russell | Owner.Developer.Geek
> * PLANET ARGON | www.planetargon.com
> * Portland, OR | robby
planetargon.com
> * 503.351.4730 | blog.planetargon.com
> * PHP/PostgreSQL Hosting & Development
> * --- Now supporting PHP5 ---
> ****************************************/
attached mail follows:
Hi All,
Does PHP 4 support SOAP, or does something have to be added to it??
-Dan Joseph
attached mail follows:
Dan Joseph wrote:
> Does PHP 4 support SOAP, or does something have to be added to it??
Check out these functions, which are listed as "experimental":
<http://www.php.net/soap>
Or this PEAR package, which is still in "beta" stage:
<http://pear.php.net/package/SOAP>
--
Regards,
Ben Ramsey
http://benramsey.com
---------------------------------------------------
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---------------------------------------------------
attached mail follows:
> Does PHP 4 support SOAP, or does something have to be added to it??
We use the NuSOAP package in our SOAP apps:
http://dietrich.ganx4.com/nusoap/index.php
We had to use the latest CVS version of NuSOAP to get all of our apps
working correctly, NOT the current "Stable" version however.
attached mail follows:
> Check out these functions, which are listed as "experimental":
> <http://www.php.net/soap>
> Or this PEAR package, which is still in "beta" stage:
> <http://pear.php.net/package/SOAP>
Ahh ok. I actually thought about PEAR, but I don't think I have the
option to install it on our web server I'm working with. I'll look at
the experimental ones. I'll also investigate Pear, I've heard good
things about it on this list. Heck, maybe I'll just see if we can
upgrade to PHP 5.
-Dan Joseph
attached mail follows:
Hi gang
I do realise that this error means I've forgotten a curly brace or
semi-colon somewhere, but seriously ...
Parse error: parse error, unexpected $end in E:\web\Metalbunny\addguest.php
on line 274
where line 274 would be the last line, obviously (since it's always the
last line when it does this)...
now I'm lucky that this script in question has alot of HTML in it, so
there's only about 180 lines of actual code, but is there really not
something that can be done to PHP to make errors like these just a LITTLE
easier to debug ???
It's not that bad in this particular case ... but when we have scripts of
500-800 lines code, or even more, it tends to be a rather not very helpful
message... and it gets worse when you jump in and out of PHP ...
the '$end' and the '$' error are by far the most annoying errors, so hard
to debug ... atleast with 'unexpected {' you have a slight chance as it
limits the part you have to search through ...
since this is the test-server, I run with all errors, alerts, and messages
on, but isn't there someway to make PHP just a little more helpful when
this happens ???
Rene
--
Rene Brehmer
aka Metalbunny
If your life was a dream, would you wake up from a nightmare, dripping of
sweat, hoping it was over? Or would you wake up happy and pleased, ready to
take on the day with a smile?
http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]