Well, technically the syntax is correct, but the use of the functions are not. You're basing your while loop on a query... But unless i am misunderstanding your code, you should be basing your while loop on the query results. Assuming the query is running correctly, it will always return true, and so you end up with an infinite loop, hence why the max execution time is being reached.
Edit: after looking at the query more, i am not sure what your code is trying to achieve. If your query is pulling a post_title from the post_name (which should be unique in wordpress), your query should only ever be returning one row, so it wouldn't make any sense to base a while loop off of it.
Last edited by Jarrod1937; 07-12-2010 at 09:32 AM.
My previous response was using the SQL COUNT() function to get the count of matches, instead of having to loop through all the results in the PHP code in order to do the same thing: count the matches.
In actuality, though, I suspect I would concatenate the DB row's ID (assuming it's an auto-increment integer) rather than go through these contortions, which might have unforeseen side effects if a record gets deleted. In addition, that would remove the query and related processing, adding some efficiency to the process.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation