|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: php-general-digest-help
lists.php.netDate: Wed Oct 17 2001 - 01:46:23 CDT
php-general Digest 17 Oct 2001 06:46:23 -0000 Issue 939
Topics (messages 71246 through 71297):
Re: Include & redeclare error
71246 by: Todd Cary
Form problem
71247 by: Dana Holt
71248 by: Dana Holt
71250 by: Alex Shi
71252 by: Dana Holt
Reading from MySQL db, using php, to paste into Flash
71249 by: Torkil Johnsen
Re: multi dimensional array producing a parse error
71251 by: Steve Edberg
71257 by: Steve Edberg
Re: PHP host
71253 by: Kyle Mathews
71291 by: Wesley Furgiuele
Re: Only 1 Query Result...help.
71254 by: Chris Cocuzzo
71255 by: Don Read
71259 by: Matthew Loff
Globals funkiness
71256 by: Boget, Chris
71258 by: Steve Edberg
71261 by: CC Zona
71269 by: Alex Shi
Parsing MS Excel files...
71260 by: Jeff Lewis
71264 by: Jason G.
71266 by: Jeff Lewis
71267 by: Henrik Hansen
71268 by: Matthew Loff
Caching Problems???
71262 by: Nicholas A. Zukin
71263 by: DL Neil
71265 by: Nicholas A. Zukin
71279 by: David Robley
Re: Date format question
71270 by: Papp Gyozo
Re: Sorting multiple dimensional arrays
71271 by: Papp Gyozo
Prev/Next Link problem.
71272 by: Michael O'Neal
Calculating time differences.
71273 by: Mike Eheler
71285 by: David Robley
Sessions that timeout too early...
71274 by: Steve Beilfuss
Sapces in Input are not Present in Output
71275 by: Kal Amry
71284 by: Alex Shi
71286 by: Kal Amry
71287 by: Kal Amry
Not a valid RESOURCE??..help please!
71276 by: Chris Cocuzzo
71277 by: Rasmus Lerdorf
71278 by: Jason Murray
MySQL LIMIT 4,6 returns 5 rows!
71280 by: Ben Edwards
71282 by: Mark
71283 by: Jason Murray
KISGB v2.1 Released
71281 by: Gaylen Fraley
do u like asian pussy? japan korea china xxx
71288 by: rareasiannudes.xxxasia.com ()
71289 by: Chris Kay
Object and reference problem
71290 by: SafeV
71293 by: Brian White
Parsing a string with a delimeter
71292 by: Kal Amry
71294 by: David Robley
71295 by: SafeV
71296 by: Kal Amry
Error starting Apache 1.3.22 with PHP 4.0.6.
71297 by: Stefen Lars
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:
I made the changes and I still get the error. This is baffling since I
do not have the problem with other apps and I did not have the problem
for over six months.
If I do a Reload, it works. I am using the POST method to pass the data
(not that should really have any relevance), so the Reload does a
Repost.
Todd
-- Todd Cary Ariste Software toddaristesoftware.com
attached mail follows:
Hello,
I am having a strange problem with some form code. This is a login form, and most of the time I just put both the HTML form generation code and the actual database code in the same file. In the code I just check if the variable for the form element is empty/set or not.
This works on my dev server and a few others I've tried it on, but it doesn't work on the production web server of my client. Both are Apache, and both use PHP 4.0.6.
At first I was using "isset" instead of "empty" to test, but they both produce the same problem.
Any ideas why this works on one server and not another?
Thanks in advance for any help.
Here's the code:
<? require_once "./php/cfasttemplate.php"; require_once "./php/cuser.php";
// Are we submitting the login form? if (!empty($USERNAME)) {
$user = new CUser;
if ($user->login($USERNAME, $PASSWORD) != CUSER_SUCCESS) { echo phpversion(); exit(); }
// Insert user into the online table (EXPIRE the record after 300 seconds) $query_insert = "INSERT INTO ONLINE VALUES($ses_userid, UNIX_TIMESTAMP(), (UNIX_TIMESTAMP()+300))";
$database = new CDatabase;
$database->query($query_insert);
// Reload page to show login changes $js = "<script language='javascript'>\n"; $js .= "window.opener.parent.location.reload(1);\n"; $js .= "window.close();\n"; $js .= "</script>"; echo $js;
} else {
// Produce the login form $tpl = new FastTemplate("./templates/"); $tpl->define(array("login" => "login.html")); $tpl->parse("LOGIN", "login"); $tpl->FastPrint("LOGIN");
}
?>
attached mail follows:
OOPS! I forgot to tell you my problem.
The $USERNAME variable is ALWAYS set on my client's machine, even before the form is submitted. It's not on the other systems I've tried.
Basically on my client's machine it never show the login form.
Thanks!
-----Original Message-----
From: Dana Holt [mailto:danah
home.com]
Sent: Tuesday, October 16, 2001 1:25 PM
To: PHP Mailing List (E-mail)
Subject: [PHP] Form problem
Hello,
I am having a strange problem with some form code. This is a login form, and most of the time I just put both the HTML form generation code and the actual database code in the same file. In the code I just check if the variable for the form element is empty/set or not.
This works on my dev server and a few others I've tried it on, but it doesn't work on the production web server of my client. Both are Apache, and both use PHP 4.0.6.
At first I was using "isset" instead of "empty" to test, but they both produce the same problem.
Any ideas why this works on one server and not another?
Thanks in advance for any help.
Here's the code:
<? require_once "./php/cfasttemplate.php"; require_once "./php/cuser.php";
// Are we submitting the login form? if (!empty($USERNAME)) {
$user = new CUser;
if ($user->login($USERNAME, $PASSWORD) != CUSER_SUCCESS) { echo phpversion(); exit(); }
// Insert user into the online table (EXPIRE the record after 300 seconds) $query_insert = "INSERT INTO ONLINE VALUES($ses_userid, UNIX_TIMESTAMP(), (UNIX_TIMESTAMP()+300))";
$database = new CDatabase;
$database->query($query_insert);
// Reload page to show login changes $js = "<script language='javascript'>\n"; $js .= "window.opener.parent.location.reload(1);\n"; $js .= "window.close();\n"; $js .= "</script>"; echo $js;
} else {
// Produce the login form $tpl = new FastTemplate("./templates/"); $tpl->define(array("login" => "login.html")); $tpl->parse("LOGIN", "login"); $tpl->FastPrint("LOGIN");
}
?>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
> Hello, > > I am having a strange problem with some form code. This is a login form, and > most of the time I just put both the HTML form generation code and the > actual database code in the same file. In the code I just check if the > variable for the form element is empty/set or not. > > This works on my dev server and a few others I've tried it on, but it > doesn't work on the production web server of my client. Both are Apache, and > both use PHP 4.0.6. > > At first I was using "isset" instead of "empty" to test, but they both > produce the same problem. > > Any ideas why this works on one server and not another? > > Thanks in advance for any help. > > Here's the code: > > <? > require_once "./php/cfasttemplate.php"; > require_once "./php/cuser.php"; > > > // Are we submitting the login form? > if (!empty($USERNAME)) { > > $user = new CUser; > > if ($user->login($USERNAME, $PASSWORD) != CUSER_SUCCESS) { > echo phpversion(); > exit(); > } > > // Insert user into the online table (EXPIRE the record after 300 seconds) > $query_insert = "INSERT INTO ONLINE VALUES($ses_userid, UNIX_TIMESTAMP(), > (UNIX_TIMESTAMP()+300))"; > > $database = new CDatabase; > > $database->query($query_insert); > > // Reload page to show login changes > $js = "<script language='javascript'>\n"; > $js .= "window.opener.parent.location.reload(1);\n"; > $js .= "window.close();\n"; > $js .= "</script>"; > echo $js; > > } else { > > // Produce the login form > $tpl = new FastTemplate("./templates/"); > $tpl->define(array("login" => "login.html")); > $tpl->parse("LOGIN", "login"); > $tpl->FastPrint("LOGIN"); > > } > > ?> >
Hi,
Could you please give details on what the problem is? Does it always return TRUE, or FALSE ? If it always return TRUE, you can print it to see what it is. I experienced almost the same problem one week before, and finaly found that there's a session variable of the same name as the one checked in if().
As for variable checking, sometimes I just use the C style: if( $var ), and this also work perfect.
Alex
attached mail follows:
Thanks for the idea, don't know why I didn't think of printing the value. ;-) Yes, it is already set on my client's server, upon echoing the value is $USERNAME it is "root" Why would this be registered in my session? I always use "$ses_xxx" for my session variables to prevent this very problem. Dana
<my original code snipped>
Hi,
Could you please give details on what the problem is? Does it always return TRUE, or FALSE ? If it always return TRUE, you can print it to see what it is. I experienced almost the same problem one week before, and finaly found that there's a session variable of the same name as the one checked in if(). As for variable checking, sometimes I just use the C style: if( $var ), and this also work perfect. Alex
attached mail follows:
Anyone got any idea?
Say I have a table, myTable, and I want to get its contents into a flash movie. Anyone have any idea as to how this is done?
I do know how to use php/MySQL to get the contents out on a webpage.
Maybe I should be asking this on a Flash-related list :)
Oh well I'm just checking for any smart heads out there :)
- Torkil
attached mail follows:
At 11:20 AM -0700 10/16/01, Sheila Myers wrote: >I'm struggling with using a multidimensional array in my shopping cart >class. Can anyone tell me why this code is generating a parse error at >the indicated line? > >Thanks, >Sheila > >Class Cart >{ >var $items = array("productid"=>'', > "details"=>array( > "price"=>'', > "quantity"=>'', > "shipping"=>'', > "tax"=>'', > "desc"=>'', > "note"=>'') > ); >var $product_total; >var $shipping_total; >var $tax_total; >var $cart_id; > >function >add($sell_price,$qty,$shipping,$tax,$productid,$short_desc,$note) >{ >/* add an item to the shopping cart and update the total price */ >if (isset($this->items[$productid])) //if it is already in the cart, >don't add a new occurence, just update the total quantity >{ > $this->items[$productid]["quantity"] += $qty; >} >else >{ > $this->items["productid"]=>$productid; > <<<==================this is the >line reporting the parse error
Easy; don't use the => construct here (and in the following lines). That's only for use in the array() function. Just use
$this->items["productid"] = $productid;
here and in the lines below.
-steve
> $this->items[$productid]["price"]=>$sell_price; > $this->items[$productid]["quantity"]=>$qty; > $this->items[$productid]["shipping"]=>$shipping; > $this->items[$productid]["tax"]=>$tax; > $this->items[$productid]["desc"]=>$short_desc; > $this->items[$productid]["note"]=>$note; > $this->product_total = $this->product_total += $sell_price; > $this->shipping_total = $this->shipping_total += $shipping; >} >var_dump $this->items; //debugging >} //end add >
-- +--------------- my people are the people of the dessert, ---------------+ | Steve Edberg sbedbergucdavis.edu | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | +---------------- said t e lawrence, picking up his fork ----------------+
attached mail follows:
Oops, guess I didn't read close enough here...
At 12:01 PM -0700 10/16/01, Steve Edberg wrote: >At 11:20 AM -0700 10/16/01, Sheila Myers wrote: >>I'm struggling with using a multidimensional array in my shopping cart >>class. Can anyone tell me why this code is generating a parse error at >>the indicated line? >> >>Thanks, >>Sheila >> >>Class Cart >>{ >>var $items = array("productid"=>'', >> "details"=>array( >> "price"=>'', >> "quantity"=>'', >> "shipping"=>'', >> "tax"=>'', >> "desc"=>'', >> "note"=>'') >> ); >>var $product_total; >>var $shipping_total; >>var $tax_total; >>var $cart_id;
So the structure of your $items array will be
[0] => array( 'productid' => <product id>, 'details' => array( ....a bunch of stuff... ), ),
[1] => array( 'productid' => <product id>, 'details' => array( ....a bunch of stuff... ), )
...etc.
I suspect you're _really_ wanting something like
<product id> => array( 'price' => <price>, ...and so on... )
Incidentally, because of PHP's loose typing, you don't have to declare $items as an array; although, by doing as you have, it's a bit more self-documenting. It does leave you with an array of size one, though - where all the elements are empty.
>>function >>add($sell_price,$qty,$shipping,$tax,$productid,$short_desc,$note) >>{ >>/* add an item to the shopping cart and update the total price */ >>if (isset($this->items[$productid])) //if it is already in the cart, >>don't add a new occurence, just update the total quantity >>{ >> $this->items[$productid]["quantity"] += $qty; >>} >>else >>{ >> $this->items["productid"]=>$productid; >> <<<==================this is the >>line reporting the parse error > > >Easy; don't use the => construct here (and in the following lines). >That's only for use in the array() function. Just use > > $this->items["productid"] = $productid; > >here and in the lines below.
If you use the array as I mentioned above, this code block could be
$this->items[$productid] = array( 'price' => $sell_price, ...and so on... );
OR, you could leave out the line above and simply use your code below unaltered.
If you wanted to use your original structure, you could do something like
$this->items[] = array( 'productid' = $productid, 'details' = array( 'price' => $sell_price, ...and so on... ) );
Does that make more sense?? Because of PHP's array flexibility, it can be easy to confuse oneself at times!
- steve, again
> -steve > > >> $this->items[$productid]["price"]=>$sell_price; >> $this->items[$productid]["quantity"]=>$qty; >> $this->items[$productid]["shipping"]=>$shipping; >> $this->items[$productid]["tax"]=>$tax; >> $this->items[$productid]["desc"]=>$short_desc; >> $this->items[$productid]["note"]=>$note; >> $this->product_total = $this->product_total += $sell_price; >> $this->shipping_total = $this->shipping_total += $shipping; >>} >>var_dump $this->items; //debugging >>} //end add >> > >
-- +--------------- my people are the people of the dessert, ---------------+ | Steve Edberg sbedbergucdavis.edu | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | +---------------- said t e lawrence, picking up his fork ----------------+
attached mail follows:
I have been very happy with HostMichigan. Their prices are pretty cheap, and the service has been great so far. http://www.hostmichigan.com
"Clint Tredway" <clint
factorxsoftware.com> wrote in message
news:200110161311.AA378601508
dfwwebsolutions.com...
> Can anyone recomend a good PHP/MySQL web host?
>
> Thanks!
>
>
> --
> Clint Tredway
> www.factorxsoftware.com
> --
attached mail follows:
Good for low-priority projects -- http://www.fatcow.com
$100/year, 100 POP accounts, PHP4, MySQL 3.23.38, use of their SSL certificate included. Major downside = no telnet access. They _just_ upgraded to PHP4 -- I just started using them, so can't vouch for their adoption speed.
Wes
>Can anyone recomend a good PHP/MySQL web host?
>
>Thanks!
>
>
>--
>Clint Tredway
>www.factorxsoftware.com
>--
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
>For additional commands, e-mail: php-general-help
lists.php.net
>To contact the list administrators, e-mail: php-list-admin
lists.php.net
--
attached mail follows:
alright. that part is pretty much finished up. I've run into another curiosity/problem in writing another part of the photo system. I want to find the largest ID in the db so that I can make sure of when the person clicking through is at the end of the album
here's my query: $query = "SELECT MAX(picid) FROM pics"; $result = mysql_query($query,$conn);
I'm a little bit unsure of how to pull this data out though(i was thinking mysql_fetch_array again). My first thought was: $max_id = extract(mysql_fetch_array($result)).
Can anyone help out? -chris-
----- Original Message -----
From: "Philip Olson" <philip
cornado.com>
To: "Dave Watkinson" <d.watkinson
mightymatch.com>
Cc: "Chris Cocuzzo" <cuzo
mediaone.net>; <php-general
lists.php.net>
Sent: Tuesday, October 16, 2001 2:07 AM
Subject: RE: [PHP]Only 1 Query Result...help.
>
> On Tue, 16 Oct 2001, Dave Watkinson wrote:
> > i don't think it's wise to create an array and fill it with one element
> >
> > i would use mysql_fetch_row($result)
> >
> > just my tuppence worth ;-)
>
> I don't see the difference, both are arrays with _row being enumerated.
> Perhaps you meant mysql_result(). At any rate, Chris was under the
> impression that a while() loop was required to use these _fetch_ functions
> when that's not the case. Using these functions to fetch one row of data
> is very appropriate, associative or otherwise.
>
> Regards,
> Philip Olson
>
>
> > -----Original Message-----
> > From: Philip Olson [mailto:philip
cornado.com]
> > Sent: 15 October 2001 17:54
> > To: Chris Cocuzzo
> > Cc: php-general
lists.php.net
> > Subject: Re: [PHP]Only 1 Query Result...help.
> >
> >
> >
> > > but without using a loop to display
> > > just one result
> >
> > If you want just one row :
> >
> > $row = mysql_fetch_array($result);
> >
> > print $row['col'];
> >
> > Regards,
> > Philip Olson
> >
> >
> >
> > On Mon, 15 Oct 2001, Chris Cocuzzo wrote:
> >
> > > maybe I'm an idiot, but I don't understand how that helps in not using
> > a
> > > loop to display the results. Could you explain a little more?
> > >
> > > thanks
> > > chris
> > >
> > >
> > > ----- Original Message -----
> > > From: "_lallous" <elias_bachaalany
yahoo.com>
> > > To: <php-general
lists.php.net>
> > > Sent: Monday, October 15, 2001 3:30 AM
> > > Subject: Re: [PHP]Only 1 Query Result...help.
> > >
> > >
> > > > try to see the SELECT * FROM table LIMIT max, offset
> > > >
> > > > see the LIMIT syntax.
> > > >
> > > > "Chris Cocuzzo" <cuzo
mediaone.net> wrote in message
> > > > news:002b01c154f3$0a113310$ae687780
webs224...
> > > > hey-
> > > >
> > > > I'm trying to put together a photo album system with next/previous
> > buttons
> > > > that displays one picture at a time, and obviously the user has to
> > click
> > > > through the buttons to navigate the pictures. I'm using this line
> > for the
> > > > query
> > > >
> > > > $picquery = "SELECT picid,path,width,height FROM pics WHERE id =
> > $id";
> > > >
> > > > normally to display results I'd use the mysql_fetch_array function
> > and
> > > print
> > > > it out like: $picdata[src];
> > > >
> > > > what i was wondering if there's another function that I can use
> > that'll
> > > > stick the results into an array or some other organized data
> > structure so
> > > I
> > > > can display them, but without using a loop to display just one
> > result
> > > >
> > > > thanks
> > > > chris
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > > > For additional commands, e-mail: php-general-help
lists.php.net
> > > > To contact the list administrators, e-mail:
> > php-list-admin
lists.php.net
> > > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > > For additional commands, e-mail: php-general-help
lists.php.net
> > > To contact the list administrators, e-mail:
> > php-list-admin
lists.php.net
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail: php-list-admin
lists.php.net
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail: php-list-admin
lists.php.net
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
On 16-Oct-2001 Chris Cocuzzo wrote: > alright. that part is pretty much finished up. I've run into another > curiosity/problem in writing another part of the photo system. I want to > find the largest ID in the db so that I can make sure of when the person > clicking through is at the end of the album > > here's my query: > $query = "SELECT MAX(picid) FROM pics"; > $result = mysql_query($query,$conn); > > I'm a little bit unsure of how to pull this data out though(i was thinking > mysql_fetch_array again). My first thought was: $max_id = > extract(mysql_fetch_array($result)). > > Can anyone help out?
$qry ="SELECT MAX(picid) as maxid FROM pics"; $res =mysql_query($qry); if ($res) { $row = mysql_fetch_object($res); echo $row->maxid, '<br>'; }
Regards,
-- Don Read dreadtexas.net -- It is necessary for me to learn from others' mistakes. I will not live long enough to make them all by myself.
attached mail follows:
extract(mysql_fetch_assoc(mysql_query("SELECT MAX(picid) AS max_id FROM pics", $conn)));
Will give you $max_id. You can also split it up, if you prefer...
$query = "SELECT MAX(picid) AS max_id FROM pics"; $result = mysql_query($query,$conn); extract(mysql_fetch_assoc($result));
-----Original Message-----
From: Chris Cocuzzo [mailto:cuzo
mediaone.net]
Sent: Tuesday, October 16, 2001 3:20 PM
To: Philip Olson
Cc: php-general
lists.php.net
Subject: Re: [PHP]Only 1 Query Result...help.
alright. that part is pretty much finished up. I've run into another curiosity/problem in writing another part of the photo system. I want to find the largest ID in the db so that I can make sure of when the person clicking through is at the end of the album
here's my query: $query = "SELECT MAX(picid) FROM pics"; $result = mysql_query($query,$conn);
I'm a little bit unsure of how to pull this data out though(i was thinking mysql_fetch_array again). My first thought was: $max_id = extract(mysql_fetch_array($result)).
Can anyone help out? -chris-
----- Original Message -----
From: "Philip Olson" <philip
cornado.com>
To: "Dave Watkinson" <d.watkinson
mightymatch.com>
Cc: "Chris Cocuzzo" <cuzo
mediaone.net>; <php-general
lists.php.net>
Sent: Tuesday, October 16, 2001 2:07 AM
Subject: RE: [PHP]Only 1 Query Result...help.
>
> On Tue, 16 Oct 2001, Dave Watkinson wrote:
> > i don't think it's wise to create an array and fill it with one
element
> >
> > i would use mysql_fetch_row($result)
> >
> > just my tuppence worth ;-)
>
> I don't see the difference, both are arrays with _row being
enumerated.
> Perhaps you meant mysql_result(). At any rate, Chris was under the
> impression that a while() loop was required to use these _fetch_
functions
> when that's not the case. Using these functions to fetch one row of
data
> is very appropriate, associative or otherwise.
>
> Regards,
> Philip Olson
>
>
> > -----Original Message-----
> > From: Philip Olson [mailto:philip
cornado.com]
> > Sent: 15 October 2001 17:54
> > To: Chris Cocuzzo
> > Cc: php-general
lists.php.net
> > Subject: Re: [PHP]Only 1 Query Result...help.
> >
> >
> >
> > > but without using a loop to display
> > > just one result
> >
> > If you want just one row :
> >
> > $row = mysql_fetch_array($result);
> >
> > print $row['col'];
> >
> > Regards,
> > Philip Olson
> >
> >
> >
> > On Mon, 15 Oct 2001, Chris Cocuzzo wrote:
> >
> > > maybe I'm an idiot, but I don't understand how that helps in not
using
> > a
> > > loop to display the results. Could you explain a little more?
> > >
> > > thanks
> > > chris
> > >
> > >
> > > ----- Original Message -----
> > > From: "_lallous" <elias_bachaalany
yahoo.com>
> > > To: <php-general
lists.php.net>
> > > Sent: Monday, October 15, 2001 3:30 AM
> > > Subject: Re: [PHP]Only 1 Query Result...help.
> > >
> > >
> > > > try to see the SELECT * FROM table LIMIT max, offset
> > > >
> > > > see the LIMIT syntax.
> > > >
> > > > "Chris Cocuzzo" <cuzo
mediaone.net> wrote in message
> > > > news:002b01c154f3$0a113310$ae687780
webs224...
> > > > hey-
> > > >
> > > > I'm trying to put together a photo album system with
next/previous
> > buttons
> > > > that displays one picture at a time, and obviously the user has
to
> > click
> > > > through the buttons to navigate the pictures. I'm using this
line
> > for the
> > > > query
> > > >
> > > > $picquery = "SELECT picid,path,width,height FROM pics WHERE id =
> > $id";
> > > >
> > > > normally to display results I'd use the mysql_fetch_array
function
> > and
> > > print
> > > > it out like: $picdata[src];
> > > >
> > > > what i was wondering if there's another function that I can use
> > that'll
> > > > stick the results into an array or some other organized data
> > structure so
> > > I
> > > > can display them, but without using a loop to display just one
> > result
> > > >
> > > > thanks
> > > > chris
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > > > For additional commands, e-mail: php-general-help
lists.php.net
> > > > To contact the list administrators, e-mail:
> > php-list-admin
lists.php.net
> > > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > > For additional commands, e-mail: php-general-help
lists.php.net
> > > To contact the list administrators, e-mail:
> > php-list-admin
lists.php.net
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail:
php-list-admin
lists.php.net
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail:
php-list-admin
lists.php.net
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail:
php-list-admin
lists.php.net
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Consider (and run) the following code:
function globalize() { global $STATEMENT_DATE_MACRO; global $STATEMENT_MONTH_MACRO; global $SETTLEMENT_DATE_MACRO; echo "$STATEMENT_DATE_MACRO = STATEMENT_DATE_MACRO<br>\n"; echo "$STATEMENT_MONTH_MACRO = STATEMENT_MONTH_MACRO<br>\n"; echo "$SETTLEMENT_DATE_MACRO = SETTLEMENT_DATE_MACRO<br>\n"; } //function doIt() { $today = date( "U" ); $last_month = mktime( 0, 0 , 0 , ( date( "m" ) - 1 ), 1 , date( "Y" ));
$STATEMENT_DATE_MACRO = date( "jS F, Y", $today ); $STATEMENT_MONTH_MACRO = date( "F Y", $last_month ); $SETTLEMENT_DATE_MACRO = date( "F 20, Y", $today ); globalize(); //}
//doIt();
Everything works great. Couldn't be happier. Now, uncomment the three lines above that are commented out... the lines that start and end the "doIt()" function and the function call itself. Run it again. Why isn't this working? Shouldn't the calling function's variables be part of the "global namespace" for the called functions?
Chris
attached mail follows:
At 3:19 PM -0500 10/16/01, Boget, Chris wrote: >Consider (and run) the following code: > >function globalize() { > global $STATEMENT_DATE_MACRO; > global $STATEMENT_MONTH_MACRO; > global $SETTLEMENT_DATE_MACRO; > > echo "$STATEMENT_DATE_MACRO = STATEMENT_DATE_MACRO<br>\n"; > echo "$STATEMENT_MONTH_MACRO = STATEMENT_MONTH_MACRO<br>\n"; > echo "$SETTLEMENT_DATE_MACRO = SETTLEMENT_DATE_MACRO<br>\n"; > >} > >//function doIt() {
the global statement doesn't work this way; you have to use it WITHIN each function you want to access globals in. It will work if you stick the three global statements after the function declaration.
There has been a lot of discussion in the past about PHP's use of globals; you can search the mailing list at http://marc.theaimsgroup.com for more on that debate.
Also see
http://www.php.net/manual/en/language.variables.scope.php
-steve
> $today = date( "U" ); > $last_month = mktime( 0, 0 , 0 , ( date( "m" ) - 1 ), 1 , date( "Y" )); > > $STATEMENT_DATE_MACRO = date( "jS F, Y", $today ); > $STATEMENT_MONTH_MACRO = date( "F Y", $last_month ); > $SETTLEMENT_DATE_MACRO = date( "F 20, Y", $today ); > > globalize(); > >//} > >//doIt(); > >Everything works great. Couldn't be happier. Now, uncomment the >three lines above that are commented out... the lines that start and end >the "doIt()" function and the function call itself. Run it again. >Why isn't this working? Shouldn't the calling function's variables be >part of the "global namespace" for the called functions? > >Chris
-- +--------------- my people are the people of the dessert, ---------------+ | Steve Edberg sbedbergucdavis.edu | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | +---------------- said t e lawrence, picking up his fork ----------------+
attached mail follows:
In article <4040BBE81A9AD411BD27009027887A7C042F62
tiger.wild.net>,
Chris.Boget
wild.net (Chris Boget) wrote:
> function globalize() { > global $STATEMENT_DATE_MACRO; > global $STATEMENT_MONTH_MACRO; > global $SETTLEMENT_DATE_MACRO; > > echo "$STATEMENT_DATE_MACRO = STATEMENT_DATE_MACRO<br>\n"; > echo "$STATEMENT_MONTH_MACRO = STATEMENT_MONTH_MACRO<br>\n"; > echo "$SETTLEMENT_DATE_MACRO = SETTLEMENT_DATE_MACRO<br>\n"; > > } > > //function doIt() { > $today = date( "U" ); > $last_month = mktime( 0, 0 , 0 , ( date( "m" ) - 1 ), 1 , date( "Y" )); > > $STATEMENT_DATE_MACRO = date( "jS F, Y", $today ); > $STATEMENT_MONTH_MACRO = date( "F Y", $last_month ); > $SETTLEMENT_DATE_MACRO = date( "F 20, Y", $today ); > > globalize(); > > //}
PHP's "global" keyword doesn't "globalize" a variable so much as say "inside the current function, whenever I refer to variable such-and-such I mean the one that's in the global namespace."
For what you want to do, consider using constants or the $GLOBALS array.
-- CC
attached mail follows:
> Consider (and run) the following code: > > function globalize() { > global $STATEMENT_DATE_MACRO; > global $STATEMENT_MONTH_MACRO; > global $SETTLEMENT_DATE_MACRO; > > echo "$STATEMENT_DATE_MACRO = STATEMENT_DATE_MACRO<br>\n"; > echo "$STATEMENT_MONTH_MACRO = STATEMENT_MONTH_MACRO<br>\n"; > echo "$SETTLEMENT_DATE_MACRO = SETTLEMENT_DATE_MACRO<br>\n"; > > } > > file://function doIt() { > $today = date( "U" ); > $last_month = mktime( 0, 0 , 0 , ( date( "m" ) - 1 ), 1 , date( "Y" )); > > $STATEMENT_DATE_MACRO = date( "jS F, Y", $today ); > $STATEMENT_MONTH_MACRO = date( "F Y", $last_month ); > $SETTLEMENT_DATE_MACRO = date( "F 20, Y", $today ); > > globalize(); > > file://} > > file://doIt(); > > Everything works great. Couldn't be happier. Now, uncomment the > three lines above that are commented out... the lines that start and end > the "doIt()" function and the function call itself. Run it again. > Why isn't this working? Shouldn't the calling function's variables be > part of the "global namespace" for the called functions? > > Chris >
In PHP keywords "global" only works to cause a global variable to be seen within a specific namespace/function. On this aspect PHP is slightly different from C. In C namespace is hierachical and thus a vairable can be seen in downward without "global" re-declaration within a certain function.
Alex
attached mail follows:
Has anyone parsed an Excel file or used a particular method to parse Excel files? I have a project where it is required but not sure how to start with it :)
Jeff
attached mail follows:
Check this out, it may be useful...
By the way, Google rules.
http://homepage.tinet.ie/~jmcnamara/perl/PerlExcelFaq.html
-Jason Garber IonZoft.com
At 05:05 PM 10/16/2001 -0400, Jeff Lewis wrote: >Has anyone parsed an Excel file or used a particular method to parse Excel >files? I have a project where it is required but not sure how to start >with it :) > >Jeff
attached mail follows:
Yes Google does and I've already seen this :) I was wondering if PHP directly (as opposed to calling exec).
Jeff
----- Original Message -----
From: "Jason G." <blair
nb.net>
To: "Jeff Lewis" <jeff
hyrum.net>; <php-general
lists.php.net>
Sent: Tuesday, October 16, 2001 5:48 PM
Subject: Re: [PHP] Parsing MS Excel files...
> Check this out, it may be useful... > > By the way, Google rules. > > http://homepage.tinet.ie/~jmcnamara/perl/PerlExcelFaq.html > > -Jason Garber > IonZoft.com > > At 05:05 PM 10/16/2001 -0400, Jeff Lewis wrote: > >Has anyone parsed an Excel file or used a particular method to parse Excel > >files? I have a project where it is required but not sure how to start > >with it :) > > > >Jeff > > > > >
attached mail follows:
jeff
hyrum.net (Jeff Lewis) wrote:
> Yes Google does and I've already seen this :) I was wondering if PHP > directly (as opposed to calling exec). >
php.net/com
-- Henrik Hansen
attached mail follows:
This is VERY basic code, but it looks like a good place to start... I've never tried it myself...
http://px.sklar.com/code.html?code_id=488
-----Original Message-----
From: Jeff Lewis [mailto:jeff
hyrum.net]
Sent: Tuesday, October 16, 2001 5:57 PM
To: php-general
lists.php.net; Jason G.
Subject: Re: [PHP] Parsing MS Excel files...
Yes Google does and I've already seen this :) I was wondering if PHP directly (as opposed to calling exec).
Jeff
----- Original Message -----
From: "Jason G." <blair
nb.net>
To: "Jeff Lewis" <jeff
hyrum.net>; <php-general
lists.php.net>
Sent: Tuesday, October 16, 2001 5:48 PM
Subject: Re: [PHP] Parsing MS Excel files...
> Check this out, it may be useful... > > By the way, Google rules. > > http://homepage.tinet.ie/~jmcnamara/perl/PerlExcelFaq.html > > -Jason Garber > IonZoft.com > > At 05:05 PM 10/16/2001 -0400, Jeff Lewis wrote: > >Has anyone parsed an Excel file or used a particular method to parse Excel > >files? I have a project where it is required but not sure how to start > >with it :) > > > >Jeff > > > > >
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Okay, I'm not really sure of the cause of this problem, but it's really annoying. Several of my scripts, once they're processed, continue to return the same results even after I've changed something that should have changed the results. eg, I have a script that counts the number of SWFs in a directory and returns that number. But even after deleting or adding SWFs in the directory, it returns the number of SWFs previous to the change. I empty my browser cache, hit shift-refresh, try it on different computers, all with the same result. My PHP book doesn't discuss a PHP server cache that could be causing the problem. Any suggestions?
Nick
attached mail follows:
> Okay, I'm not really sure of the cause of this problem, but it's > really annoying. Several of my scripts, once they're processed, > continue to return the same results even after I've changed something > that should have changed the results. eg, I have a script that > counts the number of SWFs in a directory and returns that number. > But even after deleting or adding SWFs in the directory, it returns > the number of SWFs previous to the change. I empty my browser cache, > hit shift-refresh, try it on different computers, all with the same > result. My PHP book doesn't discuss a PHP server cache that could be > causing the problem. Any suggestions?
Nicholas, I get that sort of thing when I forget to save the script (after editing) before refreshing the browser!? =dn
attached mail follows:
Good thought. Afterall, I sometimes think my computer's busted because I forgot to plug it in. But that ain't it. ;-)
Nick
> > Okay, I'm not really sure of the cause of this problem, but it's >> really annoying. Several of my scripts, once they're processed, >> continue to return the same results even after I've changed something >> that should have changed the results. eg, I have a script that >> counts the number of SWFs in a directory and returns that number. >> But even after deleting or adding SWFs in the directory, it returns >> the number of SWFs previous to the change. I empty my browser cache, >> hit shift-refresh, try it on different computers, all with the same >> result. My PHP book doesn't discuss a PHP server cache that could be >> causing the problem. Any suggestions? > >Nicholas, >I get that sort of thing when I forget to save the script (after >editing) before refreshing the browser!? >=dn
------------------------------ Nicholas A. Zukin Web/Database Developer ODI Technolgies ----------------------------
attached mail follows:
On Wed, 17 Oct 2001 06:38, Nicholas A. Zukin wrote: > Okay, I'm not really sure of the cause of this problem, but it's > really annoying. Several of my scripts, once they're processed, > continue to return the same results even after I've changed something > that should have changed the results. eg, I have a script that > counts the number of SWFs in a directory and returns that number. > But even after deleting or adding SWFs in the directory, it returns > the number of SWFs previous to the change. I empty my browser cache, > hit shift-refresh, try it on different computers, all with the same > result. My PHP book doesn't discuss a PHP server cache that could be > causing the problem. Any suggestions? > > Nick
Without seeing your script, I'll take a stab; have a look at clearstatcache() and see if that might help.
-- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIAPalindrome isn't one.
attached mail follows:
strtotime('+2 weeks', $time);
http://www.php.net/manual/en/function.strtotime.php
----- Original Message -----
From: "Don" <don
lclcan.com>
To: "php list" <php-general
lists.php.net>
Sent: Monday, October 15, 2001 8:32 PM
Subject: [PHP] Date format question
Hi,
I have a date string in the following format: yyyymmdd. So today's date would show as 20011015
What I want to do is add 14 days to the date (month and year changes are verified) and produce output that looks like, mmm-dd-yyyy as in: Oct-29-2001 (I know I can use the "date()" function to accomplish the latter.
Does anyone have a function that does the above?
Thanks, Don
attached mail follows:
and what about usort() or uasort()? write your custom comparison function:
----- Original Message -----
From: "Boget, Chris" <Chris.Boget
wild.net>
To: "Php-General" <php-general
lists.php.net>
Sent: Monday, October 15, 2001 10:48 PM
Subject: [PHP] Sorting multiple dimensional arrays
> I've got a 4 (yes, 4) dimensional array. However, I only > want to sort on the third dimension only. > I've tried ksort() and array_multisort() but neither seem > to work. Tried a few of the other functions but they don't > seem to work, either. > Any suggestions? Hints? > > Chris >
attached mail follows:
Hi. I've got a photo gallery that I've built, that displays 6 thumbnails at a time, and then gives previous, next, and page links. The problem is, I always seem to end up with 1 extra page result, and the "next" link never goes away, even when the records end. Clicking on the "next" link just takes you to a blank page. I've been messing with the numbers in the code, but I can't seem to figure it out, so I thought I'd instill the knowledge of the expert masses. Can anyone help?
The gallery itself can be found at http://128.242.234.179/gallery/
Here's the code:
// execute SQL query and get results $limit=6; // Rows to return $numresults=mysql_query($sql,$connection) or die ("Couldn't execute query."); $numrows=mysql_num_rows($numresults);
// next determine if offset has been passed to script, if not use 0 if (empty($offset)) { $offset=0; }
// Get Results $result=mysql_query("SELECT ID,title,thumbnail FROM $table_name limit $offset,$limit");
// now you can display the results returned $i=1; while ($row = mysql_fetch_array($result)) {
$ID=$row['ID']; $thumbnail=$row['thumbnail']; $title=$row['title']; if (is_int($i/3)) {
$display_block .= "<display code snipped...>
}
else {
$display_block .= "<display code snipped>
}
$i++;
}
// next we need to do the links to other results if ($offset>0) { // bypass PREV link if offset is 0 $prevoffset=$offset-6;
$prev_link .= "<a href=\"$PHP_SELF?offset=$prevoffset\">PREV</a>\n"; }
// calculate number of pages needing links $pages=intval($numrows/$limit);
// $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) {
// has remainder so add one page $pages++; }
for ($i=1;$i<=$pages;$i++) { // loop thru
$newoffset=$limit*($i-1); $pages_link .= "<a href=\"$PHP_SELF?offset=$newoffset\">$i</a>\n"; }
// check to see if last page if (!(($offset/$limit)==$pages) && $pages!=0) {
// not last page so give NEXT link $newoffset=$offset+$limit; $next_link .= "<a href=\"$PHP_SELF?offset=$newoffset\">NEXT</a><p>\n"; }
<END PHP CODE>
If possible, please reply to mike
thinkmango.com, as I am on the digest.
Thanks,
mto
--Michael O'Neal Web Producer/ Autocrosser ST 28 '89 Civic Si --------------------- M A N G O B O U L D E R --------------------- http://www.thinkmango.com e- mike
thinkmango.com p- 303.442.1821 f- 303.938.8507
attached mail follows:
If I have two times, in text format:
14:32:23 and 17:56:36
How can I calculate the difference between the two, and have it returned like:
03:24:13
Then beyond that, once I have a bunch of these differences, such as:
03:24:13 00:45:52 etc
I need be able to add those all up as I go, so it'd be a loop and it'd keep a running total.
The numerical equivalent of what I want to do is:
$total = 0; while ($data = mysql_fetch_array($result)) { $difference = $data['end'] - $data['start']; // for example, (end = 5) - (start = 3) echo $difference; // 2 $total += $difference; } echo $total;
Mike
attached mail follows:
On Wed, 17 Oct 2001 09:07, Mike Eheler wrote: > If I have two times, in text format: > > 14:32:23 and 17:56:36 > > How can I calculate the difference between the two, and have it > returned like: > > 03:24:13 > > Then beyond that, once I have a bunch of these differences, such as: > > 03:24:13 > 00:45:52 > etc > > I need be able to add those all up as I go, so it'd be a loop and it'd > keep a running total. > > The numerical equivalent of what I want to do is: > > $total = 0; > while ($data = mysql_fetch_array($result)) { > $difference = $data['end'] - $data['start']; // for example, (end = > 5) - (start = 3) > echo $difference; // 2 > $total += $difference; > } > echo $total; > > Mike
You might use explode to park the hh, mm, ss parts of the time in an array, then use the elements of the array and mktime to turn the values into a unix timestamp. You could then add the timestamp values and finally convert back to hh:mm:ss
Or, if that doesn't work, just convert to seconds by multiplying the hour part by 3600, the minute by 60.
-- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIAUseless Invention: Reduced calorie water.
attached mail follows:
I am trying to make a site, that validates a login, sets up a session...but the session will timeout after xx number of minutes.
I have attempted to use the php.ini setting for session.cookie_lifetime to the number of seconds that the session should terminate....IF is has been idle. What I am finding, is that the session times out whatever number of seconds the session.cookie_lifetime is set to..from the initial session_start(). The timer is never re-initialized as I hop from page to page in my site.....so no matter if I'm active or not, xx seconds from login, this session is no longer valid.
Here's the code I am using.
Page 1 - Login Authentication and initial session setup.
<?php session_start();
.....(validate against db, etc)....
session_register("loginid"); session_register("loginname"); session_register("loginemail"); session_register("loginregion"); session_register("loginusrtype"); $loginid = $rowdata[usrID]; $loginname = $rowdata[usrName]; $loginemail = $rowdata[usrEmail]; $loginregion = $rowdata[usrRegion]; $loginusrtype = $rowdata[usrType];
?>
Page 2 - Included in every page throughout the site...as it is required that a valid authenticated session is setup to get to any of the pages.
<?php session_start();
if ( ! session_is_registered( "loginid")) ## Checks if valid id is set.. { header("Location: login.php?reset=1"); exit; }
include ("db.php"); ?>
attached mail follows:
In form one and file one, I have:
<SELECT name="e_OS"> <OPTION value="RedHat Linux" selected>RedHat Linux</OPTION> </SELECT>
Please note that there is a space between "RedHat" and "Linux"
Now, in file 2, I have:
<? echo "<font color=\"#99CC00\">$e_OS</font>"; ?>
The problem is that I get "RedHatLinux" in the output but THERE is NO SPACING!!
Anyone might know what's going on!!
Thanks,
attached mail follows:
I tried with both "GET" and "POST", everything is OK. Can you post more piece of code here?
Alex
----- Original Message -----
From: "Kal Amry" <kamry
cox.rr.com>
To: <php-general
lists.php.net>
Sent: Tuesday, October 16, 2001 7:59 PM
Subject: [PHP] Sapces in Input are not Present in Output
>
> In form one and file one, I have:
>
> <SELECT name="e_OS">
> <OPTION value="RedHat Linux"
> selected>RedHat Linux</OPTION>
> </SELECT>
>
>
> Please note that there is a space between "RedHat" and "Linux"
>
> Now, in file 2, I have:
>
> <? echo "<font color=\"#99CC00\">$e_OS</font>"; ?>
>
>
> The problem is that I get "RedHatLinux" in the output but THERE is NO
> SPACING!!
>
> Anyone might know what's going on!!
>
> Thanks,
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
attached mail follows:
It worked now!! I gave it double spaces then I deleted it and inserted it through Dream Waver GUI and it works!!
Now, I'm having another problem!! I get an error for this code:
for ($i = 0; $i < count($cobaltLinux[$e_System]); $i++)
Saying "Warning: Illegal offset type
"Alex Shi" <chpshi
netvigator.ca> wrote in message
news:017b01c156a3$68e10580$0105050a
pony...
> I tried with both "GET" and "POST", everything is OK. Can you post more
> piece of code here?
>
> Alex
>
> ----- Original Message -----
> From: "Kal Amry" <kamry
cox.rr.com>
> To: <php-general
lists.php.net>
> Sent: Tuesday, October 16, 2001 7:59 PM
> Subject: [PHP] Sapces in Input are not Present in Output
>
>
> >
> > In form one and file one, I have:
> >
> > <SELECT name="e_OS">
> > <OPTION value="RedHat Linux"
> > selected>RedHat Linux</OPTION>
> > </SELECT>
> >
> >
> > Please note that there is a space between "RedHat" and "Linux"
> >
> > Now, in file 2, I have:
> >
> > <? echo "<font color=\"#99CC00\">$e_OS</font>"; ?>
> >
> >
> > The problem is that I get "RedHatLinux" in the output but THERE is NO
> > SPACING!!
> >
> > Anyone might know what's going on!!
> >
> > Thanks,
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail: php-list-admin
lists.php.net
> >
> >
>
attached mail follows:
Ok, it seem that it was something to do with passing an array and then rendering it without mentioning the subscript.
Thanks Anyway
"Kal Amry" <kamry
cox.rr.com> wrote in message
news:20011017011252.54327.qmail
pb1.pair.com...
>
> It worked now!! I gave it double spaces then I deleted it and inserted it
> through Dream Waver GUI and it works!!
>
> Now, I'm having another problem!! I get an error for this code:
>
> for ($i = 0; $i < count($cobaltLinux[$e_System]); $i++)
>
> Saying "Warning: Illegal offset type
>
> "Alex Shi" <chpshi
netvigator.ca> wrote in message
> news:017b01c156a3$68e10580$0105050a
pony...
> > I tried with both "GET" and "POST", everything is OK. Can you post more
> > piece of code here?
> >
> > Alex
> >
> > ----- Original Message -----
> > From: "Kal Amry" <kamry
cox.rr.com>
> > To: <php-general
lists.php.net>
> > Sent: Tuesday, October 16, 2001 7:59 PM
> > Subject: [PHP] Sapces in Input are not Present in Output
> >
> >
> > >
> > > In form one and file one, I have:
> > >
> > > <SELECT name="e_OS">
> > > <OPTION value="RedHat Linux"
> > > selected>RedHat Linux</OPTION>
> > > </SELECT>
> > >
> > >
> > > Please note that there is a space between "RedHat" and "Linux"
> > >
> > > Now, in file 2, I have:
> > >
> > > <? echo "<font color=\"#99CC00\">$e_OS</font>"; ?>
> > >
> > >
> > > The problem is that I get "RedHatLinux" in the output but THERE is NO
> > > SPACING!!
> > >
> > > Anyone might know what's going on!!
> > >
> > > Thanks,
> > >
> > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > > For additional commands, e-mail: php-general-help
lists.php.net
> > > To contact the list administrators, e-mail:
php-list-admin
lists.php.net
> > >
> > >
> >
>
>
attached mail follows:
include("/home/fplg/db/db_config.php"); $conn = db_connect("fplg"); $pic_query = "SELECT picid,path,width,height FROM pics WHERE id = '".$id."'"; echo $pic_query; $pic_result = mysql_query($pic_query,$conn); echo "pic result complete"; while($pic_data = mysql_fetch_array($pic_result)) { ?>
can someone give me any hint as to what may be wrong with this...it's telling me that the line inside the while loop condition is not a valid resources(note: i tried this without the loop with the same problem)...what's wrong??
chris
attached mail follows:
Please read the FAQ. This question gets asked almost daily. http://www.php.net/manual/en/faq.databases.php#AEN63031
-Rasmus
On Tue, 16 Oct 2001, Chris Cocuzzo wrote:
> include("/home/fplg/db/db_config.php"); > $conn = db_connect("fplg"); > $pic_query = "SELECT picid,path,width,height FROM pics WHERE id = '".$id."'"; > echo $pic_query; > $pic_result = mysql_query($pic_query,$conn); > echo "pic result complete"; > while($pic_data = mysql_fetch_array($pic_result)) { > ?> > > can someone give me any hint as to what may be wrong with this...it's telling me that the line inside the while loop condition is not a valid resources(note: i tried this without the loop with the same problem)...what's wrong?? > > chris >
attached mail follows:
> include("/home/fplg/db/db_config.php"); > $conn = db_connect("fplg"); > $pic_query = "SELECT picid,path,width,height FROM pics WHERE > id = '".$id."'"; > echo $pic_query; > $pic_result = mysql_query($pic_query,$conn); > echo "pic result complete"; > while($pic_data = mysql_fetch_array($pic_result)) { > ?> > > can someone give me any hint as to what may be wrong with > this...it's telling me that the line inside the while loop > condition is not a valid resources(note: i tried this without > the loop with the same problem)...what's wrong??
You should do some error checking on your MySQL.
"Not a valid resource" means there's no MySQL result set when you are trying to use mysql_fetch_array. A better way to do it:
<? if ($pic_result = mysql_query($pic_query,$conn)) { echo "pic result successful"; while($pic_data = mysql_fetch_array($pic_result)) { ... } } else { echo mysql_error(); } ?>
Jason
attached mail follows:
strange one here, could someone explain why select * from subverts where status = 'L' order by date_added desc LIMIT 4,6 Reruns 5 rows?
Below code returns :
select * from subverts where status = 'L' order by date_added desc LIMIT 4,6 Bombs R Us Free Quarter Pounder at-Bristol / ass-Bristol Function: Pollution Clubman
Code is:
$sql = "select * ". "from subverts ". "where status = 'L' ". "order by date_added desc ". "LIMIT $first,$last";
echo " $sql ";
$results1 = query_db( $sql, $db );
?> <table width="95%" border=0 align=center cellpadding=3 cellspacing=0> <tr> <td> <?
echo "<div align=centre>";
while( $subv = fetch_array_db( $results1 ) ) { echo $subv["title"]."<br>"; }
echo "</td></tr></table>";
Still get five rows if I remove the desc.
Ben
************************************************************** * Ben Edwards +352 091 429995 * * Homepage http://www.gifford.co.uk/~bedwards * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol's radical news http://www.bristle.co.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * **************************************************************
attached mail follows:
On Wed, 17 Oct 2001 02:24:04 +0200, Ben Edwards wrote: >strange one here, could someone explain why > select * from subverts where status = 'L' order by date_added >desc LIMIT >4,6 >Reruns 5 rows?
because there were only nine?
attached mail follows:
> strange one here, could someone explain why > select * from subverts where status = 'L' order by > date_added desc LIMIT > 4,6 > Reruns 5 rows?
LIMIT 4,6 means "Start and row 4, and give me the next 6 rows"
Jason
attached mail follows:
A German language module has now been added, bringing the languages offered to 8! Also, the look has changed and themes are now offered. A Russian and Estonian translation are in the works.
-- Gaylen gfraley5earthlink.net http://www.gaylenandmargie.com PHP KISGB v2.1 Guestbook http://www.gaylenandmargie.com/publicscripts
attached mail follows:
Below is the result of your feedback form. It was submitted by
(rareasiannudes
xxxasia.com) on Wednesday, October 17, 2001 at 03:20:46
---------------------------------------------------------------------------
: <b>please visit these following sites if you want access to THOUSANDS OF RARE PHOTOS and LIVE FEEDS most of these PHOTOS/MOVIES ARE BANNED IN ASIA! GET EM WHILE THEY'RE HOT! <br><br> (best viewed with IE. thanks)<br> <a href="http://www.japanbitch.com/join/?c=chicken">WWW.JAPANBITCH.COM</a> <BR><BR> <a href="http://www.asianhearts.com/join/?c=chicken">WWW.ASIANHEARTS.COM</A> <BR><BR> <a href="http://www.japanwhore.com/join/?c=chicken">WWW.JAPANWHORE.COM</A>
---------------------------------------------------------------------------
attached mail follows:
Notice how all To: address start with a P Looks like some1 got a hold of a spam list
Chris Kay - Technical Support - IDEAL Internet
email: chriskay
ideal.net.au phone: +61 2 4628 8888 fax: +61 2 4628 8890
-----Original Message-----
From: rareasiannudes
xxxasia.com [mailto:rareasiannudes
xxxasia.com]
Sent: Wednesday, October 17, 2001 12:21 PM
To: philipm
schemasoft.com; phillip.b
virgin.net;
phillip.carr
diagnosis-uk.com; phillip
neptune.com; phillipr
ci.aspen.co.us;
philnoir
earthlink.net; philo
arrowweb.com; philorlando
hotmail.com;
photius
photius.com; php-general
lists.php.net
Subject: [PHP] do u like asian pussy? japan korea china xxx
Below is the result of your feedback form. It was submitted by
(rareasiannudes
xxxasia.com) on Wednesday, October 17, 2001 at 03:20:46
---------------------------------------------------------------------------
: <b>please visit these following sites if you want access to THOUSANDS OF RARE PHOTOS and LIVE FEEDS most of these PHOTOS/MOVIES ARE BANNED IN ASIA! GET EM WHILE THEY'RE HOT! <br><br> (best viewed with IE. thanks)<br> <a href="http://www.japanbitch.com/join/?c=chicken">WWW.JAPANBITCH.COM</a> <BR><BR> <a href="http://www.asianhearts.com/join/?c=chicken">WWW.ASIANHEARTS.COM</A> <BR><BR> <a href="http://www.japanwhore.com/join/?c=chicken">WWW.JAPANWHORE.COM</A>
---------------------------------------------------------------------------
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Someone, have a go at this!
I have encountered a very troublesome problem, which I don't see how to solve in an elegant way, since PHP doesn't support method overloading.
Suppose my class is, kind of a tree, like:
class A { var $children;
function A() { $this->children = array(); }
// I want this to accept both objects and strings etc. // IE. mixed function add($child) { $this->children[] = $child; }
function printStuff() { foreach ($this->children as $child) { if (is_object($child)) $child->printStuff(); else echo $child; } } }
Now this is fine:
1 $obj1 = new A(); 2 $obj2 = new A(); 3 $obj1->add("Something"); 4 $obj2->add(", something else"); 5 $obj1->add($obj2); 6 $obj1->printStuff();
and prints out "something, something else"
But if I swap lines 4 and 5 it only prints out "something". Obviously, the add method of $obj1 only receives a copy of $obj2, and if I try to add something to $obj2 afterwards, even thought it's supposed to be hooked with $obj1, it will "disappear".
For objects only I could solve this with declaring add() like: function add(&$child) { $this->children[] = $child; } So it receives a reference of the object, but then I can't add a string (fatal error, cannot pass string as reference), or an integer or double, for that matter! And I really don't want to use different method names!
I don't have full control over the reference stuff in PHP, does anyone know how I can fix this? Or a workaround?
Thanx!
attached mail follows:
I think you are going to have to live with it.
Functional overloading only really makes sense in strongly typed languages, and I bet is a bugger to implement in a name based scripting language so I don't think you are goign to get it.
What I have sometimes wished for was that all objects and arrays were passed around as pointers by default, with the ability to create a copy when required, but that is such a fundamental change that I doubt if it will happen, and there are probably goo reasons not to ( have I ever told people how much I like Python ... )
Maybe you are just going to have to bite the bullet and have an "AddRef" method......
At 04:28 17/10/2001 +0200, SafeV wrote:
>Someone, have a go at this!
>
>I have encountered a very troublesome problem, which I don't see how to
>solve in an elegant way, since PHP doesn't support method overloading.
>
>Suppose my class is, kind of a tree, like:
>
>class A {
> var $children;
>
> function A() {
> $this->children = array();
> }
>
> // I want this to accept both objects and strings etc.
> // IE. mixed
> function add($child) {
> $this->children[] = $child;
> }
>
> function printStuff() {
> foreach ($this->children as $child) {
> if (is_object($child))
> $child->printStuff();
> else
> echo $child;
> }
> }
>}
>
>Now this is fine:
>
>1 $obj1 = new A();
>2 $obj2 = new A();
>3 $obj1->add("Something");
>4 $obj2->add(", something else");
>5 $obj1->add($obj2);
>6 $obj1->printStuff();
>
>and prints out "something, something else"
>
>But if I swap lines 4 and 5 it only prints out "something".
>Obviously, the add method of $obj1 only receives a copy of $obj2, and
>if I try to add something to $obj2 afterwards, even thought it's supposed
>to be hooked with $obj1, it will "disappear".
>
>For objects only I could solve this with declaring add() like:
>function add(&$child) {
> $this->children[] = $child;
>}
>So it receives a reference of the object, but then I can't add a string
>(fatal error, cannot pass string as reference), or an integer or double,
>for that matter! And I really don't want to use different method names!
>
>I don't have full control over the reference stuff in PHP, does anyone
>know how I can fix this? Or a workaround?
>
>Thanx!
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
>For additional commands, e-mail: php-general-help
lists.php.net
>To contact the list administrators, e-mail: php-list-admin
lists.php.net
-------------------------
Brian White
Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy
Phone: +612-93197901
Web: http://www.steptwo.com.au/
Email: bwhite
steptwo.com.au
attached mail follows:
If I have
100|SomeName|AnotherName|45
Is there an easy way to parse the data in an array or whatever - I mean to have something like this:
100 in var1 SomeName in var2 Anothername in var3 45 in var4
Thanks,
attached mail follows:
On Wed, 17 Oct 2001 13:12, Kal Amry wrote: > If I have > > 100|SomeName|AnotherName|45 > > Is there an easy way to parse the data in an array or whatever - I mean > to have something like this: > > 100 in var1 > SomeName in var2 > Anothername in var3 > 45 in var4 > > Thanks,
explode()
-- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIAGeneral stupidity error reading drive C:
attached mail follows:
list($var1, $var2, $var3, $var4) = explode("|", "100|SomeName|AnotherName|45");
David Robley wrote:
> On Wed, 17 Oct 2001 13:12, Kal Amry wrote: > >>If I have >> >>100|SomeName|AnotherName|45 >> >>Is there an easy way to parse the data in an array or whatever - I mean >>to have something like this: >> >>100 in var1 >>SomeName in var2 >>Anothername in var3 >>45 in var4 >> >>Thanks, >> > > explode() > >
attached mail follows:
Tell you what, it worked pretty well as I wanted.
Thanks,
"Trygve Aasjord" <trygve
webtraders.no> wrote in message
news:3BCD0816.6000304
webtraders.no...
> list($var1, $var2, $var3, $var4) =
> explode("|", "100|SomeName|AnotherName|45");
>
> David Robley wrote:
>
> > On Wed, 17 Oct 2001 13:12, Kal Amry wrote:
> >
> >>If I have
> >>
> >>100|SomeName|AnotherName|45
> >>
> >>Is there an easy way to parse the data in an array or whatever - I mean
> >>to have something like this:
> >>
> >>100 in var1
> >>SomeName in var2
> >>Anothername in var3
> >>45 in var4
> >>
> >>Thanks,
> >>
> >
> > explode()
> >
> >
>
attached mail follows:
Hello all
I have just compiled and installed Apache 1.3.22 (with module support) onto a freshly installed Red Hat 7.1. I have also compiled and installed PHP 4.0.6.
I have edited the httpd.conf script so that PHP parses .php files and also loads the PHP module like this:
# Example: # LoadModule foo_module libexec/mod_foo.so LoadModule php4_module libexec/libphp4.so
However, when I check the configuration file with
/usr/local/apache/bin/apachectl configtest
I get the following error message:
Syntax error on line 205 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/libexec/libphp4.so into server: /usr/local/apache/libexec/libphp4.so: undefined symbol: uncompress
Likewise, when I try to start Apache, I get the same error message. This message does not make sense to me :-(
Line 205 is the LoadModule line above.
I have installed this combination of web server and PHP many times on many different servers, but have never come across that particular error message.
Would someone be able to explain to me what is going on and how I can successfully load the libphp4.so module?
Thank you very much in advance
Stefen Lars
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]