|
gi- posted:So I just upgraded my hosting environment. Went from PHP4 to PHP5 and getting this error 'Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource' PHP.net posted:For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.
|
# ¿ Mar 25, 2008 16:14 |
|
|
# ¿ Apr 29, 2024 17:42 |
|
Or download the php function look up extension for PHP here : http://www.folta.info/blog/
|
# ¿ Mar 26, 2008 21:25 |
|
I am trying to implement a reversible sort a 2d array by an arbitrary key in the second level function. So I used an insertion sort (or it's based on an insertion sort rather): php:<? function sort_list($array,$index="person_id",$direction) { //$array[0] = "person_id"=> 1223523,"class"=>"Shakespeare","type"=>"Final",etc... $max = count($array); if ( $direction == "asc" ) { for($j=1; $j < $max; $j++){ $temp = $array[$j]; $i = $j; while(!empty($array[$i-1]) && ($i >= 0) && ($array[$i-1][$index] > $temp[$index])){ $array[$i] = $array[$i-1]; $i--; } $array[$i] = $temp; } } else if ( $direction == "desc" ) { for($j=1; $j < $max; $j++){ $temp = $array[$j]; $i = $j; while( !empty($array[$i-1]) && ($i >= 0) && ($array[$i-1][$index] < $temp[$index])){ $array[$i] = $array[$i-1]; $i--; } $array[$i] = $temp; } } return $array; } ?>
|
# ¿ Jun 16, 2008 19:04 |
|
bt_escm posted:I have to question where you're getting the data from that you would need to sort it in php? It is a combination of physical file data and stuff from db, sortable by the user as needed. As some of it isn't db related I can't let the DB sort the data for me. But if you have any suggestions, feel free to offer them.
|
# ¿ Jun 17, 2008 03:16 |
|
php:<? $_SESSION['current_vendor'] or $_SESSION['current_vendor'] = $r[2]; ?>
|
# ¿ Aug 12, 2008 17:54 |
|
|
# ¿ Apr 29, 2024 17:42 |
|
I hate the guy that worked here before me so much. EDIT: Of the six or so apps that I enhance, unfuck and add functionality to, I have at least 10 pages that are 1000+ line switch statements that just end because the one loving function the guy bothered to write in his entire life calls something that includes something that started an output buffer and defined a preg_replace that calls a template and then somehow magically shits out a page that is functional. iamstinky fucked around with this message at 21:39 on Aug 12, 2008 |
# ¿ Aug 12, 2008 19:46 |