Datingboom ru

Rated 3.83/5 based on 708 customer reviews

Don't fetch BOTH unless you really need them, and most of the time you don't.The constructor builds an array that maps each field index to a ($table, $column) array so we can use mysql_fetch_row and access field values by index in the fetch() method.If you think My SQL (or other) database handling is difficult and requires lot's of code, I recommend that you try Gen is a program source code generator that supports PHP and Java. If you perform a SELECT query which returns different columns with duplicate names, like this: -------- $sql_statement = "SELECT tbl1A, tbl2A FROM tbl1 LEFT JOIN tbl2 ON tbl1C = tbl2C"; $result = mysql_query($sql_statement, $handle); $row = mysql_fetch_array($result); -------- Then $row[0] is equivalent to $row["col A"] but $row[1] is not equivalent to $row["col A"]. note - or you could do the usual 'select tbl1A as somename, tbl2A as someothername. Because of this, you can not loop through a resource result twice in the same script before resetting the pointer back to the start position.

it's even faster to use fetch_row rather than passing fetch_array MYSQL_NUM, or fetch_assoc rather than fetch_array MYSQL_ASSOC.

i've got no more problems with it, just drop it in your script:/** mysql_fetch_array_nullsafe*** get a result row as an enumerated and associated array* ! ** parameter: $result* $result: valid db result id** returns: array | false (mysql:if there are any more rows)**/function mysql_fetch_array_nullsafe($result) I ran into troubles with My SQL NULL values when I generated dynamic queries and then had to figure out whether my resultset contained a specific field.

First instict was to use isset() and is_null(), but these function will not behave as you probably expect.

I am not using multitple connections so I removed the link and using the global link.

If you want to support multiple links check to see if its set first./** to support multiple links add the $link argument to function then* test it before you use the link** if(isset($link))* if($err=mysql_errno($link))return $err;* else* if($err=mysql_errno())return $err;*/function mysql_fetch_all($query)function mysql_fetch_one($query) Try Php Object Generator: kind of similar to Daogen, which was suggested in one of the comments above, but simpler and easier to use.

Leave a Reply