OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 20 Jul 2005 17:02:45 -0000 Issue 3578

php-general-digest-helplists.php.net
Date: Wed Jul 20 2005 - 12:02:45 CDT


php-general Digest 20 Jul 2005 17:02:45 -0000 Issue 3578

Topics (messages 219022 through 219054):

Re: "Only variable references should be returned by reference"
        219022 by: Rasmus Lerdorf
        219038 by: Robert Cummings

Re: Ok, why is this happening...
        219023 by: Nadim Attari

checking for internet connection
        219024 by: Steven Sher
        219025 by: Steven
        219028 by: James
        219030 by: Mark Rees

Re: Date function and MySQL
        219026 by: kalinga
        219032 by: kalinga

Re: still some problems with contact form
        219027 by: Mark Rees

Re: problems with self referential sticky forms
        219029 by: Mark Rees

Garbage in odbc_connect error
        219031 by: Vandana Ponnuru

MYSQL translator
        219033 by: Alessandro Rosa

Re: My Project
        219034 by: Jay Blanchard
        219035 by: Joseph
        219036 by: Jim Moseby
        219037 by: John Nichel
        219039 by: Matt Darby
        219040 by: Edward Vermillion
        219041 by: Shaw, Chris - Accenture

Before I pull anymore hair out.. Is anyone Using..
        219042 by: Chuck Carson
        219044 by: Mikey
        219045 by: André Medeiros
        219047 by: Chuck Carson

Re: Tracking a mobile phone
        219043 by: Marcus Bointon

PHP Build Issues on Soalris 9
        219046 by: Chuck Carson
        219049 by: Jochem Maas
        219051 by: John Nichel
        219052 by: Jochem Maas

Installing OLE/Spreadsheet Excel Writer Query
        219048 by: kevin.o'brien.pfpc.ie
        219050 by: Jochem Maas

Combining recordsets
        219053 by: Mike Smith
        219054 by: Shaw, Chris - Accenture

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Robert Cummings wrote:
> On Tue, 2005-07-19 at 22:10, Jason Wong wrote:
>
>>On Wednesday 20 July 2005 07:32, Marc G. Fournier wrote:
>>
>>
>>>Which is? If its:
>>
>>Yep.
>>
>>
>>>; at function call time. This method is deprecated and is likely to be
>>>; unsupported in future versions of PHP/Zend. The encouraged method of
>>>; specifying which arguments should be passed by reference is in the
>>>function ; declaration. You're encouraged to try and turn this option
>>>Off and make ; sure your scripts work properly with it in order to
>>>ensure they will work ; with future versions of the language (you will
>>>receive a warning each time ; you use this feature, and the argument
>>>will be passed by value instead of by ; reference).
>>>allow_call_time_pass_reference = On
>>
>>The pass by reference thing works regardless of the above setting.
>>Enabling the setting disables the warnings and vice-versa.
>>
>>
>>>It already is ...
>>
>>Are you sure that:
>>
>>1) you're looking at the correct php.ini
>>2) the setting is not being changed elsewhere
>>
>>If the warning annoys you just tone down the error reporting level.
>>
>>
>>>Is there another one I should be looking at? :(
>>
>>Not that I'm aware of.
>
>
> This isn't related to allow_call_time_pass_reference. It's a new notice
> that came with PHP 4.4.0 to inform developers of possible incorrect
> code. For instance the following will generate it:
>
> function &$foo()
> {
> return null;
> }
>
> According to internals before 4.4.0 such methods caused the occasional
> (almost impossible to track down) memory corruption bugs. You're only
> relief is to tone down the error reporting level (Which will knock out
> other notices during development but will be great for a production
> server), or do as I did and install a custom error handler that filters
> this notice specifically (I have to work with some ezproject code for a
> client which is disgusting and is filled with all kinds of notices not
> to mention on one page almost a thousand of this particular breed).

It still needs some tuning, but eventually it will also catch problems like:

  function foo(&$arg) {
    $arg = "foo";
  }
  function bar() {
     return "abc";
  }
  foo(bar());

PHP4.4 will still happily let you run this code. PHP-5.1 throws a fatal
error now.

It is obviously incorrect code and needs to be fixed.

In the case of returning a reference to something bogus, it's not quite
obvious that it is incorrect, hence the notice, but it is still
something that needs to be looked at. For legacy code, ignore notices
for now and poke the authors to fix their code.

-Rasmus

attached mail follows:


On Wed, 2005-07-20 at 02:42, Rasmus Lerdorf wrote:
> Robert Cummings wrote:
> [-- snippity --]
> > You're only
> > relief is to tone down the error reporting level (Which will knock out
> > other notices during development but will be great for a production
> > server), or do as I did and install a custom error handler
> [-- snippity --]

Actually I forgot to mention one of the most obvious relief
mechanisms... fix the problem :)

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. |
`------------------------------------------------------------'

attached mail follows:


Hello,

I've changed the codes. Please run this one to view the results.
The notable change is:

$calculatedGross = $originalNet * (1.000 + ($commissionPct * 0.010));

Regards,
Nadim Attari
Alienworkers.com

<?php
 set_time_limit( 0 );

 echo '<html>';
 echo ' <head><title>Test Rounding Net Premium</title></head>';
 echo '<body>';

 flush();

 echo '<table border="1">';
 echo ' <tr>';
 echo ' <td>Index</td>';
 echo ' <td>Original Net</td>';
 echo ' <td>Commission %</td>';
 echo ' <td>Calculated Gross</td>';
 echo ' <td>Calculated Net</td>';
 echo ' <td>Result</td>';
 echo ' <td>Comparisson</td>';
 echo ' </tr>';

 $numberOfFailures = 0;
 $index = 0;

 for ($originalNet = 10000.000; $originalNet <= 10005.000; $originalNet++)
 {
  for ($commissionPct = 1.000; $commissionPct <= 20.000; ($commissionPct +=
0.100))
  {
   $calculatedGross = $originalNet * (1.000 + ($commissionPct * 0.010));
   $calculatedNet = $calculatedGross / (1.000 + ($commissionPct *
0.010));

   $comparisson = "if ($originalNet !== $calculatedNet) = " . (($originalNet
!== $calculatedNet) ? 'Condition true, it is not equal' : 'Condition false,
it is equal') . "<br>\n";
   if ($originalNet !== $calculatedNet)
   {
    $numberOfFailures++;
    $result = 'NEQ';
   }
   else
   {
    $result = 'EQ';
   }

   echo '<tr>';
   echo ' <td>' . ++$index . '.</td>';
   echo ' <td>' . round($originalNet, 2) . '</td>';
   echo ' <td>' . round($commissionPct, 2) . ' %</td>';
   echo ' <td>' . round($calculatedGross, 2) . '</td>';
   echo ' <td>' . round($calculatedNet, 2) . '</td>';
   echo ' <td>' . $result . '</td>';
   echo ' <td>' . $comparisson . '</td>';
   echo '</tr>';

   flush();
  }
 }

 echo '</table>';

 echo "<br># of calculations failed to match the original net premium =
$numberOfFailures<br>";

 echo '</body>';
 echo '</html>';
?>

attached mail follows:


Hi

I am looking for a simple way to check if the server is connected to the
Internet, they use a dialup to get Internet connection, and I need to
email reports out, but want to check to see if the user remembered to
connect to the Internet first. If anybody has a nice script, or just a
suggestion on a php function I could use to test for an Internet connection.

Thanks
steve

attached mail follows:


Hi

I am looking for a simple way to check if the server is connected to the
Internet, they use a dialup to get Internet connection, and I need to
email reports out, but want to check to see if the user remembered to
connect to the Internet first. If anybody has a nice script, or just a
suggestion on a php function I could use to test for an Internet connection.

Thanks
steve

attached mail follows:


Assuming they connect to check their email every now and then, you do
realize people will still receive your email regardless of whether their
connection is up or not?

The emails reside on the email server until the user retrieves them.

----- Original Message -----
From: "Steven" <steven_listtechtron.co.za>
To: "PHP General" <php-generallists.php.net>
Sent: Wednesday, July 20, 2005 3:49 AM
Subject: [PHP] checking for internet connection

> Hi
>
> I am looking for a simple way to check if the server is connected to the
> Internet, they use a dialup to get Internet connection, and I need to
> email reports out, but want to check to see if the user remembered to
> connect to the Internet first. If anybody has a nice script, or just a
> suggestion on a php function I could use to test for an Internet
> connection.
>
> Thanks
> steve
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


"Steven" <steven_listtechtron.co.za> wrote in message
news:42DE021C.4020409techtron.co.za...
> Hi
>
> I am looking for a simple way to check if the server is connected to the
> Internet, they use a dialup to get Internet connection, and I need to
> email reports out, but want to check to see if the user remembered to
> connect to the Internet first. If anybody has a nice script, or just a
> suggestion on a php function I could use to test for an Internet
connection.
>

You could try curl or fsockopen to see if there is a connection. But really,
is this necessary? You don't test to see if the computer's plugged in, do
you? So why test for this? Surely your user will have enough nous to connet
to the internet forst, and if they don't, then it just won't work.

> Thanks
> steve

attached mail follows:


this seems pretty interesting, i'm tring to write a code in php to get
those two outputs, but bit confused in counting weeks. could somebody
clear me..

"what is the first *date* of the first week of year 2005?"

is it "saturday jan 1st 2005" (assuming first week starts from jan 1
of any year)
or
is it "sunday jan 3rd 2005" (assuming first day of a week is monday)
or
anything else.

thanks

vk.

On 7/19/05, Arno Coetzee <arnoflashmedia.co.za> wrote:
> Philip Thompson wrote:
>
> > Hi all.
> >
> > I have the week number (for example, this is the 29th week of the
> > year and it begins on 7/17/05). Does anyone know how to obtain the
> > first (and maybe the last) date of the week if you only know the week
> > number of the year? Would it be better for me to obtain this in PHP
> > or MySQL? or both?
> >
> > I have researched the archives on a few lists and I know that others
> > have asked this same questions, but I have not found a good solution.
> > I have also looked on MySQL's "date and time functions" page, but had
> > little luck.
> >
> > Any thoughts would be appreciated.
> > ~Philip
> >
> Hi Philip
>
> give this a go... i played around with the date functions of mysql
>
> select date_sub(curdate() , interval (date_format(curdate() , '%w')-1)
> day) as firstday , date_add(curdate() , interval (7 -
> date_format(curdate() , '%w')) day) as lastday
>
> it will give you the date of the monday and the sunday of the current week
>
> hope this solves your problem.
>
> Arno
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


> > > Hi all.
> > >
> > > I have the week number (for example, this is the 29th week of the
> > > year and it begins on 7/17/05). Does anyone know how to obtain the
> > > first (and maybe the last) date of the week if you only know the week
> > > number of the year? Would it be better for me to obtain this in PHP
> > > or MySQL? or both?

i did a little coding, try this and give me any comments..

<?php
$week = 7;
$year = 2028;

$uts = mktime(0,0,0,1,1,$year);

// 604800 = 7 days in seconds
$w2s = (($week-1) * 604800);

//unix time stamp for the first date of the given week
$suts = $uts + $w2s;

echo "<pre>";
echo "Start Date: " . date("j-M-Y (l)",($suts));
echo "<br>";
//518000 = 6 days in seconds
echo "Last Date: " . date("j-M-Y (l)",($suts+518400));
echo "<pre>";

?>

happy coding

vk.

> > >
> > > I have researched the archives on a few lists and I know that others
> > > have asked this same questions, but I have not found a good solution.
> > > I have also looked on MySQL's "date and time functions" page, but had
> > > little luck.
> > >
> > > Any thoughts would be appreciated.
> > > ~Philip
> > >
> > Hi Philip
> >
> > give this a go... i played around with the date functions of mysql
> >
> > select date_sub(curdate() , interval (date_format(curdate() , '%w')-1)
> > day) as firstday , date_add(curdate() , interval (7 -
> > date_format(curdate() , '%w')) day) as lastday
> >
> > it will give you the date of the monday and the sunday of the current week
> >
> > hope this solves your problem.
> >
> > Arno
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

attached mail follows:


An alternative (and more user-friendly) approach is to have the form's
action as itself (i.e. the form on contact.php submits to contact.php). You
can then identify which fields are incomplete and highlight them in the
form. This will make it easier for users to see what they have done wrong
and make the necessary corrections.

This is what print does
http://uk2.php.net/manual/en/function.print.php

echo
http://uk2.php.net/echo

and the difference is discussed here, although it probably won't concern you
too much for the moment.
http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40

"Bruce Gilbert" <webguyncgmail.com> wrote in message
news:463b785d0507192148442bb7d7mail.gmail.com...
thanks, makes some sense.

so now where I have echo, I should have print? or just leave as echo
and add the else and ||?

Could you provide some sample code based on the code I posted
previously by chance??

being new to PHP I am sure I will run into errors for a few days, as is...

that would help me out greatly.

thx,

On 7/19/05, James <tuffguysympatico.ca> wrote:
> This is what you have done
>
> if(something happens) {
> print error;
> }
>
> print thanks for sending the form!
>
> So basically you are printing the error and then thanking them. You need
to
>
> include an ELSE bracket. Like so..
>
> if(this error || that error || some other error) {
> print error;
> } else {
> //no errors, thank them!
> print THANKS!
> }
>
> ----- Original Message -----
> From: "Bruce Gilbert" <webguyncgmail.com>
> To: <php-generallists.php.net>
> Sent: Tuesday, July 19, 2005 5:52 PM
> Subject: [PHP] still some problems with contact form
>
>
> Hello,
>
> on my web site contact form:
>
> http://www.inspired-evolution.com/Contact.php
>
> I am still having a few problems with the return results after filling
> out the form. Basically I am wanted to return an error msg. when all
> of the required fields are not filled out (those with a red *), and an
> invalid email address will also return an error.
>
> filling out all of the information correctly will result in a
> thank-you paragraph, we have received your submission etc.
>
> Right now even if you don't fill out the required fields, you still
> get my thank-you message for filling out the form correctly (as well
> as getting the error msg.). If someone has a chance try out the form
> yourself and you will see what I mean.
>
> What I would really like to have is a thank-you page when the form is
> completed sucussfully and an oops! page when there is an error. SO we
> are talking two different pages, based upon the results of the form
> information...
>
> The PHP code I have for the return info. currenty is:
>
> <?php
>
> $firstname = $_POST['firstname'];
> $lastname = $_POST['lastname'];
> $company = $_POST['company'];
> $phone = $_POST['phone'];
> $email = $_POST['email'];
> $email2 = $_POST['email2'];
> $URL = $_POST['URL'];
> $Contact_Preference = $_POST['Contact_Preference'];
> $Contact_Time = $_POST['Contact_Time'];
> $message = $_POST['Message'];
>
> if ((!$firstname) || (!$Contact_Preference)) {
>
> echo'<p><strong>Error!</strong> Fields marked <span class="red">
> *</span> are required to continue.</p><br />';
> echo'<p>Please go back to the <a href="Contact.php"title="Contact
> Me">Contact Me</a> page and try it again!</p>';
> }
>
> if
>
(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*".""."([a-z0-9]+([\.-][a-z0-9]+)*)+".
"\\.[a-z]{2,}"."$",$email))
> {
>
> echo '<p>Invalid email address entered.</p><br />';
> echo '<p>Please go back to the <a href="Contact.php" title="Contact
> Me">Contact Me</a> page and try it again!</p>';

> }
> if (($email) != ($email2)) {
>
> echo '<strong>Error!</strong> e-mail addresses dont match.<br />';
>
>
> }
>
> $email_address = "webguyncgmail.com";
> $subject = "There has been a disturbance in the force";
>
> $message = "Request from: $firstname $lastname\n\n
> Company name: $company\n
> Phone Number: $phone\n
> Email Address: $email\n
> URL: $URL\n
> Please Contact me via: $Contact_Preference\n
> The best time to reach me is: $Contact_Time\n
> I wish to request the following additional information: $Textarea";
>
> mail($email_address, $subject, $message, "From: $email \nX-Mailer:
> PHP/" . phpversion());
>
> echo "<p>Hello, <strong>$firstname</strong>.<br /><br />
> We have received your request for additional information, and will
> respond shortly.<br />
> Thanks for visiting inspired-evolution.com and have a wonderful day!<br
> /><br />
> Regards,<br /><br />
> <strong>Inspired Evolution</strong></p>";
>
> ?>
>
> any assistance/guidance is greatly appreciated. Thanks list!
>
> Bruce G.
> http://www.inspired-evolution.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
::Bruce::

attached mail follows:


"eoghan" <phpredry.net> wrote in message
news:24A4AA20-7196-4DDD-BD92-60FB93C6DFE9redry.net...
> On 20 Jul 2005, at 02:22, Linda H wrote:
>
> > fahreheit is here:
> >
> > <?
> > $fahr = $_GET['fahrenheit'];
> > if (is_null($fahr)){ echo 'fahr is null';}
> > $>
> >
> > The error was on the line: $fahr = $_GET['fahrenheit'];
>
> try:
> <input name="fahrenheit" type="text" value="<?php echo $fahr; ?>" />

Do as previously suggested and check that

$fahr=isset($_GET['fahrenheit'])?$_GET['fahrenheit']:null;

(although since you are dealing with a string here, perhaps an empty string
''might be a better bet than null)
then your test is

if($fahr==''){echo 'fahr is empty');

note the semicolon at the end of each line, and your closing php tag should
be ?>, not $>

attached mail follows:


Hi all,

         I have PHP-4.3.10 and Apache-2.0 running on a Redhat 9
machine. I am connecting to DB2 using the odbc API. I have different
applications running connecting to different databases and the
applications were all running perfectly fine. But now, odbc_connect
fails with some garbage in the SQL error code (error code pasted
below), when connecting to one particular database. (Connections to
other databases are still working fine). Connecting to the database
directly (without using PHP, from the DB2 command prompt) does not
give any errors, though. Since the error messages are not readable, I
am not able to go further on this. Please advice as to how I should
proceed.

Warning: odbc_connect(): SQL error: |U', SQL state ýÿÿÿA in
SQLConnect in /var/www/html/fvt/functions.php on line 87

Thanks.

attached mail follows:


Dear All subscribers,

my intention, through this e-mail, is to submit to your attentions one PHP
class
devoted to translate input native language commands for database into MYSQL
commands lines.

The goal of this class is to provide a comfortable code interface to let
programmers
implement forms within their programs so that customers/users can input
self-defined command lines and reach their own queries.

Programmers can freely implement as they want. For example, one suggested
way
is evidently prompt-like, so that customers can use the program to get their
queries.

Purposes of this class and everything related is contained in the file
readme.html

I do not know lots of forums, but if you like this code you might also post
it
to other national PHP forums.

If you are interested in, please ask me to send you the related PHP code by
e-mail: zandor_zzyahoo.it

I look forward to your feedbacks.

Alessandro Rosa

attached mail follows:


[snip]
> >> Hey, Look I made a new database just for this money testing stuff.
> >> This is the table:
> >>
> >> CREATE TABLE `money` (
> >> `money` varchar(255) NOT NULL default ''
> >> ) TYPE=MyISAM;
> >>
> >> Now, I use this code
> >>
> >> $sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
> >> (`myMoney`-10) WHERE `myCharacter` = `characterName` ";
> >> $doUpdate = mysql_query($sqlUpdate, $myConnection);
> >>
> >> And it should work, And it gives no error but it is not writing
> >> anything into the database.
[/snip]

Anyone else want to go for shorter? :)

The reason is George, as someone so aptly pointed out, it appears that
you have jumped in without any basic knowledge. And thus far we have all
been nice (because we usually get chided for our terseness). So let me
be the first to say RTFM, STFW and STFA and get a better book such as
PHP and MySQL Development (Welling and Thomson) or one of a dozen
others. Google for PHP tutorials. Read them, try them, learn them. Now
let me explain where you went wrong above....

Your table needs two columns, one for money and one for characterName.
Make money decimal(8,2) and characterName char(64) then do the following
query

INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
'Village_Id10t');

Now do a select from the table to see the values entered. See them?
Good!

Now perform the following query;

$sqlUpdate = "UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Village_Id10t` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select again and look at the values, did it work? Excellent!
Run this query;

