php-general Digest 24 Dec 2006 16:23:43 -0000 Issue 4532

Topics (messages 246185 through 246194):

Re: How to Separate PHP Errors to a file different than Apache Errors
        246185 by: Sumeet
        246187 by: Fahad Pervaiz
        246190 by: Roman Neuhauser

Re: Clarification: Jump to a record/PHP paging...
        246186 by: Sumeet
        246189 by: Robert Cummings
        246192 by: Martin Alterisio
        246194 by: tedd

Customizing unserialize output.
        246188 by: Jahangir

help with curl
        246191 by: Angelo Zanetti

Re: help with curlSOLVED
        246193 by: Angelo Zanetti

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
dear sir,

> But Apache php errors generated by scripts served up by Apache as web pages
> all show up in error_log.
>
> I'd like these Apache errors to go into php_errors so I can keep my "Apache:
> file not found type errors" and "PHP Syntax" errors separate.

when u run a script, apache first accesses the script. if there are no errors, then passes the same to php. if errors are generated, the script is not passed to php.exe but immediately stopped.

hence i cannot see a way to access apache errors in php...

>
> Is this possible?
>
> Thanks again,
> Shanon
>


--
Thanking You

Sumeet Shroff
http://www.prateeksha.com
Web Designers and PHP / Mysql Ecommerce Development, Mumbai India

--- End Message ---
--- Begin Message ---
First of all php errors are not logged in apache error log. PHP errors are
logged seperately.

if you want to custom define error log file for your apache errors you can
use virtualhost directive in apache httpd config file

If you do not specify an ErrorLog directive within a
<VirtualHost> container, error messages relating to that virtual host will
be logged here. If you *do* define an error logfile for a
<VirtualHost> container, that host's errors will be logged there.

If you want to change the default log file for php error then use
"error_log" directive to define the path. "error_log" is located in php.inifile.

--
Fahad Pervaiz
www.ecommerce-xperts.com

--- End Message ---
--- Begin Message ---
Please preserve necessary context in your replies. *At least* the
In-Reply-To: header with the correct message-id!

# [EMAIL PROTECTED] / 2006-12-24 11:42:45 +0500:
> First of all php errors are not logged in apache error log. PHP errors are
> logged seperately.

Notices, warnings and errors from at least mod_php get logged in the apache
error log (all with log level "error") if you don't say otherwise. 

> if you want to custom define error log file for your apache errors you can
> use virtualhost directive in apache httpd config file
> 
> If you do not specify an ErrorLog directive within a
> <VirtualHost> container, error messages relating to that virtual host will
> be logged here. If you *do* define an error logfile for a
> <VirtualHost> container, that host's errors will be logged there.

This talks about the apache error log. Again, if you don't configure PHP
otherwise (error_log in php.ini or php_value error_log in httpd.conf),
it will log there.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
T.J. Mahaffey wrote:
>
> My problem is that when a user performs a search, I need to display the
> page on which their search string is found, but still display ALL
> records within the paging of the entire database.
> I've since discovered the core of what I need to do:
>

i would suggest u run the query function twice. first time u get the search results and the second time u get all the results.

that way you will be able to differentiate the records perfectly

--
Thanking You

Sumeet Shroff
http://www.prateeksha.com
Web Designers and PHP / Mysql Ecommerce Development, Mumbai India

--- End Message ---
--- Begin Message ---
On Sat, 2006-12-23 at 12:06 -0500, tedd wrote:
> At 11:24 AM -0500 12/23/06, Robert Cummings wrote:
> >On Sat, 2006-12-23 at 11:05 -0500, tedd wrote:
> >>
> >>  In my opinion, wrong thinking. You ask how many records appear before
> >>  and after a search string result. That's like asking "What's the
> >>  difference between an orange?" -- it doesn't make sense.
> >
> >It makes perfect sense. He has an order to his universe of items. The
> >search criteria pull out a subset of his universe and he wants to know
> >where in the universe any given item normally lies.
> 
> Okay, but in what order? Numerically, alphabetically, temporally 
> (time entered, time last altered), likeness, length, height, width, 
> weight, density, color, or what? You need to measure the item to 
> others in some frame of reference.
> 
> >This is akin to asking I want all words from the dictionary that have
> >monster in their definition, then look at the word Yeti and saying ok,
> >now where does Yeti lie with respect to all other words.
> 
> Again, in my opinion, that's fuzzy thinking. Sure, Yeti may be in the 
> monster sub-set, but how much monster it is as compared to Lockness? 
> You need a means, a yardstick, to compare the two with each other. 
> Like, is Lockness bigger than the Yeti while monster-mouse is 
> smaller, or what?

Who the hell cares, I asked for any entry with monster in the
description, I didn't say make higher level philosophical debate within
your head as to the level of monsteriness. Quit trying to paint shades
of gray when all that lies before you is black and white. We have an
order, the order in the dictionary, we have a query for which results
are returned using the same ordering criterion as in the dictionary.

> >Now to provide the answer he wants... AFAIK you need to select all items
> >from the table and populate into a temporary table with auto increment.
> >Then select the item in question and it's temporary ID from the
> >temporary table.
> 
> Sure, if you can decide on what bases to select and sort the other 
> items to populate the table.

