|
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: Mon Oct 15 2001 - 12:59:08 CDT
php-general Digest 15 Oct 2001 17:59:08 -0000 Issue 936
Topics (messages 71065 through 71122):
Referer URL...
71065 by: Sebastian Hardung
71068 by: _lallous
71074 by: _lallous
This is my second work :)
71066 by: Arash Dejkam
71069 by: _lallous
71070 by: Philip Olson
Re: Only 1 Query Result...help.
71067 by: _lallous
71117 by: Chris Cocuzzo
71118 by: Philip Olson
Re: how to do a search in mysql database for multiple keywords??
71071 by: _lallous
71093 by: Mike Patton
Re: PHP Quesiotion
71072 by: _lallous
Re: Anything like Perl's
_ in PHP?
71073 by: _lallous
time();
71075 by: Rudi Ahlers
71076 by: Dave Watkinson
71077 by: Andrey Hristov
Re: How to print the registered session variables??
71078 by: * R&zE:
71079 by: ArsenKirillov
71082 by: Andrey Hristov
Re: can I rely on $PHP_SELF ???
71080 by: ArsenKirillov
71086 by: Matt Williams
urlencode: necessary for email as parameter?
71081 by: Tom Churm
Re: MySQL resource
71083 by: Toke Herkild
71084 by: Andrey Hristov
71103 by: DL Neil
Re: Back & Forward???
71085 by: De Necker Henri
71087 by: _lallous
increment hours
71088 by: Rosen
71089 by: Andrey Hristov
71090 by: Toke Herkild
Switch syntax
71091 by: Rudi Ahlers
71092 by: Rudolf Visagie
71095 by: Jon Farmer
A Way to avoid enforced time-outs
71094 by: peterdove7846.ukonline.co.uk
71098 by: _lallous
[Announce] phpOpenTracker 0.9.8 released
71096 by: Sebastian Bergmann
why does trim() remove NUL?
71097 by: John A. Grant
71100 by: _lallous
Dynamic Forms
71099 by: Rudi Ahlers
71105 by: Jon Haworth
Oracle query with one returned record
71101 by: J. Anderson Scarbrough
71102 by: Dave Watkinson
71104 by: Taylor, Stewart
Sub routines in php
71106 by: Harpreet
71107 by: Jack Dempsey
71108 by: Henrik Hansen
CACHE
71109 by: Power Programmer
71122 by: Tom Carter
fread() considerations - used to be PHP Quesiotion
71110 by: DL Neil
protect files and view temporary
71111 by: Jan Grafström
71121 by: Emile Bosch
dlls
71112 by: shi
71120 by: Emile Bosch
Re: PHP-XML problem
71113 by: Jan Grafström
Some kind of checksum
71114 by: Boget, Chris
71119 by: Emile Bosch
Re: testing an email address
71115 by: ~~~i LeoNid ~~
Re: protecting your php code from other peeping toms?
71116 by: ~~~i LeoNid ~~
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:
Hi there,
ive got a problem ( surprise surprise )
I have a Website (a) and a php site (b) the Problem is :
I want to set an automatic redirect on site (a) and want to get the referer
URL on site (b).
If the connection between a and b would be a normal Link, i could get it
wirh $HTTP_REFERER, but the variable stays empty with a http redirect like :
<meta http-equiv="Refresh" content="0; url=b.php">
Anyone got a solution ?
Sebastian Hardung
attached mail follows:
try the JavaScript redirection:
<body onload='location = "b.php"'>
</body>
"Sebastian Hardung" <Hardung
itb-web.de> wrote in message
news:20011015055013.17378.qmail
pb1.pair.com...
>
> Hi there,
> ive got a problem ( surprise surprise )
>
> I have a Website (a) and a php site (b) the Problem is :
> I want to set an automatic redirect on site (a) and want to get the
referer
> URL on site (b).
> If the connection between a and b would be a normal Link, i could get it
> wirh $HTTP_REFERER, but the variable stays empty with a http redirect like
:
> <meta http-equiv="Refresh" content="0; url=b.php">
> Anyone got a solution ?
>
> Sebastian Hardung
>
>
attached mail follows:
Well the previous method doesn't work too...I can only think of this working
solution at the moment:
The auto submit method...(also javascript)
a.htm
-----
<html>
<head>
<title>New Document</title>
</head>
<body>
<a href='b.php'>b.php</a><br>
<a href='#' onclick='location ="b.php";'>auto redir</a><br>
<a href='#' onclick='document.f1.submit();'>auto submit</a><br>
<form action='b.php' name='f1' method='post'></form>
</body>
</html>
b.php
-------
<body>
<?
echo $HTTP_REFERER;
?>
<br>
<a href='#' onclick='history.go(-1);'>back</a>
</body>
"_lallous" <elias_bachaalany
yahoo.com> wrote in message
news:20011015063542.32928.qmail
pb1.pair.com...
> try the JavaScript redirection:
>
> <body onload='location = "b.php"'>
> </body>
>
>
> "Sebastian Hardung" <Hardung
itb-web.de> wrote in message
> news:20011015055013.17378.qmail
pb1.pair.com...
> >
> > Hi there,
> > ive got a problem ( surprise surprise )
> >
> > I have a Website (a) and a php site (b) the Problem is :
> > I want to set an automatic redirect on site (a) and want to get the
> referer
> > URL on site (b).
> > If the connection between a and b would be a normal Link, i could get it
> > wirh $HTTP_REFERER, but the variable stays empty with a http redirect
like
> :
> > <meta http-equiv="Refresh" content="0; url=b.php">
> > Anyone got a solution ?
> >
> > Sebastian Hardung
> >
> >
>
>
attached mail follows:
Hi,
Some of you may remeber my first serious work (www.saharafilm.org) which I
introduced here for critic, and I received very useful replies from you.
This is my second : http://www.dejkam.com
It have much more different things to be criticised on it.
hope to learn good tips from you like my previous experience :)
Thanks
Arash Dejkam
attached mail follows:
Nice work!
greetings from Lebanon,
"Arash Dejkam" <arash
dejkam.f2s.com> wrote in message
news:20011015061358.23769.qmail
pb1.pair.com...
> Hi,
>
> Some of you may remeber my first serious work (www.saharafilm.org) which I
> introduced here for critic, and I received very useful replies from you.
>
> This is my second : http://www.dejkam.com
> It have much more different things to be criticised on it.
>
> hope to learn good tips from you like my previous experience :)
>
> Thanks
> Arash Dejkam
>
>
attached mail follows:
Hi Arash-
It's not a good idea to ask php lists for a website critique, imagine if
all list members did that! Please consider other means in evaluating your
sites.
Sure it may have worked in the past but that's a bad precedent to set.
Members of these lists are helpful, sometimes too helpful ;-)
Regards,
Philip Olson
On Mon, 15 Oct 2001, Arash Dejkam wrote:
> Hi,
>
> Some of you may remeber my first serious work (www.saharafilm.org) which I
> introduced here for critic, and I received very useful replies from you.
>
> This is my second : http://www.dejkam.com
> It have much more different things to be criticised on it.
>
> hope to learn good tips from you like my previous experience :)
>
> Thanks
> Arash Dejkam
>
>
>
> --
> 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:
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
attached mail follows:
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
>
attached mail follows:
> 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
>
attached mail follows:
describe your question more...
anyway:
SELECT thetext FROM thetable WHERE
(INSTR(thetext, 'keyword1') <> 0) OR
(INSTR(thetext, 'keyword2') <> 0) OR
(INSTR(thetext, 'keyword3') <> 0);
this will search for either of the three keywords...
"Nicklas Bondesson" <nicke
najki.nu> wrote in message
news:20011013133802.49776.qmail
pb1.pair.com...
> need some help on this. i've come so far that i have split up the variable
> with explode and putting it into an array that looks like this:
> 'keyword1','keyword2'.
>
> but it doesn't doesn't work satisfactory...
>
> any ideas??
>
> /nicke
>
>
attached mail follows:
Another solution would also be to use the FULLTEXT functions availble in
MySQL... it is by far faster than this query. To do so, your fields must be
of type VARCHAR and TEXT. Then create a FULLTEXT index on these fields by
issuing the following command:
ALTER TABLE <tablename> ADD FULLTEXT(<column1>,<column2>,<ccolumn3>)
Then your query would look like:
SELECT *, MATCH(<field1>,<field2>,<field3> ) AGAINST ('$qiery' ) AS score
FROM Messages WHERE MATCH( <field1>,<field2>,<field3> ) AGAINST ( '$query'
) ORDER BY score DESC;
This would return the results in order of relevance... works pretty good :)
-- ------------------------------------------------------------------------ James "Mike" Patton \ Professional web applications developer mpattonacuitymedia.com \ Specializing in PERL, MySQL, PHP and JAVA ------------------------------------------------------------------------
On 2001.10.15 03:42 _lallous wrote: > describe your question more... > anyway: > > SELECT thetext FROM thetable WHERE > (INSTR(thetext, 'keyword1') <> 0) OR > (INSTR(thetext, 'keyword2') <> 0) OR > (INSTR(thetext, 'keyword3') <> 0); > > this will search for either of the three keywords... > > "Nicklas Bondesson" <nicke
najki.nu> wrote in message > news:20011013133802.49776.qmail
pb1.pair.com... > > need some help on this. i've come so far that i have split up the > variable > > with explode and putting it into an array that looks like this: > > 'keyword1','keyword2'. > > > > but it doesn't doesn't work satisfactory... > > > > any ideas?? > > > > /nicke > > > > > > > > -- > 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:
you can fopen() it
$fp = fopen('http://www.somehost.com/somescript.php?someparam=somevalue'); $content = ''; while (!feof($fp)) { $content .= fread($fp, 4096); } fclose($fp);
echo $content;
"Georgie Casey" <webmaster
filmfind.tv> wrote in message
news:20011013131830.40575.qmail
pb1.pair.com...
> How do I activate a rempote script from within my own script?
> I cant connect through sockets or that other way
>
> --
> Regards,
> Georgie Casey
> webmaster
filmfind.tv
>
> ***************************
> http://www.filmfind.tv
> Ireland's Online Film Production Directory
> ***************************
>
>
attached mail follows:
you could have used arrays too,
function test($params) { while (list($key, $value) = each($params)) { if (is_string($params[$key])) ....; if (is_float($params[$key])) ....; } }
test(array('string', 1234, 111.1111));
"Dana Holt" <danah
home.com> wrote in message
news:000301c153ba$f4d31060$6400a8c0
MORPHEUS...
>
> There it is, looks like I missed that one.
>
> You know what's ironic? I'm wearing a shirt that has "RTFM" in big letter
> across the front! DOH!
>
> Well, it's pretty late here, early, whatever you like to call it. Maybe I
> can blame it on that.
>
> Thanks.
>
>
> -----Original Message-----
> From: Jason Brooke [mailto:jason
qgl.org]
> Sent: Saturday, October 13, 2001 2:36 AM
> To: Dana Holt; PHP Mailing List (E-mail)
> Subject: Re: [PHP] Anything like Perl's
_ in PHP?
>
> > Is there an easy way to read in all the parameters passed to a function
in
> > the order they were passed? Just like
_ in Perl?
> >
> > I am building a custom POST header and that sure would make my life
> easier!
> >
> > Thanks in advance.
> >
> > Dana
>
>
> Tried the manual? :)
>
> http://www.php.net/manual/en/ref.funchand.php
>
> jason
>
>
>
>
attached mail follows:
HI
I would like to have a better way of displaying time. I got a form, which is being submitted via email, and I have it display the time it's being submitted, but time() displays it as 1003130482 Is there a way of displaying the time as: Saturday, October 13, 2001 at 12:44:25 ? But I don't want any jscript for that :)
Thanx Rudi Ahlers
attached mail follows:
http://www.php.net/manual/en/function.date.php
-----Original Message-----
From: Rudi Ahlers [mailto:kopspier
bigfoot.com]
Sent: 15 October 2001 08:45
To: PHP General
Subject: [PHP] time();
HI
I would like to have a better way of displaying time. I got a form, which is being submitted via email, and I have it display the time it's being submitted, but time() displays it as 1003130482 Is there a way of displaying the time as: Saturday, October 13, 2001 at 12:44:25 ? But I don't want any jscript for that :)
Thanx Rudi Ahlers
attached mail follows:
strftime() gmstrftime()
-- Andrey Hristov Web Developer IcyGEN Corporation BALANCED SOLUTIONS http://www.icygen.comOn Monday 15 October 2001 10:44, you wrote: > HI > > I would like to have a better way of displaying time. I got a form, which > is being submitted via email, and I have it display the time it's being > submitted, but time() displays it as 1003130482 Is there a way of > displaying the time as: > Saturday, October 13, 2001 at 12:44:25 ? > But I don't want any jscript for that :) > > Thanx > Rudi Ahlers
attached mail follows:
<Original message>
From: Balaji Ankem <balaji.ankem
wipro.com>
Date: Mon, Oct 15, 2001 at 11:14:03AM +0530
Message-ID: <011601c1553c$67b071e0$1702910a
wipro.com>
Subject: [PHP] How to print the registered session variables??
> Hi, > I have registered two session variables with the names user and pw. > > Please tell me how to print those session vars?? > > Is it needed to call session_register("varname") before printing the > session variable "varname"?? > > Thanks and regards > -Balaji
</Original message>
<Reply>
Hi there :)
It all depends... If you're on a next/different page then where you've 'started' the session-vars you first have to call session_start(). After that you can either do:
print ($varname); or (better): print ($HTTP_SESSION_VARS["varname"]);
If you're still on the same page as where you 'start' the session-vars, there are two ways:
First register the variables (otherwise they're not session-vars), and then you can print them in two ways:
session_register ("varname");
and then: print ($varname); or (better): print ($HTTP_SESSION_VARS["varname"]);
The other way is (when you're still on the same page) to not use them as session-vars at all (ofcourse depending on what you want to do with 'm). Then they're still just normal vars ;) :
print ($varname);
If you want to check which session-vars you have available do:
print_r ($HTTP_SESSION_VARS); or (more info): var_dump ($HTTP_SESSION_VARS);
Ofcourse you need to call session_start() before this...
</Reply>
--* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze
datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««
attached mail follows:
-----Original Message-----
From: Balaji Ankem [mailto:balaji.ankem
wipro.com]
Sent: Monday, October 15, 2001 7:44 AM
To: php-general
lists.php.net
Subject: How to print the registered session variables??
Hi, I have registered two session variables with the names user and pw.
Please tell me how to print those session vars??
Is it needed to call session_register("varname") before printing the session variable "varname"??
Thanks and regards -Balaji -----
1.$a=get_defined_vars 2. for (session_is_registered($a[$i])) echo ... Just an idea ...
attached mail follows:
I think it is $HTTP_SESSION_VARS[]
session_register have to be invoked only once - when you place the variable in the session jar :))).
-- Andrey Hristov Web Developer IcyGEN Corporation BALANCED SOLUTIONS http://www.icygen.comOn Monday 15 October 2001 12:37, you wrote: > -----Original Message----- > From: Balaji Ankem [mailto:balaji.ankem
wipro.com] > Sent: Monday, October 15, 2001 7:44 AM > To: php-general
lists.php.net > Subject: How to print the registered session variables?? > > > Hi, > I have registered two session variables with the names user and pw. > > Please tell me how to print those session vars?? > > Is it needed to call session_register("varname") before printing the > session variable "varname"?? > > Thanks and regards > -Balaji > ----- > > 1.$a=get_defined_vars > 2. for (session_is_registered($a[$i])) echo ... > Just an idea ...
attached mail follows:
lists.php.net > Subject: Re: [PHP] can I rely on $PHP_SELF ???
> > >where AutenticaAdmin() will authenticate the admin and if > > >successfull > > >redirect to $PHP_SELF (the file trying to be accessed)... the > > >question is: > > >is $PHP_SELF reliable for this? Cuz I remember my first Apache > > >configuration ever (I mean the first... total disaster)... and > > >$PHP_SELF > > >returned something very weird like '/php/php.exe/dir/file.php'... > > > > > >so my question is... will $PHP_SELF allways work or some servers > > >will give > > >me eerie info??? > > > >The problem is is PHP is installed as cgi. > > > >You can either use $SCRIPT_NAME or basename($PHP_SELF) bad. What about path ?
> > but I need the entire path to the file... not just the filename... that's > the problem... > > and I think you answered my question... so if PHP is installed as CGI, > PHP_SELF doesn't work?
attached mail follows:
> bad. What about path ? >
What about path??
That wasn't listed as an original requirement.
ok use substr or str_replace to remove the /php/php.exe bit.
M
attached mail follows:
hi,
i need to pass email addresses through links as parameters.
for example: link.com?email=my.name
somedomain.com
in order to avoid problems, is it necessary that i use urlenclode($email_string), or all of the characters that are allowed in an email address safe to pass along without using urlencode?
mucho gracias,
tom
attached mail follows:
Toke Herkild: If: mysql_query($Result) returns either '1' or 'Resource #ID?' and as far as I've found oout if it does not find data at all it returns '2' then the correct if clause would be : if ((mysql_query()>0) and (mysql_query() != 2)){ do stuff }
correct my if I'm wrong...
David Otton : It appears that it can be an int in some situations. I guess I'd have to check source code to be certain, but...
if I do this :
echo(mysql_query("SELECT ...."));
I get 'Resource id#4' echoed, while if I do this :
echo(mysql_query("INSERT ...."));
I get a straight '1'.
The '1' is returned when you do an UPDATE/INSERT/DELETE, and the 'Resource id' when you do a select. It's a nasty one, but it is documented (kinda) in the manual pages for mysql_affected_rows(). So
attached mail follows:
mysql_query returns an integer resource ID >0 so I think #2 is good as #1....if var_dump returns "int(1)" instead of "resource id...." you have a problem somewhere in your code.
-- Andrey Hristov Web Developer IcyGEN Corporation BALANCED SOLUTIONS http://www.icygen.comOn Monday 15 October 2001 11:52, you wrote: > Toke Herkild: > If: > mysql_query($Result) returns either '1' or 'Resource #ID?' and as far as > I've found oout if it does not find data at all it returns '2' then the > correct if clause would be : > if ((mysql_query()>0) and (mysql_query() != 2)){ do stuff } > > correct my if I'm wrong... > > > David Otton : > It appears that it can be an int in some situations. I guess I'd have > to check source code to be certain, but... > > if I do this : > > echo(mysql_query("SELECT ....")); > > I get 'Resource id#4' echoed, while if I do this : > > echo(mysql_query("INSERT ....")); > > I get a straight '1'. > > The '1' is returned when you do an UPDATE/INSERT/DELETE, and the > 'Resource id' when you do a select. It's a nasty one, but it is > documented (kinda) in the manual pages for mysql_affected_rows(). So
attached mail follows:
> Toke Herkild: > If: > mysql_query($Result) returns either '1' or 'Resource #ID?' and as far as > I've found oout if it does not find data at all it returns '2' then the > correct if clause would be : > if ((mysql_query()>0) and (mysql_query() != 2)){ do stuff } > > correct my if I'm wrong...
Toke, May I have (another) turn at this one? (please accept a cut-and-paste from teaching notes - sorry, no diagrams)
The MySQL query function can (broadly speaking) be used in one of two 'modes': to push data into a db or to pull it out. Borrowing David Otton's notation: mysql_query("INSERT ....") and mysql_query("SELECT ...."). In PHP:
$result = mysql_query( $query, $dbLinkId );
Once the query is run, you want to check if the data was successfully 'written' in the first mode; but will also need to view the extracted data in the second. Big difference! Accordingly with PHP/MySQL there is NO one 'rule' for both situations (and this is the trap in our thinking that many of us walk smack into). The return 'value' from the query function will vary according to the 'mode' of use.
Let's start with the logical/boolean stuff - did the query work or not:-
Referring to the manual (http://www.php.net/manual/en/function.mysql-query.php) we read: <<mysql_query() returns TRUE (non-zero) or FALSE to indicate whether or not the query succeeded. A return value of TRUE means that the query was legal and could be executed by the server. It does not indicate anything about the number of rows affected or returned. It is perfectly possible for a query to succeed but affect no rows or return no rows.>> It then goes on to give two examples of queries that will return FALSE on the grounds of syntax or semantic error. Perhaps the most important 'other' reason why a query might fail at this point is the matter of privileges/permissions.
We're error checking, so I find it helpful to be a pessimist (one who expects the worst) - I ignore the 'TRUE' bit totally (***) and concentrate on the negative:
if ( FALSE == $result ) { ...something went wrong, better deal with it... } or even if ( FALSE === $result ) - yes I can be more than pedantic!
Alternatively on the query statement make use of the ternary operator:
$result = mysql_query( ...etc... ) or die( ... ) ;
(***) Just quickly: why do I ignore 'TRUE'? It is after all, something of an abuse of the definition of logical typing. As the manual hints: "returns TRUE (non-zero)" - emphasis on the parenthesised words. ie if ( TRUE === $result ) will ALWAYS fail - in this case the opposite of FALSE is not necessarily TRUE!
At this stage, assuming the answer was not FALSE, we know that MySQL was happy with us, the interface between PHP and MySQL worked, and the SQL query was understandable (if only to MySQL). Now it's worth taking a look at what actually happened:
In the 'first mode' we want to store some data in the database. Because the PHP script has spent some effort prior to this moment assembling the 'parcel' of data being INSERTed, UPDATEed, REPLACEd, or DELETEd (think of the latter as a 'minus-addition' for the sake of my story!), you should have a fair idea of how many tuples/records/rows of data are in the 'parcel'. Accordingly the check is:
$CheckCount = mysql_affected_rows( $dbLinkId );
Thus if you intended to INSERT five new rows into the db, $CheckCount had better be five! NB There are a few 'tricks and traps' on this when UPDATE-ing etc, but those are discussed on the other/appropriate manual page!
Another little 'hang up' that catches some, is that the query may have worked - and therefore not have returned FALSE (above), and yet the number of rows affected could still be zero, eg attempting to UPDATE rows that do not exist in the db. There is a difference between being semantically correct (according to MySQL) and what happens when the command is executed against the live dataset!
To be sure, one of the 'tricks' is that if there was something wrong with the earlier query statement, $CheckCount will be set to -1, and so some might argue that this renders the TRUE/FALSE check (first stage, above) slightly unnecessary (if only in certain situations!). I disagree (but then we've already established that I can be pedantic!) particularly if the query statement has been assembled dynamically within the PHP script - and 'in spades' if the script assembles it in part from user data. There's always room for error, even for super-coders like us...
Notice that I haven't mentioned $result here!? This is because it is 'officially' irrelevant (for reasons discussed in a moment). However if you take a look at it, it seems to be an integer value - and thus the observations you made in your most recent post. [I've never looked, but is it an abbreviated form of the "Resource..." format, or is it the answer to the affected_rows question, or something else?]
A final warning: MySQL gives you this information as a 'one time only offer'. It must be inspected/used BEFORE any other operation is conducted against that database (because it uses the db link)!
Now let's get excited! In the 'second mode' we're retrieving data from the db. Accordingly the return 'value' from mysql_query() must somehow contain far more information than 'did it work?' and 'how many rows were affected?' - we want all of that AND the retrieved data itself (recordset). OK, at this point we know that the syntax and meaning of the query were 'understood' by MySQL. So how many rows are in this kind of recordset?
$RowCount = mysql_num_rows( $result )
NB mysql_num_rows looks at the recordset ($result) whereas mysql_affected_rows looked at the db link! Unfortunately the manual refers to both of our $result and $dbLinkId using the terminology of "link" or "resource link" which is another potential point of confusion on these topics (although the manual's terminology is quite correct).
The PHP script will now go on to use $RowCount to control a loop that manages the processing of each tuple/record/row in the resultset/recordset, through the data retrieval functions, eg mysql_fetch_assoc, mysql_fetch_array, etc. The various fetch functions all require the resultset/recordset ($result) as an argument. This is NOT because it contains the data, as such. It is but a 'label' for the data. It is used to locate the data, and the fetch functions maintain internal pointers to keep track of how many of the records/fields have been processed thus far, and whether there are any more left (eof/end of file). These 'internal pointers' are analogous to those used in array processing.
NB each of the fetch functions refers to $result to find the next (if any) row value(s) - not the db link! This is logical, because if you think about it, you could have multiple mysql_query("SELECT ....")-s, on the go, at any one time. Indeed the second may be a query on a result from the first (sub-query structure), eg an order record retrieved from the ORDERS table likely points to a particular CUSTOMER table record.
Again referring back to your recent post, in this 'mode' the $result field's literal contents are "Resource #IDn", and as such of little use to us, but very much required by the fetch functions as a 'label' for the recordset.
Hope it helps (sorry if some of it is more introductory than you rate), (invitation: I'm always keen to get feedback on my teaching notes!) =dn
attached mail follows:
hi i want to read entries back & forward in my MYSQL db using rows because i dont have a Number column. Can this be done? I used COUNT(*) in my SQL statement to get the max rows. What can i use to read rows backwards or forwards in my table?
Hoender
attached mail follows:
check the LIMIT syntax in the MySql docs.
"De Necker Henri" <deNeckerH
ford.co.za> wrote in message
news:3A8ED7A62794D311AA7700508B6164EC08DCA30E
SCPTS01...
> hi
> i want to read entries back & forward in my MYSQL db using rows because i
> dont have
> a Number column.
> Can this be done?
> I used COUNT(*) in my SQL statement to get the max rows.
> What can i use to read rows backwards or forwards in my table?
>
> Hoender
attached mail follows:
Hi, how can I increment hours in time variable ( i.e. with 3 hours ) ?
Thanks, Rosen
attached mail follows:
$var+=3*3600;//if timestamp
-- Andrey Hristov Web Developer IcyGEN Corporation BALANCED SOLUTIONS http://www.icygen.comOn Monday 15 October 2001 14:42, you wrote: > Hi, > how can I increment hours in time variable ( i.e. with 3 hours ) ? > > Thanks, > Rosen
attached mail follows:
Toke herkild: It could be done like :
$Time = Time(); // sets time $Time = Time+(3*60*60); // sets time + 3 hours
The idea is that Time is counted in seconds since 1.1.1970 which leads us to: second*minutes*amount_of_hours_to_add 60 secunds = 1 minute. 60 minutes = 1 hour
"Rosen" <rosen_dm
dir.bg> skrev i en meddelelse
news:20011015114355.55449.qmail
pb1.pair.com...
> Hi,
> how can I increment hours in time variable ( i.e. with 3 hours ) ?
>
> Thanks,
> Rosen
>
>
attached mail follows:
Hi
I wonder if this is possible, and if it is, what am I doing wrong? I got a form, with either debit order details, or credit card details, both on the same form. But I have put the select box, the debit order form, and the credit card form in one file, and then users select it with an if statement, and it's then called with functions. This all works very well with: if ($Payment = 'Debit') { debit(); } elseif ($Payment = 'Credit') { credit(); } else { select();
Now, I email the form to sales department, but I want the output to differ, depending on whether they selected debit order or credit card. I tried the following, bit it didn't seem to work.
function bank_details() { switch ($Payment) { case "Debit": debitorder(); break; case "Credit"; creditcard(); break; }
function debitorder() { $bank_details = "AccountHolders Name: $account_holders_name\n"; $bank_details .= "Account Number: $account_number\n"; $bank_details .= "Bank Name: $bank_name\n"; $bank_details .= "Branch Name: $Branch_name\n"; $bank_details .= "Branch Number: $branch_number\n"; $bank_details .= "Branch Number: $branch_number\n"; }
function creditcard() { $bank_details = "Card Holder: $CardHolder\n"; $bank_details .= "Card Number: $CardNumber\n"; $bank_details .= "CvvNumber: $CvvNumber\n"; $bank_details .= "CardType: $CardType\n"; $bank_details .= "CardMonth: $CardMonth\n"; $bank_details .= "CardYear: $CardYear\n"; } }
I call bank_details() as follows:
$content .="Firstname: $first_name\n Lastname: $last_name\n ID Number: $your_id_number\n Company Name: $company\n Postal Address: $postal_address_1\n Postal Address2: $postal_address_2\n Postal code: $postal_code\n Email: $email\n Work Phone: $work_phone_number\n Work Code: $work_phone_number_code\n Home Phone: $phone_home\n Home Code: $phone_home_code\n Faxn Nmber: $fax_number\n Fax Code: $fax_number_code\n Cell: $phone_cell\n Domain Name: $domain_name\n Hosting Option: $Hosting_option\n Upload Option: $Upload_option\n Application Description: $ApplicationDesc\n $bank_details $reseller Agreed: $agreed_with_the_terms_and_conditions\n";
It doesn't seem to display the bank detail though, on either form. Is there anyway of getting this done?
Regards Rudi Ahlers
attached mail follows:
Try case "Credit": (colon) instead of case "Credit";
Rudolf Visagie
rudolf
dhsolutions.co.za
-----Original Message-----
From: Rudi Ahlers [mailto:kopspier
bigfoot.com]
Sent: 15 October 2001 01:55
To: PHP General
Subject: [PHP] Switch syntax
Hi
I wonder if this is possible, and if it is, what am I doing wrong? I got a form, with either debit order details, or credit card details, both on the same form. But I have put the select box, the debit order form, and the credit card form in one file, and then users select it with an if statement, and it's then called with functions. This all works very well with: if ($Payment = 'Debit') { debit(); } elseif ($Payment = 'Credit') { credit(); } else { select();
Now, I email the form to sales department, but I want the output to differ, depending on whether they selected debit order or credit card. I tried the following, bit it didn't seem to work.
function bank_details() { switch ($Payment) { case "Debit": debitorder(); break; case "Credit"; creditcard(); break; }
function debitorder() { $bank_details = "AccountHolders Name: $account_holders_name\n"; $bank_details .= "Account Number: $account_number\n"; $bank_details .= "Bank Name: $bank_name\n"; $bank_details .= "Branch Name: $Branch_name\n"; $bank_details .= "Branch Number: $branch_number\n"; $bank_details .= "Branch Number: $branch_number\n"; }
function creditcard() { $bank_details = "Card Holder: $CardHolder\n"; $bank_details .= "Card Number: $CardNumber\n"; $bank_details .= "CvvNumber: $CvvNumber\n"; $bank_details .= "CardType: $CardType\n"; $bank_details .= "CardMonth: $CardMonth\n"; $bank_details .= "CardYear: $CardYear\n"; } }
I call bank_details() as follows:
$content .="Firstname: $first_name\n Lastname: $last_name\n ID Number: $your_id_number\n Company Name: $company\n Postal Address: $postal_address_1\n Postal Address2: $postal_address_2\n Postal code: $postal_code\n Email: $email\n Work Phone: $work_phone_number\n Work Code: $work_phone_number_code\n Home Phone: $phone_home\n Home Code: $phone_home_code\n Faxn Nmber: $fax_number\n Fax Code: $fax_number_code\n Cell: $phone_cell\n Domain Name: $domain_name\n Hosting Option: $Hosting_option\n Upload Option: $Upload_option\n Application Description: $ApplicationDesc\n $bank_details $reseller Agreed: $agreed_with_the_terms_and_conditions\n";
It doesn't seem to display the bank detail though, on either form. Is there anyway of getting this done?
Regards Rudi Ahlers
-- 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:
The problemn is with the bank_details function. The $Payment variable does not have global scope Either give it global scope or pass the value of the variable through when calling the function
eg
function bank_details($Payment) {
//function code
}
and call it as
bank_details($Payment);
Regards
jon
-- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send blank email to pgpkeybctech.co.uk
----- Original Message ----- From: "Rudi Ahlers" <kopspier
bigfoot.com> To: "PHP General" <php-general
lists.php.net> Sent: Monday, October 15, 2001 12:54 PM Subject: [PHP] Switch syntax
> Hi > > I wonder if this is possible, and if it is, what am I doing wrong? I got a > form, with either debit order details, or credit card details, both on the > same form. But I have put the select box, the debit order form, and the > credit card form in one file, and then users select it with an if statement, > and it's then called with functions. This all works very well with: > if ($Payment = 'Debit') { > debit(); > } elseif ($Payment = 'Credit') { > credit(); > } else { > select(); > > > Now, I email the form to sales department, but I want the output to differ, > depending on whether they selected debit order or credit card. I tried the > following, bit it didn't seem to work. > > > function bank_details() > { > switch ($Payment) { > case "Debit": > debitorder(); > break; > case "Credit"; > creditcard(); > break; > } > > function debitorder() > { > $bank_details = "AccountHolders Name: $account_holders_name\n"; > $bank_details .= "Account Number: $account_number\n"; > $bank_details .= "Bank Name: $bank_name\n"; > $bank_details .= "Branch Name: $Branch_name\n"; > $bank_details .= "Branch Number: $branch_number\n"; > $bank_details .= "Branch Number: $branch_number\n"; > } > > function creditcard() > { > $bank_details = "Card Holder: $CardHolder\n"; > $bank_details .= "Card Number: $CardNumber\n"; > $bank_details .= "CvvNumber: $CvvNumber\n"; > $bank_details .= "CardType: $CardType\n"; > $bank_details .= "CardMonth: $CardMonth\n"; > $bank_details .= "CardYear: $CardYear\n"; > } > } > > I call bank_details() as follows: > > $content .="Firstname: $first_name\n > Lastname: $last_name\n > ID Number: $your_id_number\n > Company Name: $company\n > Postal Address: $postal_address_1\n > Postal Address2: $postal_address_2\n > Postal code: $postal_code\n > Email: $email\n > Work Phone: $work_phone_number\n > Work Code: $work_phone_number_code\n > Home Phone: $phone_home\n > Home Code: $phone_home_code\n > Faxn Nmber: $fax_number\n > Fax Code: $fax_number_code\n > Cell: $phone_cell\n > Domain Name: $domain_name\n > Hosting Option: $Hosting_option\n > Upload Option: $Upload_option\n > Application Description: $ApplicationDesc\n > $bank_details > $reseller > Agreed: $agreed_with_the_terms_and_conditions\n"; > > It doesn't seem to display the bank detail though, on either form. Is there > anyway of getting this done? > > > Regards > Rudi Ahlers > > > -- > 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:
Hi,
I was having trouble with my mailing list script timing out after 30secs ( enforced and unchangeable by my ISP ). It would start timing out after about 1000 mailings or so.
What I did was create a page which was passed two variables in the URL. One was a start row and the other was a row count. These both referred to the emails in the email table.
Then basically the php script chewed away 50 emails at a time, pasted a refresh Meta tag into the final html document using a refresh of page about 4 secs. It display on the page 'Please do not close your browser emailing clients x of rowcount'. It would then call the script again with the incremented start row and start all over again.
When all rows where complete the script would end and display that it had completed all emails.
Cheers
Peter http://www.mailmeld.com
attached mail follows:
why didn't you use set_time_limit() ?
<peterdove7846
ukonline.co.uk> wrote in message
news:20011015124236.82558.qmail
pb1.pair.com...
> Hi,
>
> I was having trouble with my mailing list script timing out after 30secs (
> enforced and unchangeable by my ISP ). It would start timing out after
about
> 1000 mailings or so.
>
> What I did was create a page which was passed two variables in the URL.
One
> was a start row and the other was a row count. These both referred to the
> emails in the email table.
>
> Then basically the php script chewed away 50 emails at a time, pasted a
> refresh Meta tag into the final html document using a refresh of page
about
> 4 secs. It display on the page 'Please do not close your browser emailing
> clients x of rowcount'. It would then call the script again with the
> incremented start row and start all over again.
>
> When all rows where complete the script would end and display that it had
> completed all emails.
>
> Cheers
>
> Peter
> http://www.mailmeld.com
>
>
attached mail follows:
This release incorporates numerous changes to the internal workings of phpOpenTracker, as well as to its API. Apart from performance improvements, the following features were added: regular expression based locking, a custom session handler, a means to invoke phpOpenTracker through a HTML image tag and the logging of returning visitors. Besides all that, the manual has been rewritten and now features a detailed API documentation.
-- Sebastian Bergmann http://sebastian-bergmann.de/ http://phpOpenTracker.de/Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/
attached mail follows:
Are PHP strings NUL-terminated? If so, why does trim() remove the NUL? After using trim() on a blank line, presumably strlen() will return 0. How does strlen() work, if the NUL has been removed?
-- John A. Grant * I speak only for myself * (remove 'z' to reply) Radiation Geophysics, Geological Survey of Canada, Ottawa If you followup, please do NOT e-mail me a copy: I will read it here
attached mail follows:
I guess if strlen() fails it returns 0 and if string has no length then it also returns zero.
I don't think PHP's strings are zero terminated.
$str = "abc\xab\x00defgh"; echo $str; outputs: abc½ defgh
and doesn't truncate the string.
"John A. Grant" <jazrant
zsc.nrcan.zc.ca> wrote in message
news:20011015133545.8434.qmail
pb1.pair.com...
> Are PHP strings NUL-terminated? If so, why does trim()
> remove the NUL? After using trim() on a blank line, presumably
> strlen() will return 0. How does strlen() work, if the NUL has
> been removed?
>
> --
> John A. Grant * I speak only for myself * (remove 'z' to reply)
> Radiation Geophysics, Geological Survey of Canada, Ottawa
> If you followup, please do NOT e-mail me a copy: I will read it here
>
>
>
attached mail follows:
Hi, me again
I have a form, which can either display debit order details, or credit card details. When a user opens the page, he gets a dropdown menu, which gives him the options. If he selects debit order, the debit order form gets displayed, this is all done with if statements, no jscript. This works fine, but with the mail part I have a problem. How would I be able to tell my mail function what to mail, and what not to? When a user clicks on the debit option, it must only email the debit form's details, as the forms differ quite a bit. I tried doing it with a case statement, but with no luck. Can anyone please help me with this?
Thanx Rudi Ahlers
attached mail follows:
Hi,
Something like this? (assumes a form field & variable called "orderType" which will either be "credit" or "debit" -- tweak for your setup)
if (!isset($submit)) { // show form } else { // do validation // do generic stuff that happens for both credit & debit if ($orderType = "debit") { // mail debit card information } elseif ($orderType = "credit") { // mail credit card information } else { // do whatever happens for other types // you could leave this bit out if you caught it at // the validation stage earlier } // show thank you page }
If that doesn't make any sense can you post the code for your form please?
Cheers Jon
-----Original Message-----
From: Rudi Ahlers [mailto:kopspier
bigfoot.com]
Sent: 15 October 2001 14:36
To: PHP General
Subject: [PHP] Dynamic Forms
Hi, me again
I have a form, which can either display debit order details, or credit card details. When a user opens the page, he gets a dropdown menu, which gives him the options. If he selects debit order, the debit order form gets displayed, this is all done with if statements, no jscript. This works fine, but with the mail part I have a problem. How would I be able to tell my mail function what to mail, and what not to? When a user clicks on the debit option, it must only email the debit form's details, as the forms differ quite a bit. I tried doing it with a case statement, but with no luck. Can anyone please help me with this?
Thanx Rudi Ahlers
********************************************************************** 'The information included in this Email is of a confidential nature and is intended only for the addressee. If you are not the intended addressee, any disclosure, copying or distribution by you is prohibited and may be unlawful. Disclosure to any party other than the addressee, whether inadvertent or otherwise is not intended to waive privilege or confidentiality'
**********************************************************************
attached mail follows:
When I have an oracle procedure that returns one and only one row i still find myself looping through the cursor to get the results. is there a better way to accomplish this without writing a loop when you know the loop will only execute once? (code below)
Thanks.
query = "begin pkg.procedure($id, :curs, :errorCode); end;"; //query should return only the details of the $id passed in to proc. $curs = OCINewCursor($connection); $stmt = OCIParse ($connection, $query); OCIBindByName ( $stmt, ":curs", &$curs,-1,OCI_B_CURSOR); OCIBindByName ($stmt, ":errorCode", &$errorCode,10); $result = OCIExecute ($stmt); $result = OCIExecute ($curs); while (OCIFetchInto($curs,$data)) { $companyname = $data[0]; $companyaddress = $data[1]; $companyaddress2 = $data[2]; $companycity = $data[3]; $companystate = ucwords($data[4]); $companypostalcode = $data[5]; $companycountry = ucwords($data[6]); } OCIFreeStatement($stmt); OCIFreeCursor($curs); ?>
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
attached mail follows:
this was the first search result on google for +oracle +php +fetch +row
check out ___Ora_Fetch___
hope it helps
Dave
LX. Oracle functions Table of Contents Ora_Bind - bind a PHP variable to an Oracle parameter Ora_Close - close an Oracle cursor Ora_ColumnName - get name of Oracle result column Ora_ColumnSize - get size of Oracle result column Ora_ColumnType - get type of Oracle result column Ora_Commit - commit an Oracle transaction Ora_CommitOff - disable automatic commit Ora_CommitOn - enable automatic commit Ora_Do - Parse, Exec, Fetch Ora_Error - get Oracle error message Ora_ErrorCode - get Oracle error code Ora_Exec - execute parsed statement on an Oracle cursor Ora_Fetch - fetch a row of data from a cursor Ora_Fetch_Into - Fetch a row into the specified result array Ora_GetColumn - get data from a fetched column Ora_Logoff - close an Oracle connection Ora_Logon - open an Oracle connection Ora_pLogon - Open a persistent Oracle connection Ora_Numcols - Returns the number of columns Ora_Numrows - Returns the number of rows Ora_Open - open an Oracle cursor Ora_Parse - parse an SQL statement Ora_Rollback - roll back transaction
-----Original Message-----
From: J. Anderson Scarbrough [mailto:jebscarbrough
hotmail.com]
Sent: 15 October 2001 14:57
To: php-general
lists.php.net
Subject: [PHP] Oracle query with one returned record
When I have an oracle procedure that returns one and only one row i still find myself looping through the cursor to get the results. is there a better way to accomplish this without writing a loop when you know the loop will only execute once? (code below)
Thanks.
query = "begin pkg.procedure($id, :curs, :errorCode); end;"; //query should return only the details of the $id passed in to proc. $curs = OCINewCursor($connection); $stmt = OCIParse ($connection, $query); OCIBindByName ( $stmt, ":curs", &$curs,-1,OCI_B_CURSOR); OCIBindByName ($stmt, ":errorCode", &$errorCode,10); $result = OCIExecute ($stmt); $result = OCIExecute ($curs); while (OCIFetchInto($curs,$data)) { $companyname = $data[0]; $companyaddress = $data[1]; $companyaddress2 = $data[2]; $companycity = $data[3]; $companystate = ucwords($data[4]); $companypostalcode = $data[5]; $companycountry = ucwords($data[6]); } OCIFreeStatement($stmt); OCIFreeCursor($curs); ?>
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
-- 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:
if (!OCIFetchInto($curs,$data))) { // not found } else { $companyname = $data[0]; $companyaddress = $data[1]; $companyaddress2 = $data[2]; $companycity = $data[3]; $companystate = ucwords($data[4]); $companypostalcode = $data[5]; $companycountry = ucwords($data[6]); }
-----Original Message-----
From: J. Anderson Scarbrough [mailto:jebscarbrough
hotmail.com]
Sent: 15 October 2001 14:57
To: php-general
lists.php.net
Subject: [PHP] Oracle query with one returned record
When I have an oracle procedure that returns one and only one row i still find myself looping through the cursor to get the results. is there a better way to accomplish this without writing a loop when you know the loop will only execute once? (code below)
Thanks.
query = "begin pkg.procedure($id, :curs, :errorCode); end;"; //query should return only the details of the $id passed in to proc. $curs = OCINewCursor($connection); $stmt = OCIParse ($connection, $query); OCIBindByName ( $stmt, ":curs", &$curs,-1,OCI_B_CURSOR); OCIBindByName ($stmt, ":errorCode", &$errorCode,10); $result = OCIExecute ($stmt); $result = OCIExecute ($curs); while (OCIFetchInto($curs,$data)) { $companyname = $data[0]; $companyaddress = $data[1]; $companyaddress2 = $data[2]; $companycity = $data[3]; $companystate = ucwords($data[4]); $companypostalcode = $data[5]; $companycountry = ucwords($data[6]); } OCIFreeStatement($stmt); OCIFreeCursor($curs); ?>
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
-- 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:
Can i use functions or sub routines in PHP. How do i call them and how do i defgine them. Do we have an artical online or can someone point me in the right direction.
Thanks, Regards, Harpreet Kaur Software Developer Crispin Corporations Inc.
attached mail follows:
yes
<?
print_hello();
function print_hello(){ echo "Hello World"; }
?>
check out phpbeginner.com, phpbuilder.com, and of course, php.net
-----Original Message-----
From: Harpreet [mailto:harpreet
crispincorp.com]
Sent: Monday, October 15, 2001 10:25 AM
To: php-db
lists.php.net; php-general
lists.php.net
Subject: [PHP] Sub routines in php
Can i use functions or sub routines in PHP. How do i call them and how do i defgine them. Do we have an artical online or can someone point me in the right direction.
Thanks, Regards, Harpreet Kaur Software Developer Crispin Corporations Inc.
-- 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:
harpreet
crispincorp.com (Harpreet) wrote:
> Can i use functions or sub routines in PHP. How do i call them and how do i > defgine them. Do we have an artical online or can someone point me in the > right direction.
http://www.php.net/manual/en/functions.php
-- Henrik Hansen
attached mail follows:
Is there a way that you can get a php script to cache if the user hits the back button instead of re-executing?
Thank you
Randy
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.282 / Virus Database: 150 - Release Date: 9/25/2001
attached mail follows:
not reliably, no
You can mess about with HTTP headers so that browsers no to cache the page generally, but for the greatest part browsers just do whatever they want, which varies greatly between different browsers on different OS's
if you're worried about a script re-executing then you will need to set some semaphore or guard in the script.
HTH, Tom
----- Original Message -----
From: "Power Programmer" <programmer
jennybug.com>
To: "Henrik Hansen" <hh
mailserver.dk>; <php-general
lists.php.net>
Sent: Monday, October 15, 2001 6:31 PM
Subject: [PHP] CACHE
> Is there a way that you can get a php script to cache if the user hits the
> back button instead of re-executing?
>
>
> Thank you
>
> Randy
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.282 / Virus Database: 150 - Release Date: 9/25/2001
>
>
> --
> 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:
With due regard to the ListAdmin and filters, restating: Subject: REJECTED: Re: [PHP] Re: PHP Quesiotion [OT]
> _lallous (and other esteemed PHP elders), > > I have wondered about the second argument to fread() in applications such as this. > > > $fp = fopen('http://www.somehost.com/somescript.php?someparam=somevalue'); > > $content = ''; > > while (!feof($fp)) > > { > > $content .= fread($fp, 4096); > > } > > fclose($fp); > > What are the virtues of (while) looping in order to accumulate the entire file into a single string > ($content), one 4K block at a time; instead of gulping the entire file down by requesting > (say/aiming for overkill) a 2MB block once? > > Enquiring minds and all that! > =dn > > > > > How do I activate a rempote script from within my own script? > > > I cant connect through sockets or that other way > > > Regards, > > > Georgie Casey > > >
attached mail follows:
Hi! I am saving some xml-files on server with the extension .inc and use this script to view the files: <? if (file_exists("$filename".".inc")) { rename ("$filename".".inc", "$filename".".xml"); } Header("Location: http://www.myserver.com/".$filnamn.".xml"); } ?> Now I wonder how to rename the files back to .inc after I have viewed them, is it possible to do this in the same script with a timer or something? I have tried to include the .inc files instead of renameing them but PHP seams not to handle xml with xsl stylesheets for direct output to browser. Thanks for any help. Regards Jan
Jan Grafström Lillemanshus AB Sweden
attached mail follows:
instead of doing that you could also use readfile
readfile("blah.inc") //wich is actually an xml file it displays the xml directly to the browser u can also use header in front of it..
IE:
header("content-type: text/xml"); readfile("blah.inc");
warm regards, mielz
"Jan Grafström" <jan
grafstrom.net> schreef in bericht
news:3BCAFCCF.7040809
grafstrom.net...
> Hi!
> I am saving some xml-files on server with the extension .inc and use
> this script to view the files:
> <?
> if (file_exists("$filename".".inc")) {
> rename ("$filename".".inc", "$filename".".xml");
> }
> Header("Location: http://www.myserver.com/".$filnamn.".xml");
> }
> ?>
> Now I wonder how to rename the files back to .inc after I have viewed
> them, is it possible to do this in the same script with a timer or
> something? I have tried to include the .inc files instead of renameing
> them but PHP seams not to handle xml with xsl stylesheets for direct
> output to browser.
> Thanks for any help.
> Regards Jan
>
> Jan Grafström
> Lillemanshus AB
> Sweden
>
attached mail follows:
Can anyone tell me where I can find the dlls used for socket, because I can't find them?
Thanks Shimon
attached mail follows:
uhm you don't need to use dlls for the socket.. just use fsockopen..
or use CURL but then ub need to include the dll for the CuRl extension :-)
warm regards,
Mielz
"Shi" <shimon
oek.dk> schreef in bericht
news:20011015152851.85288.qmail
pb1.pair.com...
> Can anyone tell me where I can find the dlls used for socket, because I
> can't find them?
>
> Thanks
> Shimon
>
>
attached mail follows:
Hi Umesh! One way is to explode the file on OS VALUE and than look for the word in the "fruits" while listing them. Read on about arrays Regards Jan Umesh wrote:
> Hi Gurus,
>
> I want to retrieve a node with a specific attribute and value of a XML using
> PHP.
>
> e.g.
>
> <?xml version="1.0" ?>
> <CHANNEL HREF="http://www.acme.com/intropage.htm">
> <TITLE> A Software Distribution Channel</TITLE>
> <SOFTPKG HREF="http://www.acme.com/aboutsoftware.htm" Version="1,0,0,0">
> <IMPLEMENTATION>
> <OS VALUE="WinNT"><OSVERSION VALUE="4,0,0,0" /> </OS>
> <OS VALUE="Win95" />
> <PROCESSOR VALUE="x86" />
> <CODEBASE HREF="http://www.acme.com/test.cab" />
> </IMPLEMENTATION>
> </SOFTPKG>
> </CHANNEL>
>
> suppose I want to retrieve data in only OS node with attribute VALUE and
> having value "WinNt".
>
> Can anybody guide how can I do it?
>
> Thanking you in anticipation.
>
> Regards
>
> Umesh.
> *****************************
> Umesh A. Deshmukh.
> Manas Solutions Pvt. Ltd.
> umesh
manas-solutions.com
> http://www.manas-solutions.com
> Ph. : 91+020+4006358,4223991/92
> *****************************
>
>
attached mail follows:
I'm using MySQL and that is the context with which I write this email.
I have a buch of text files that I want to add to a database so we can add all kinds of search functionality for those files. Each would be stored in either a TEXT or BLOB field. These files can have all kinds of special characters ( ", ', etc) so it would be necessary that I use addslashes().
What I would like to do is make it so that I can check to see if the file has already been added to the database. I'm having a problem where if the text is too large, I can't query to see if the contents of the current file equals the contents of the field I'm storing it in. Is there any way that I can do some kind of checksum on both the contents of the file and the contents of the field to determine if that file has already been added? I'm trying to make it so that I don't have duplicate files in the DB. Has anyone done something like this?
Chris
attached mail follows:
jup, for message digest check use MD5.. (its a message digest) it translates any text string into an 32 alphanumeric string.. so add an exttra field in ur table, named hash or md5 and when u upload the file md5 the content first, save the md5 hash returned in the extra field, so u can validate em next time, someone tries to insert a textfile in the db
warm regards mielz
"Chris Boget" <Chris.Boget
wild.net> schreef in bericht
news:4040BBE81A9AD411BD27009027887A7C042F57
tiger.wild.net...
> I'm using MySQL and that is the context with which I write
> this email.
>
> I have a buch of text files that I want to add to a database so
> we can add all kinds of search functionality for those files.
> Each would be stored in either a TEXT or BLOB field. These
> files can have all kinds of special characters ( ", ', etc) so it
> would be necessary that I use addslashes().
>
> What I would like to do is make it so that I can check to see if
> the file has already been added to the database. I'm having a
> problem where if the text is too large, I can't query to see if the
> contents of the current file equals the contents of the field I'm
> storing it in. Is there any way that I can do some kind of
> checksum on both the contents of the file and the contents of
> the field to determine if that file has already been added? I'm
> trying to make it so that I don't have duplicate files in the DB.
> Has anyone done something like this?
>
> Chris
>
attached mail follows:
On Sun, 14 Oct 2001 09:22:29 +0200 impersonator of
ASkwar
DigitalProjects.com (Alexander Skwar) planted &I saw in
php.general:
>
>You're at least missing the / character in the username part, and you do
:-)) not just that. But U know that ! fr. _this_ my post?:) I only incl. domain part here:) & \ still escape inside [], although ! always ness*ary
>not take account for .info domains.
Are these - special dns infor domains? gimme an example, pls.
Also you don't allow usernames like >".me." (without the quotes).
Actually i wrongfully allowed them:) Tank 4 noticing:) Fixed. But I allow _me_ (enquoted in __ :)
Basically, I'd allow EVERYTHING as the >username
Well. <G>humor?:) I would too meybe:) But important (4 this case) - is what THEY allow, [not VI] as we r just checkin<g> what they allow:) I don't know for sure (is there a standard for allowed handles at all?), but mostly, from experience, they allow, alpha-nums plus underscore _ and minus - (any idea of #?:). And all the rest - r just an antispam noise:)
and would check if the domain exists, and that's it for the >check.
It takes time (so i purpousely missed this check), but i agree, it can be done, if it is a (amNestY:) mission critical (like in my "dream" 2day, where i traveled to Afghanistan:) > >Alexander Skwar >--=20 >How to quote: http://learn.to/quote (german) http://quote.6x.to (english) >Homepage: http://www.digitalprojects.com | http://www.iso-top.de > iso-top.de - Die g=FCnstige Art an Linux Distributionen zu kommen > Uptime: 19 hours 36 minutes
attached mail follows:
On Sat, 13 Oct 2001 16:14:39 -0400 impersonator of matt
willetts.com
(Matthew Loff) planted &I saw in php.general:
>
>Are there any open source efforts to clone the Zend PHP compiler, so
>that PHP scripts can be distributed in binary form?
>
I don't know of _common_ efforts in this direction. May be it is against
open php policy:) (if i do a pre-processOR [not open], it 'll cost half of
of zend's $$ - 1200/install:))
>There is already the Win32 PHP compiler intended for PHP+GTK scripts... > No much use if it is only for windows. What/where it is and how $$, btw? In any case even it is exits for *unix also it should be in every PHP (say 4) installment, which is unlikely.
I would rather think of kind of _preprocessor_ , capable to load the code and execute phps from memory via existing php processor. For that we need to know some php internal/ way to effectively invoke this processor with a given string (not file) >> >>Write CGI script in a compiled language, C, C++ or INTERCAL, and run it >>from your PHP scripts. >> >Thats a possibility, if to consider it in conjunction with PHP. But >better >to do it other way around, i think: run CGI compiled (small) handler >stuff >first, and call your (effectively) compressed PHP from it, to take >advantage of PHP speed and functionality. > > i leonid
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]