$sqlUpdate = "UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Town_Drunk` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select from the table and note that the value of money did not
change. The reason is because there is no Town_Drunk in the money table.
Does that make sense? Wonderful!

attached mail follows:


Jay Blanchard wrote:

>[snip]
>
>
>>>>Hey, Look I made a new database just for this money testing stuff.
>>>>This is the table:
>>>>
>>>>CREATE TABLE `money` (
>>>> `money` varchar(255) NOT NULL default ''
>>>>) TYPE=MyISAM;
>>>>
>>>>Now, I use this code
>>>>
>>>>$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
>>>>(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
>>>>$doUpdate = mysql_query($sqlUpdate, $myConnection);
>>>>
>>>>And it should work, And it gives no error but it is not writing
>>>>anything into the database.
>>>>
>>>>
>[/snip]
>
>Anyone else want to go for shorter? :)
>
>The reason is George, as someone so aptly pointed out, it appears that
>you have jumped in without any basic knowledge. And thus far we have all
>been nice (because we usually get chided for our terseness). So let me
>be the first to say RTFM, STFW and STFA and get a better book such as
>PHP and MySQL Development (Welling and Thomson) or one of a dozen
>others. Google for PHP tutorials. Read them, try them, learn them. Now
>let me explain where you went wrong above....
>
>Your table needs two columns, one for money and one for characterName.
>Make money decimal(8,2) and characterName char(64) then do the following
>query
>
>INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
>'Village_Id10t');
>
>Now do a select from the table to see the values entered. See them?
>Good!
>
>Now perform the following query;
>
>$sqlUpdate = "UPDATE `money` SET `money` =
>(`money`-10) WHERE `characterName` = `Village_Id10t` ";
>$doUpdate = mysql_query($sqlUpdate, $myConnection);
>
>Now do a select again and look at the values, did it work? Excellent!
>Run this query;
>
>$sqlUpdate = "UPDATE `money` SET `money` =
>(`money`-10) WHERE `characterName` = `Town_Drunk` ";
>$doUpdate = mysql_query($sqlUpdate, $myConnection);
>
>Now do a select from the table and note that the value of money did not
>change. The reason is because there is no Town_Drunk in the money table.
>Does that make sense? Wonderful!
>
>
>
lol, jay that was beautiful

Both the PHP and MySQL manuals are great tools and should be consulted
first. Youe ambition is nice, but you will get nowhere if you do not
learn how to do these things on your own.
--jzf

attached mail follows:


> Lots of extra characters in that one... try this:
> >
> > $q=mysql_query("update myTable set myMoney=(myMoney-10) where
> > myCharacter='characterName'");
> > if(!$q){echo mysql_error();}
>
> so wasteful :-)
>
> $q=mysql_query("update u set m=(m-10) where
> c='$c'");if(!$q)die(mysql_error());
>

Still wasteful. How about

$q=mysql_query("update u set m=(m-10) where c='$c'") or die(mysql_error());

:)

JM

attached mail follows:


Jay Blanchard wrote:
<snip>
> been nice (because we usually get chided for our terseness).
</snip>

I noticed that Jason appears to be back...the kid gloves will be off now. ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


It *is* a great book (I cut my teeth with it as well):
PHP and MySQL Development (Welling and Thomson)
http://www.amazon.com/exec/obidos/tg/detail/-/0672326728/qid=1121869940/sr=8-1/ref=pd_bbs_1/002-5827183-4477639?v=glance&s=books&n=507846

Read it, learn it, live it.

Matt Darby

Jay Blanchard wrote:

>[snip]
>
>
>>>>Hey, Look I made a new database just for this money testing stuff.
>>>>This is the table:
>>>>
>>>>CREATE TABLE `money` (
>>>> `money` varchar(255) NOT NULL default ''
>>>>) TYPE=MyISAM;
>>>>
>>>>Now, I use this code
>>>>
>>>>$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
>>>>(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
>>>>$doUpdate = mysql_query($sqlUpdate, $myConnection);
>>>>
>>>>And it should work, And it gives no error but it is not writing
>>>>anything into the database.
>>>>
>>>>
>[/snip]
>
>Anyone else want to go for shorter? :)
>
>The reason is George, as someone so aptly pointed out, it appears that
>you have jumped in without any basic knowledge. And thus far we have all
>been nice (because we usually get chided for our terseness). So let me
>be the first to say RTFM, STFW and STFA and get a better book such as
>PHP and MySQL Development (Welling and Thomson) or one of a dozen
>others. Google for PHP tutorials. Read them, try them, learn them. Now
>let me explain where you went wrong above....
>
>Your table needs two columns, one for money and one for characterName.
>Make money decimal(8,2) and characterName char(64) then do the following
>query
>
>INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
>'Village_Id10t');
>
>Now do a select from the table to see the values entered. See them?
>Good!
>
>Now perform the following query;
>
>$sqlUpdate = "UPDATE `money` SET `money` =
>(`money`-10) WHERE `characterName` = `Village_Id10t` ";
>$doUpdate = mysql_query($sqlUpdate, $myConnection);
>
>Now do a select again and look at the values, did it work? Excellent!
>Run this query;
>
>$sqlUpdate = "UPDATE `money` SET `money` =
>(`money`-10) WHERE `characterName` = `Town_Drunk` ";
>$doUpdate = mysql_query($sqlUpdate, $myConnection);
>
>Now do a select from the table and note that the value of money did not
>change. The reason is because there is no Town_Drunk in the money table.
>Does that make sense? Wonderful!
>
>
>