He has already decided an order so your rebuttal is completely devoid of
additional content.

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

--- End Message ---
--- Begin Message ---
To solve a problem like yours I ussualy do the following:

First you need to use a deterministic order criteria when displaying the
results, this means that according to the order columns you provide, MySQL
will not have to decide how to order two rows that have the same values for
this columns. For example, if you order an users table by the first name of
the user, there might be two users with the same name, and MySQL will order
them the way it founds more convenient.

One way to do this is using an uniquely indexed column in the order
criteria. The primary key would be a nice idea. You don't need to enforce an
order criteria to the listing, you can simply add the primary key as the
last column in the order by and that will be enough.

Then, look for the record you need and store the values it has for the
columns used in the order. With that info you can build a query which will
return how many records there are, in the listing, before the one you sought
before:

SELECT COUNT(*)
 FROM table
WHERE order_column1 < 'order_column1_value'
    OR (order_column1 = 'order_column1_value' AND order_column2 <
'order_column2_value')
    OR (order_column1 = 'order_column1_value' AND order_column2 =
'order_column2_value' AND order_column3 < 'order_column3_value')
...etc...

If the order direction of one column is descending instead of ascending, you
should use > instead of < for that specific column.

If you're worried about performance you should add indexes to the columns of
the order criteria, which you probably have done so anyway. Also you should
consider splitting this query in many queries:

SELECT COUNT(*)
 FROM table
WHERE order_column1 < 'order_column1_value'

SELECT COUNT(*)
 FROM table
WHERE order_column1 = 'order_column1_value'
   AND order_column2 < 'order_column2_value'

SELECT COUNT(*)
 FROM table
WHERE order_column1 = 'order_column1_value'
   AND order_column2 = 'order_column2_value'
   AND order_column3 < 'order_column3_value'

etc...

and sum all the results. It seems that sometimes this run faster with a
MySQL server, anyway, give it a try if you're worried about the query
performance.

The result will be the number of records before the one you sought, with
that info getting the page of the record is piece of cake.


2006/12/23, T.J. Mahaffey <[EMAIL PROTECTED]>:

I see now that I did not explain myself adequately.
I think "jump to record" was the wrong way to put it. So, here goes.

I already have excellent paging functionality working well, based on
a nice tutorial at PHPFreaks.

My problem is that when a user performs a search, I need to display
the page on which their search string is found, but still display ALL
records within the paging of the entire database.
I've since discovered the core of what I need to do:

        1. I can find the record I need through a simple query.

        2. I can easily determine WHICH page this record is on by counting
BACKWARDS from the found record to the FIRST record, totaling the
number of records from record 1 to the found record. Then, by
performing a bit of division, I can determine which page that record
appears on and direct the user to "...page=8" via $_GET.

SO, my question is: how might I have MySQL tell me how many records
came BEFORE the found record?
(FYI: there is currently no auto-incrementing ID on these records, so
that obviously easy solution would be unavailable.)

Thanks in advance for any insight.

--
T.J. Mahaffey
[EMAIL PROTECTED]

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



--- End Message ---
--- Begin Message ---
 > Again, in my opinion, that's fuzzy thinking. Sure, Yeti may be in the
 monster sub-set, but how much monster it is as compared to Lockness?
 You need a means, a yardstick, to compare the two with each other.
 Like, is Lockness bigger than the Yeti while monster-mouse is
 smaller, or what?

Who the hell cares, I asked for any entry with monster in the
description, I didn't say make higher level philosophical debate within
your head as to the level of monsteriness. Quit trying to paint shades
of gray when all that lies before you is black and white. We have an
order, the order in the dictionary, we have a query for which results
are returned using the same ordering criterion as in the dictionary.

Rob:

If YOU are doing a FULL TEXT search within a description field looking for the word "monster" and reporting all those records that fulfill the search, then I agree with YOU, but that's not what the POSTER was asking. In fact, I already discussed a FULL TEXT search in a previous post re this subject.

The poster asked:

... my question is: how might I have MySQL tell me how many records came BEFORE the found record?

So, if he followed your advice/technique, then tell us how many records came before "monster"?

I claim you can't.

He has already decided an order so your rebuttal is completely devoid of
additional content.

You are arbitrarily inferring that the order was alphabetical, but he did not say that.

However, if he had, then please explain how you would use a FULL TEXT search to find the word that came BEFORE "monster"? I would be very interested to see how that's done. We all can learn.

