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

George Carless kafka at antichri.st
Fri Apr 11 16:04:25 EDT 2003


Okay.  Now things make a little more sense.

A few comments (and I know you're not a programmer, but you might
nonetheless want to consider them):

> 		$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");

Consider using mysql_fetch_array() or mysql_fetch_object().  Or, in this
case, you could simply do:

list($url,$count,$contacts,$linked,$id) = mysql_fetch_row($res);

> //nodup function
> 		include ("noduplicate.php");
> 		deleteDuplicatedValues($url, $id);

Without knowing what exactly deleteDuplicatedValues does, this ain't too
helpful.  But, you probably should use something like $url =
deleteDuplicatedValues($url,$id) and have your deleteDuplicatedValues
function return $url.  I think I see what you're trying to get at, though:
your function modifies the database, and you're expecting your $res
resultset to immediately reflect the update.  And you're right, that's not
gonna happen - but I imagine there are more elegant solutions than
re-querying the database.  Again, though, it's difficult to say because
I'm not sure what you're trying to do, overall.

> /* 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!"

I'm really not sure what you're trying to do here -- what is
"newvaluesetbythefunction"?  I mean, that's just a string -- why on earth
would $code equal it?  Oh, and you don't need to escape single quotes when
they appear within double quotes.

Incidentally, whenever I see mention of "duplicates" in the realm of
databases, it suggests to me a flawed database schema.  You shouldn't ever
really need to do something like "delete duplicate values" from a
well-designed schema since it should preclude redundant data in and of
itself.

Anyhow, my brain hurts from real work and it's time for me to go home
anyhow, so I'll leave it at that.

--G

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





More information about the Ale mailing list