attached mail follows:


Matt Darby wrote:
> It *is* a great book (I cut my teeth with it as well):
> PHP and MySQL Development (Welling and Thomson)
> http://www.amazon.com/exec/obidos/tg/detail/-/0672326728/qid=1121869940/sr=8-1/ref=pd_bbs_1/002-5827183-4477639?v=glance&s=books&n=507846
>
>
> Read it, learn it, live it.
>
> Matt Darby
>
> Jay Blanchard wrote:
>
>> [snip]
>>
>>
>>>>> Hey, Look I made a new database just for this money testing stuff.
>>>>> This is the table:
>>>>>
>>>>> CREATE TABLE `money` (
>>>>> `money` varchar(255) NOT NULL default ''
>>>>> ) TYPE=MyISAM;
>>>>>
>>>>> Now, I use this code
>>>>>
>>>>> $sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
>>>>> (`myMoney`-10) WHERE `myCharacter` = `characterName` ";
>>>>> $doUpdate = mysql_query($sqlUpdate, $myConnection);
>>>>>
>>>>> And it should work, And it gives no error but it is not writing
>>>>> anything into the database.
>>>>>
>>
>> [/snip]
>>
>> Anyone else want to go for shorter? :)
>>
>> The reason is George, as someone so aptly pointed out, it appears that
>> you have jumped in without any basic knowledge. And thus far we have all
>> been nice (because we usually get chided for our terseness). So let me
>> be the first to say RTFM, STFW and STFA and get a better book such as
>> PHP and MySQL Development (Welling and Thomson) or one of a dozen
>> others. Google for PHP tutorials. Read them, try them, learn them. Now
>> let me explain where you went wrong above....
>>
>> Your table needs two columns, one for money and one for characterName.
>> Make money decimal(8,2) and characterName char(64) then do the following
>> query
>>
>> INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
>> 'Village_Id10t');
>>
>> Now do a select from the table to see the values entered. See them?
>> Good!
>>
>> Now perform the following query;
>>
>> $sqlUpdate = "UPDATE `money` SET `money` =
>> (`money`-10) WHERE `characterName` = `Village_Id10t` ";
>> $doUpdate = mysql_query($sqlUpdate, $myConnection);
>>
>> Now do a select again and look at the values, did it work? Excellent!
>> Run this query;
>>
>> $sqlUpdate = "UPDATE `money` SET `money` =
>> (`money`-10) WHERE `characterName` = `Town_Drunk` ";
>> $doUpdate = mysql_query($sqlUpdate, $myConnection);
>>
>> Now do a select from the table and note that the value of money did not
>> change. The reason is because there is no Town_Drunk in the money table.
>> Does that make sense? Wonderful!
>>
>>
>>
>

Honestly, the best "book" I read when I was starting out, and one I've
been using ever since, is the manual. I actually spent $ on a very good
php book but I think I've only cracked the cover on it once or twice in
two years.

Way to go manual guys! :D

attached mail follows:


<snip>
Honestly, the best "book" I read when I was starting out, and one I've
been using ever since, is the manual. I actually spent $ on a very good
php book but I think I've only cracked the cover on it once or twice in
two years.

Way to go manual guys! :D
</snip>

I totally agree, I have only used the .chm manual to learn php, but I have a
programming background, C/C++, VB, Java, OpenROAD, C#.
If you're new to this programming game, then probably a *decent* book will
give you a good start.

Thumbs up to the manual guys. :)

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

************************

This message has been delivered to the Internet by the Revenue Internet e-mail service

*************************

attached mail follows:


Is anyone here using php 5.0.4 on Solaris 9 and compiled with Oracle
10g support and using apache 2.0.54? I have looked at every 10 times
over. I have built php with oracle support probably 100 times on 5
different platforms and never had as many issues as I have had so far
with this system.

After finally getting php to build with everything I needed, I am
getting seg faults when accessing a php page that connects to the
oracle database. (but it doesn't happen _every_ time, it is
inconsistent)

I'm at a loss and must move to tomcat/jsp/servlets if I can't get a
stable platform up this week. =(

Thx
CC

attached mail follows:


Chuck Carson wrote:

>Is anyone here using php 5.0.4 on Solaris 9 and compiled with Oracle
>10g support and using apache 2.0.54? I have looked at every 10 times
>over. I have built php with oracle support probably 100 times on 5
>different platforms and never had as many issues as I have had so far
>with this system.
>
>After finally getting php to build with everything I needed, I am
>getting seg faults when accessing a php page that connects to the
>oracle database. (but it doesn't happen _every_ time, it is
>inconsistent)
>
>I'm at a loss and must move to tomcat/jsp/servlets if I can't get a
>stable platform up this week. =(
>
>Thx
>CC
>
>
>
I guess you have tried reading the walkthrough on Oracle?

http://www.oracle.com/technology/tech/php/index.html

HTH,

Mikey

attached mail follows:


On Wed, 2005-07-20 at 10:21 -0500, Chuck Carson wrote:
> Is anyone here using php 5.0.4 on Solaris 9 and compiled with Oracle
> 10g support and using apache 2.0.54? I have looked at every 10 times
> over. I have built php with oracle support probably 100 times on 5
> different platforms and never had as many issues as I have had so far
> with this system.
>
> After finally getting php to build with everything I needed, I am
> getting seg faults when accessing a php page that connects to the
> oracle database. (but it doesn't happen _every_ time, it is
> inconsistent)
>
> I'm at a loss and must move to tomcat/jsp/servlets if I can't get a
> stable platform up this week. =(
>
> Thx
> CC
>

Do you have CLI compiled?

I had some issues developing a module myself, and found out that
enabling the module in CLI and calling a dummy file to test the
functions I just created helped me getting an insight about what was
wrong.

Install gdb, then do:

gdb php
(and inside gdb)
run -q file_with_oracle_functions.php

It will segfault. Do a backtrace. There you might have a good idea on
what's going wrong :)

Good luck!

attached mail follows:


Yea, there is nothing talking about my eact configuration. (mainly on
Solaris) I can get this config working on SLES 9 and Red Hat w/o
problems and currently have it running on a dozen systems or so.

I need it on Solaris 9...

-CC

On 7/20/05, Mikey <fraktotalise.co.uk> wrote:
> Chuck Carson wrote:
>
> >Is anyone here using php 5.0.4 on Solaris 9 and compiled with Oracle
> >10g support and using apache 2.0.54? I have looked at every 10 times
> >over. I have built php with oracle support probably 100 times on 5
> >different platforms and never had as many issues as I have had so far
> >with this system.
> >
> >After finally getting php to build with everything I needed, I am
> >getting seg faults when accessing a php page that connects to the
> >oracle database. (but it doesn't happen _every_ time, it is
> >inconsistent)
> >
> >I'm at a loss and must move to tomcat/jsp/servlets if I can't get a
> >stable platform up this week. =(
> >
> >Thx
> >CC
> >
> >
> >
> I guess you have tried reading the walkthrough on Oracle?
>
> http://www.oracle.com/technology/tech/php/index.html
>
> HTH,
>
> Mikey
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
 "The day Microsoft makes something that doesn't suck is probably
 the day they start making vacuum cleaners." -Ernst Jan Plugge

attached mail follows:


On 18 Jul 2005, at 20:56, Sebastian wrote:

> The phone would have to have GPS capabilities..

Not true. The network knows what cell the phone is in(and cells are
pretty small in cities), and it knows where the cell is. This is the
mechanism that's used for location dependent services (especially
directions and local maps) that are currently being pushed in the UK.

Whether you can get access to that information is another matter,
especially internationally.

Marcus

attached mail follows:


Okay, something I just noticed. (PHP builds fine, including make test)

I see this after running configure:
Generating files
updating cache ./config.cache
creating ./config.status
creating php5.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/php-config
creating sapi/cli/php.1
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| *** ATTENTION *** |
| |
| Something is likely to be messed up here, because the configure |
| script was not able to detect a simple feature on your platform. |
| This is often caused by incorrect configuration parameters. Please |
| see the file debug.log for error messages. |

I am configuring with this:
adcinfops01:/usr/local/src/php-5.0.4 #./configure
--prefix=/usr/local/php-5.0.4 --with-apxs2=/usr/local/apache2/bin/apxs
--enable-cli --enable-cgi --with-openssl=/usr/local/ssl --with-zlib
--with-zlib-dir=/usr/local/lib --with-bz2 --enable-dio --with-gd
--with-gettext --with-mysql=/usr/local/mysql
--with-mysql-sock=/tmp/mysql.sock --enable-sockets
--with-oci8=/u01/app/oracle/product/10.2 --enable-sigchild

LDFLAGS="-L/usr/local/mysql/lib/mysql
-L/u01/app/oracle/product/10.2/lib32 -L/usr/local/ssl/lib
-L/usr/local/lib"

How can I determine what it thinks is missing?
Thx,
CC

attached mail follows:


Chuck Carson wrote:
> Okay, something I just noticed. (PHP builds fine, including make test)
>
> I see this after running configure:
> Generating files
> updating cache ./config.cache
> creating ./config.status
> creating php5.spec
> creating main/build-defs.h
> creating scripts/phpize
> creating scripts/php-config
> creating sapi/cli/php.1
> creating main/php_config.h
> creating main/internal_functions.c
> creating main/internal_functions_cli.c
> +--------------------------------------------------------------------+
> | *** ATTENTION *** |
> | |
> | Something is likely to be messed up here, because the configure |
> | script was not able to detect a simple feature on your platform. |
> | This is often caused by incorrect configuration parameters. Please |
> | see the file debug.log for error messages. |
>

I'm following your problem in the hope I can learn something but
I'm not able to help really....

>
> I am configuring with this:
> adcinfops01:/usr/local/src/php-5.0.4 #./configure
> --prefix=/usr/local/php-5.0.4 --with-apxs2=/usr/local/apache2/bin/apxs
> --enable-cli --enable-cgi --with-openssl=/usr/local/ssl --with-zlib
> --with-zlib-dir=/usr/local/lib --with-bz2 --enable-dio --with-gd
> --with-gettext --with-mysql=/usr/local/mysql
> --with-mysql-sock=/tmp/mysql.sock --enable-sockets
> --with-oci8=/u01/app/oracle/product/10.2 --enable-sigchild
>
> LDFLAGS="-L/usr/local/mysql/lib/mysql
> -L/u01/app/oracle/product/10.2/lib32 -L/usr/local/ssl/lib
> -L/usr/local/lib"
>
> How can I determine what it thinks is missing?

....I take it you have looked in debug.log (whereever it lives)
for error messages? most probably you have, but it may have been
5am ;-)

> Thx,
> CC
>

attached mail follows:


Chuck Carson wrote:
> Okay, something I just noticed. (PHP builds fine, including make test)
>
> I see this after running configure:
> Generating files
> updating cache ./config.cache
> creating ./config.status
> creating php5.spec
> creating main/build-defs.h
> creating scripts/phpize
> creating scripts/php-config
> creating sapi/cli/php.1
> creating main/php_config.h
> creating main/internal_functions.c
> creating main/internal_functions_cli.c
> +--------------------------------------------------------------------+
> | *** ATTENTION *** |
> | |
> | Something is likely to be messed up here, because the configure |
> | script was not able to detect a simple feature on your platform. |
> | This is often caused by incorrect configuration parameters. Please |
> | see the file debug.log for error messages. |
>
>
> I am configuring with this:
> adcinfops01:/usr/local/src/php-5.0.4 #./configure
> --prefix=/usr/local/php-5.0.4 --with-apxs2=/usr/local/apache2/bin/apxs
> --enable-cli --enable-cgi --with-openssl=/usr/local/ssl --with-zlib
> --with-zlib-dir=/usr/local/lib --with-bz2 --enable-dio --with-gd
> --with-gettext --with-mysql=/usr/local/mysql
> --with-mysql-sock=/tmp/mysql.sock --enable-sockets
> --with-oci8=/u01/app/oracle/product/10.2 --enable-sigchild
>
> LDFLAGS="-L/usr/local/mysql/lib/mysql
> -L/u01/app/oracle/product/10.2/lib32 -L/usr/local/ssl/lib
> -L/usr/local/lib"
>
> How can I determine what it thinks is missing?
> Thx,
> CC
>

What does debug.log say?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Chuck Carson wrote:
> On 7/20/05, Jochem Maas <jochemiamjochem.com> wrote:
>
>>Chuck Carson wrote:
>>
>>>Okay, something I just noticed. (PHP builds fine, including make test)
>>>
>>>I see this after running configure:
>>>Generating files
>>>updating cache ./config.cache
>>>creating ./config.status
>>>creating php5.spec
>>>creating main/build-defs.h
>>>creating scripts/phpize
>>>creating scripts/php-config
>>>creating sapi/cli/php.1
>>>creating main/php_config.h
>>>creating main/internal_functions.c
>>>creating main/internal_functions_cli.c
>>>+--------------------------------------------------------------------+
>>>| *** ATTENTION *** |
>>>| |
>>>| Something is likely to be messed up here, because the configure |
>>>| script was not able to detect a simple feature on your platform. |
>>>| This is often caused by incorrect configuration parameters. Please |
>>>| see the file debug.log for error messages. |
>>>
>>
>>I'm following your problem in the hope I can learn something but
>>I'm not able to help really....
>>
>>
>>>I am configuring with this:
>>>adcinfops01:/usr/local/src/php-5.0.4 #./configure
>>>--prefix=/usr/local/php-5.0.4 --with-apxs2=/usr/local/apache2/bin/apxs
>>>--enable-cli --enable-cgi --with-openssl=/usr/local/ssl --with-zlib
>>>--with-zlib-dir=/usr/local/lib --with-bz2 --enable-dio --with-gd
>>>--with-gettext --with-mysql=/usr/local/mysql
>>>--with-mysql-sock=/tmp/mysql.sock --enable-sockets
>>>--with-oci8=/u01/app/oracle/product/10.2 --enable-sigchild
>>>
>>>LDFLAGS="-L/usr/local/mysql/lib/mysql
>>>-L/u01/app/oracle/product/10.2/lib32 -L/usr/local/ssl/lib
>>>-L/usr/local/lib"
>>>
>>>How can I determine what it thinks is missing?
>>
>>....I take it you have looked in debug.log (whereever it lives)
>>for error messages? most probably you have, but it may have been
>>5am ;-)
>>
>>
>>>Thx,
>>>CC
>>>
>>
>>
>
> Yea, it is complaining about the wrong ELF type for the oracle libs. I
> have to manually tweak the Makefile, chaging product/10.2/lib to
> product/10.2/lib32 to get it to compile correctly. (even though
> LDFLAGS has the lib32 directory it still doesnt pick it up correctly)

but after the tweak it builds without errors but still gives segfault?

which worker module are you using with apache2? you have to use the prefork
module due to some non-threadsafe extensions in php (_IIRC_ Rasmus said that
its practically speaking impossible to know exactly what,where,why) ...
but you probably know that also :-/

<simpleton-idea>
maybe try building with php 5.0.2 or 5.0.3 to see
if the problem 'goes away' (for now)?
</simpleton-idea>

also have you tried running apache thru gdb and see what it spits out
when the segfault occurs? (regarding gdb, I can just about find the executable,
using it is another matter!)

>
> -CC

attached mail follows:


Hi,

I am working on Windows2003 Server. I tried unsuccessfully to install the
OLE/Spreadsheet package from the command line.

I went to www.pear.net and downloaded the packages. However, I was only
able to download as .tgz files. Where should these be located? Using PHP4.4

Please could you tell me how I can get these packages working on
Windows2003.

The error I receive from the command line:

"Connection to RPC server pear.php.net:80 failed..."

I get that when I type: "pear list-all", etc. and also when I type "pear
install OLE-0.5"

"pear list" works fine.

I would be very grateful for a quick reply.

Thank You.

Regards,

Kevin O'Brien.

attached mail follows:


kevin.o'brienpfpc.ie wrote:
> Hi,
>
> I am working on Windows2003 Server. I tried unsuccessfully to install the
> OLE/Spreadsheet package from the command line.
>
> I went to www.pear.net and downloaded the packages. However, I was only
> able to download as .tgz files. Where should these be located? Using PHP4.4
>
> Please could you tell me how I can get these packages working on
> Windows2003.
>
> The error I receive from the command line:
>
> "Connection to RPC server pear.php.net:80 failed..."

can you telnet to pear.php.net:80 ?
maybe its a firewall issue.

>
> I get that when I type: "pear list-all", etc. and also when I type "pear
> install OLE-0.5"
>
> "pear list" works fine.
>
> I would be very grateful for a quick reply.
>
> Thank You.
>
> Regards,
>
> Kevin O'Brien.
>

attached mail follows:


I'm wondering if someone has a better solution then I've come up with.
I've got a few reports that pull from various tables. Some times I'm
not able to put all the tables into a single query/view. So I end up
with a master query and 1 (or more) supporting queries. I'm using
MSSQL 2000/IIS/PHP4/ADODB. This may be my own weakness in designing a
query, I'm willing to learn if it is. So I've ended up doing things
like:

function formula($part,$array){
    //imagine a formula to calculate weeks in pipe for a part
    foreach($array AS $val){
        if($val[0]==$part){
        $qty = $val[1];
        }
    }
    return $qty;
}

$q1 = "SELECT part, fcast FROM parts";
$rs1 = $conn->Execute($s);
$rs1_arr = $rs1->GetArray();

$q2 = "SELECT part, qty FROM pos";
$rs2 = $conn->Execute($s);
$rs2_arr = $rs2->GetArray();

foreach($rs1_arr AS $data){
echo "Part: ".$data[0];
echo "Forecast: ".$data[1];
echo "POs: ".formula($data[0],$rs2_arr);
}

This is not a wonderful example, because I could LEFT JOIN pos to
parts. But I have more complex queries that have several INNER/LEFT
joins that once I bring in that last table to complete my query it
(the last table) skews my sums. Really I'm just wondering if others
have come across

--
Mike

attached mail follows:


Mike,

I recommend redesigning your query, the database can pull back the records
you want far quicker than any frontend combining/processing, since that's
what T-SQL and relational database were designed for.

I might be able to help you with the SQL, but I am a little rusty, not really
used it in 8 months. Maybe a MS-SQL/T-SQL forum will be able to help you with
optimising your query to get what you need, they are usually very helpful.

hth

C.

-----Original Message-----
From: Mike Smith [mailto:mikeosmithgmail.com]
Sent: 20 July 2005 17:39
To: php-generallists.php.net
Subject: [PHP] Combining recordsets

*************************************

This e-mail has been received by the Revenue Internet e-mail service.

*************************************

I'm wondering if someone has a better solution then I've come up with.
I've got a few reports that pull from various tables. Some times I'm
not able to put all the tables into a single query/view. So I end up
with a master query and 1 (or more) supporting queries. I'm using
MSSQL 2000/IIS/PHP4/ADODB. This may be my own weakness in designing a
query, I'm willing to learn if it is. So I've ended up doing things
like:

function formula($part,$array){
    //imagine a formula to calculate weeks in pipe for a part
    foreach($array AS $val){
        if($val[0]==$part){
        $qty = $val[1];
        }
    }
    return $qty;
}

$q1 = "SELECT part, fcast FROM parts";
$rs1 = $conn->Execute($s);
$rs1_arr = $rs1->GetArray();

$q2 = "SELECT part, qty FROM pos";
$rs2 = $conn->Execute($s);
$rs2_arr = $rs2->GetArray();

foreach($rs1_arr AS $data){
echo "Part: ".$data[0];
echo "Forecast: ".$data[1];
echo "POs: ".formula($data[0],$rs2_arr);
}

This is not a wonderful example, because I could LEFT JOIN pos to
parts. But I have more complex queries that have several INNER/LEFT
joins that once I bring in that last table to complete my query it
(the last table) skews my sums. Really I'm just wondering if others
have come across

--
Mike

--

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

************************

This message has been delivered to the Internet by the Revenue Internet e-mail service

*************************