Cheers, and Happy Holidays.

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
I am trying to implement the yahoo search api using php.
I prefer to use PHP serialized to get the result of the search
displayed.
Right now i get the output like:
Array
(
    [ResultSet] => Array
        (
            [type] => web
            [totalResultsAvailable] => 20800000
            [totalResultsReturned] => 20
            [firstResultPosition] => 1
            [moreSearch] =>
/WebSearchService/V1/webSearch?query=bangalore&appid=Jahangir&region=us
            [Result] => Array
                (
                    [0] => Array
                        (
                            [Title] => Explocity.com Bangalore. The
city as it happens
                            [Summary] => Offers an event schedule,
places to see, shopping, dining, and other information about Bangalore.
                            [Url] =>
http://www.explocity.com/bangalore.asp
                            [ClickUrl] =>
http://uk.wrs.yahoo.com/_ylt=A0Je5ar3NI5FgPAAtkDdmMwF;_ylu=X3oDMTB2cX...
                            [DisplayUrl] =>
www.explocity.com/bangalore.asp
                            [ModificationDate] => 1166860800
                            [MimeType] => text/html
                            [Cache] => Array
                                (
                                    [Url] =>
http://uk.wrs.yahoo.com/_ylt=A0Je5ar3NI5FgPAAuEDdmMwF;_ylu=X3oDMTBwOH...
                                    [Size] => 28482
                                )

                        )


                    [1] => Array
                        (
                            [Title] => Bangalore
                            [Summary] => Tourist guide around the city
of Bangalore including historical background, weather, dining,
entertainment, and accommodations.
                            [Url] => http://www.discoverbangalore.com/
                            [ClickUrl] =>
http://uk.wrs.yahoo.com/_ylt=A0Je5ar3NI5FgPAAukDdmMwF;_ylu=X3oDMTB2Zj...
                            [DisplayUrl] => www.discoverbangalore.com/
                            [ModificationDate] => 1166860800
                            [MimeType] => text/html
                            [Cache] => Array
                                (
                                    [Url] =>
http://uk.wrs.yahoo.com/_ylt=A0Je5ar3NI5FgPAAvEDdmMwF;_ylu=X3oDMTBwZG...
                                    [Size] => 25882
                                )


I am trying to format this using 2 foreach loop. One for Array second
for ResultSet and Third for individual Result.
Example of what im trying:

foreach($display as $disp) // Main "Array"
{$output['title']=$disp;
echo "$output";
foreach($disp as $key=>$value)
{$newobj=$key;
echo "<br>$newobj";
$newobj3=$Array["ResultSet"]["moreSearch"];
echo "<br>$newobj3";}}


But i am having a hard time getting the output that i want.
Can someone help me format the output got from unserialize() in the
same way as yahoo displays its result on its main page.


thanks in advance

--- End Message ---
--- Begin Message ---
Dear All,

I have a script that uses curl to execute an http request now I use the same code for two different servers. And it works on the first server but not the second. I have stored the URL that it generates on the server that doesnt work and if I paste it into the address bar of the browser it works but somehow the script doesnt execute it.


       $ch = curl_init();    // initialize curl handle
       curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
       curl_setopt($ch, CURLOPT_FAILONERROR, 1);
       curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
       curl_setopt($ch, CURLOPT_TIMEOUT, 8); // times out after 4s
       curl_setopt($ch, CURLOPT_GET, 1); // set POST method
       curl_setopt($ch, CURLOPT_POSTFIELDS, $dat); // add POST
       curl_setopt($ch, CURLOPT_PORT, $port); // set POST method
       $result = curl_exec($ch); // run the whole process



now is there anything that can be causing this not to execute? I have increasd the timeout to 8 seconds (is this enough). COuld there be a problem with the server not being able to execute a URL in that way?

Is there anything else I can do to trouble shoot this? IF the URL is as follows: http://www.sdfsfjs.com?username=hello&password=goodbye do I need to set the GET variable string seperately in the CURLOPT_POSTFIELDS or can I just send it as one string?

Thanks in advance.

regards



--
------------------------------------------------------------------------
Angelo Zanetti
Systems developer
------------------------------------------------------------------------

*Telephone:* +27 (021) 469 1052
*Mobile:*       +27 (0) 72 441 3355
*Fax:*            +27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

--- End Message ---
--- Begin Message ---
it appears the problem with the port and not the timeout.



Angelo Zanetti wrote:

Dear All,

I have a script that uses curl to execute an http request now I use the same code for two different servers. And it works on the first server but not the second. I have stored the URL that it generates on the server that doesnt work and if I paste it into the address bar of the browser it works but somehow the script doesnt execute it.


       $ch = curl_init();    // initialize curl handle
       curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
       curl_setopt($ch, CURLOPT_FAILONERROR, 1);
       curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
       curl_setopt($ch, CURLOPT_TIMEOUT, 8); // times out after 4s
       curl_setopt($ch, CURLOPT_GET, 1); // set POST method
       curl_setopt($ch, CURLOPT_POSTFIELDS, $dat); // add POST
       curl_setopt($ch, CURLOPT_PORT, $port); // set POST method
       $result = curl_exec($ch); // run the whole process



now is there anything that can be causing this not to execute? I have increasd the timeout to 8 seconds (is this enough). COuld there be a problem with the server not being able to execute a URL in that way?

Is there anything else I can do to trouble shoot this? IF the URL is as follows: http://www.sdfsfjs.com?username=hello&password=goodbye do I need to set the GET variable string seperately in the CURLOPT_POSTFIELDS or can I just send it as one string?

Thanks in advance.

regards




--- End Message ---

Reply via email to