[ale] [OT] need help with 2php SOLUTION

ChangingLINKS.com x3 at ChangingLINKS.com
Fri Apr 11 22:20:46 EDT 2003


He is currently running software that I invented (and he wrote) that helps 
promote several web sites. It ties up his entire computer (CPU)  and he is 
practically doing it for free even though it will take a month to run the 
process.

If you have caller ID, you will notice that I tried to reach you right after 
posting to the list. ;)

When that failed,  I asked my 1st (American) programmer to help, and he did, 
which is really how I was able to break through the problem. The first 
programmer is also a pro bowler and a good friend. He helped me even though 
he is on tour. We hung out the other day when he came to Austin. He is great 
to go out with because he converts ladies he meets into girlfriends within 
the night (every time).

Because the RomanianmovedtoCanada has given so much, I only ask him for help 
when no one else can solve the problem quickly. I consider him a partner now, 
because he was still working - even when I wanted to quit. I can't think of 
anyone (outside of my wife - and a guy that loaned me $5500 cash *with 
nothing in writing* the first day I met him) that has trusted me the way he 
has.

Nonetheless, I still have a few features I want to add to ChangingLINKS, so I 
am thinking about finding a new programmer to "do the small stuff" that is 
left. The Romainian snatched up a contracting job <ducking as the HB1 debate 
springs to life again>.
-- 
Wishing you Happiness, Joy and Laughter,
Drew Brown
http://www.ChangingLINKS.com


On Fri April 11 2003 19:18, Geoffrey wrote:
> Hey, where's that cheap contractor you had from Canada?  Sorry, couldn't
> help it. :)
>
> ChangingLINKS.com wrote:
> > No. You misunderstand. The data changes.
> >
> >
> > query data (value=1)
> > function adds 1 (+1) or subtracts 1 (-1) and updates the database
> > query data (because the new value equals 0 or 2)
> >
> > What was happening was:
> >  query data (value equals 1)
> >  function (modifies data)
> >  **set a variable based on the above query, and value will equal 1.
> >
> > **At this point, you must run another query to find out what the NEW
> > value is. (or possible set variables that let you know what the function
> > did).
> >
> >
> > I am wondering if there is a good use for this "law."
> >
> > Drew
> >
> > On Fri April 11 2003 08:11, George Carless wrote:
> >>I'm really not sure what you're referring to, here.. there's no reason to
> >>re-query a database for data if you already know what the data has been
> >>set to.  Perhaps posting some actual (rather than psuedo) code would help
> >>explicate the situation?
> >>
> >>I didn't quite understand Brian's example, either (and I do this stuff
> >> for a living) .. Brian, did you mean something like:
> >>
> >>if (myfunction($param)) {
> >>	echo "Sendemail";
> >>}
> >>
> >>
> >>?  Or am I missing something?  Your example
> >>wouldn't seem to parse, from where I'm sitting.  But the general notion
> >> of checking for the return value is a sound one.
> >>
> >>Cheers,
> >>--George
> >>
> >>On Fri, 11 Apr 2003, ChangingLINKS.com wrote:
> >>>Man, you can't "be" talkin' to a script-kiddie like that. :) That stuff
> >>>was over my head. I just spent 5 minutes trying to log into my ftp
> >>> server with incorrect login errors *because my caps lock was pressed
> >>> down. . . .*
> >>>
> >>>again.
> >>>
> >>>Anyway, the solution to the problem was much more simple than the
> >>>appreciated recommendations.
> >>>
> >>>Lesson learned:
> >>>If you pull a query from a database and then alter the data with a
> >>>function, you must query the database again instead of using a variable
> >>>that was set by the original query.
> >>>
> >>>wrong:
> >>> query
> >>> set variables A-E
> >>> function
> >>> echo variable C (this will reflect the A-E state of the database)
> >>>
> >>>right:
> >>>query
> >>>set variables A-E
> >>>function
> >>>query (even if this is in the function is seems to be essential)
> >>>set variable C
> >>>echo variable C
> >>>
> >>>One day I will buy a book about PHP and read instead of coding by trial
> >>>and error. :) Thanks for the help!!
> >>>
> >>>--
> >>>Wishing you Happiness, Joy and Laughter,
> >>>Drew Brown
> >>>http://www.ChangingLINKS.com
> >>>
> >>>On Thu April 10 2003 13:33, Brian wrote:
> >>>>How about having the function return a boolean and do
> >>>>this instead:
> >>>> if (function($sendemail($param)) {
> >>>>     echo "Sendemail";
> >>>> }
> >>>>
> >>>>Otherwise, you can set $sendmail as a global variable
> >>>>and have your function return a the new $sendmail
> >>>>value. You can also pass $sendmail using the pass by
> >>>>reference operator "&". This way, the function will
> >>>>affect the variable $sendmail upon return.
> >>>>
> >>>>><?php
> >>>>>connect to database
> >>>>>select a record
> >>>>>set variable $res that counts number of rows
> >>>>>	if( mysql_num_rows( $res ) > 0 )
> >>>>>	{
> >>>>>	$set variables for information in columns
> >>>>>	include ("file with function that alters records");
> >>>>>	call the function
> >>>>>		the function sets a variable $sendemail "yes" or
> >>>>>"no"
> >>>>>	{
> >>>>>	if( $sendemail == "yes" )
> >>>>>	{
> >>>>>	echo "$sendemail";
> >>>>>	}
> >>>>>  }
> >>>>>?>
> >>>>>
> >>>>>The problem is that no matter what I do in the
> >>>>>function (which works) the
> >>>>>calling script does NOT recognize the results of the
> >>>>>function. The calling
> >>>>>script can only see the state the database was in
> >>>>>before calling the
> >>>>>function.
> >>>>>
> >>>>>Why?
> >>>>>
> >>>>>Can't a function in another file set a variable that
> >>>>>is recognized by the
> >>>>>calling script? If not, how come the calling script
> >>>>>does not recognize the
> >>>>>update to the database either?
> >>>>>
> >>>>>Can someone help me write the 2 *working* lines that
> >>>>>will recognize the work
> >>>>>of the function?
> >>>>>(I tried removing the { before the second if and the
> >>>>>} after the last
> >>>>>$sendemail)
> >>>>>
> >>>>>--
> >>>>>Wishing you Happiness, Joy and Laughter,
> >>>>>Drew Brown
> >>>>>http://www.ChangingLINKS.com
> >>>>>_______________________________________________
> >>>>>Ale mailing list
> >>>>>Ale at ale.org
> >>>>>http://www.ale.org/mailman/listinfo/ale
> >>>>
> >>>>__________________________________________________
> >>>>Do you Yahoo!?
> >>>>Yahoo! Tax Center - File online, calculators, forms, and more
> >>>>http://tax.yahoo.com
> >>>>_______________________________________________
> >>>>Ale mailing list
> >>>>Ale at ale.org
> >>>>http://www.ale.org/mailman/listinfo/ale
> >>>
> >>>_______________________________________________
> >>>Ale mailing list
> >>>Ale at ale.org
> >>>http://www.ale.org/mailman/listinfo/ale
> >>
> >>_______________________________________________
> >>Ale mailing list
> >>Ale at ale.org
> >>http://www.ale.org/mailman/listinfo/ale


_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list