Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- My Enterprise Module code has this method:
- function dbArray ( $sql, $connect=NULL ) {
- /***********************************************************************/
- /* Function: dbQuery() */
- /* Purpose: Runs the database query string & returns the results or */
- /* reports errors. */
- /***********************************************************************/
- $row_ray = array();
- $newquery = sprintf( "insert into qry_errors (error_desc) values ".
- "('%s')", addslashes($sql));
- switch ($this->db_eng) {
- case 'mysql': // Process MySQL Engine
- echo "C=> $connect \n";
- $res = mysql_query ( $sql, $connect );
- if ($res == false) {
- echo "C=> $connect \n";
- $res = mysql_query ( $newquery, $connect ) or die ( mysql_error () );
- } // end if $result
- while ( $row = mysql_fetch_assoc ( $res ) ) {
- $row_ray[] = $row;
- } // end while $row
- break;
- case 'pgsql': // Process PostGres Engine
- $res = pg_query( $sql, $connect );
- if ($res == false) {
- $res = pg_query( $newquery, $connect ) or
- die("Error: Query failed with query string:<BR>$sql");
- } // end if $result
- while ( $row = pg_fetch_row ( $res ) ) {
- $row_ray[] = $row;
- } // end while $row
- break;
- //case 'oracle': // Process Oracle Engine
- // break;
- //case 'mssql': // Process MS-SQL Engine
- // break;
- //case 'sybase': // Process SyBase Engine
- // break;
- } // end switch
- if (dbNRows($res)==0) {
- return 0;
- } else {
- return $row_ray;
- }
- //echo "S=> $this->db_sql <br>";
- } // end function dbQuery
- It was working fine but suddenly started giving errors:
- C=> Resource id #12
- PHP Warning: mysql_query() expects parameter 2 to be resource, string given in /home/path/EM/em_dio/em_dio.php on line 138
- C=> Resource id #12
- PHP Warning: mysql_query() expects parameter 2 to be resource, string given in /home/path/EM/em_dio/em_dio.php on line 141
- That is when I put in the comment lines that show parm 2 is actually a 'resource'. Does anyone know why this would change and cause these errors?
- Cheers!
- OMR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement