Liam,
I'm not familiar with the Zend IDE. I'm downloading now for a test
drive. However, I tried looking at your problem from a code
perspective.
I pulled this example from php.net's mysql_fetch_array description:
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf("ID: %s Name: %s", $row[0], $row[1]);
}
They use the optional second argument, but otherwise your code is
identical.
Normal while iterations are conditional, evaluating the statement at
the beginning of each iteration. Using assignment in a while condition
check _should_ always evaluate to true, looping forever. Thus, tripping
up the Zend bug engine.
However, mysql_fetch_array function uses an internal data pointer to
travel the array incrementally. When it reaches the end of the array,
it causes the while to evaluate to false, breaking out of the loop. If
you were to use an equality evaluator (==), it would always evaluate as
false, as $row_pass will never equal mysql_fetch_array( $result_pass )
The Zend bug engine should recognize such special functions. It
apparently does not.
Incidentally, I don't like using the mysql_fetch_array function because
of this. It hides what's going on. To me, a programmer should be able
to look at code and immediately recognize the logical progression.
Nowhere in this code can we see the data pointer advancing through the
array. It's confusing to someone not intimately familiar with the
standard library.
Because of this--even though it takes a little more time--I always use
for ( $i = 0; $i < count( $my_array ); $i++ ) type iteration with SQL
results. It's easier to read and immediately understand.
Sorry I couldn't help with the Zend problem, though.
Good luck,
-Dan
news@celticbear.com wrote:[color=blue]
> I'm trying out the Zend Development Environment 4, and for the most
> part I like it, except for two things.
>
> It seems to think certain lines that are perfectly valid are bugs.[/color]
Like[color=blue]
> this:
>
> while ($row_pass = mysql_fetch_array($result_pass)) {
>
> It gives an "Assignment in Condition" error whenever it encounters a
> line like that, which is a lot. It gives a little explanation box
> giving it a "Category: Bug" and goes on to explain how variables[/color]
should[color=blue]
> go on the right-hand side of an equality statement, and double equals
> should be used, like this:
>
> if ($x == "1") {
>
> Yeah, for logicals, but when assigning an array to a mySQL querey,[/color]
I've[color=blue]
> always used
> while ($row_pass = mysql_fetch_array($result_pass)) {
> and it works perfectly.
>
> Is there a way to get Zend to recognize this, ignore this, or am I
> doing something wrong in that line of code I've used for years[/color]
without[color=blue]
> problem?
>
> Thanks!
>
> Oh, the other problem I'm having involves it not being able to[/color]
connect[color=blue]
> to any mySQL database except as root, even if another mySQL account[/color]
has[color=blue]
> full privileges, etc. But I'll deal with this later I guess.
>
> Thanks,
> Liam[/color]