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

ChangingLINKS.com x3 at ChangingLINKS.com
Fri Apr 11 15:47:43 EDT 2003


Yes. I have not been able to communicate it well because I am not a 
programmer. However, per your suggestion, I snippets from the actual code 
showing the problem and solution. Ironically, I was able to communicate all 
of this to a programmer who didn't speak english well.

<?
	//changebot lives!

	$with0s = "select * from table where code in( 'nu', '201' ) order by code 
limit 1";
	$res = mysql_query($with0s);
	if( mysql_num_rows( $res ) > 0 )
	{
//setting variables for the values in the columns
		$url = mysql_result($res,0,"url");
		$count = mysql_result($res,0,"count");
		$contacts =  mysql_result($res,0,"contacts");
		$linked = mysql_result($res,0,"linked");
		$id = mysql_result($res,0,"id");
//nodup function
		include ("noduplicate.php");
		deleteDuplicatedValues($url, $id);

/* CODE THAT DIDN'T WORK RIGHT
//this will show the value BEFORE the function was processed.
//this will not show the current value in column code.
		$code = mysql_result($res,0,"code");
		if($code != "newvaluesetbythefunction")
		echo "who\'s your daddy!"
*/

//HERE I run another query instead (CODE THAT DOES WORK)
  		$afternodup = "select code from links where id='$id'";
  		$nodupped = mysql_query($afternodup);
		$newcode = mysql_result($nodupped,0,"code");
		if( $newcode != "oldvalue" )
		{
		echo "It's ALL good!!!";
		

On Fri April 11 2003 14:06, George Carless wrote:
> Drew,
>
> You're not making things any clearer, for me at least.  Since you've
> written this in PHP (as I understand it), why not post the PHP?
>
> > No. You misunderstand. The data changes.
> >
> > query data (value=1)
> > function adds 1 (+1) or subtracts 1 (-1) and updates the database
>
> Adds or subtracts 1 to what?  To the data in the database?
>
> > query data (because the new value equals 0 or 2)
>
> But if you have already queried the database for the value, before
> updating it, then why would you need to re-query the database?  (Unless to
> check that no other user/code/whatever had itself updated the database in
> the meantime - but then, you're locking your tables, right?)
>
> > I am wondering if there is a good use for this "law."
>
> I've no idea what 'law' you're referring to, I'm afraid.
>
> --George
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale

-- 
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





More information about the Ale mailing list