note 81566 added to function.mysqli-multi-query

From: Date: Tue, 04 Mar 2008 12:13:43 +0000
Subject: note 81566 added to function.mysqli-multi-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-136726@lists.php.net to get a copy of this message
mysqli_multi_query handles MySQL Transaction on InnoDB's :-) <?php $mysqli = mysqli_connect( "localhost", "owner", "pass", "db", 3306, "/var/lib/mysql/mysql.sock" ); $QUERY = <<<EOT START TRANSACTION; SELECT @lng:=IF( STRCMP(main_lang,'de'), 'en', 'de' ) FROM main_data WHERE ( main_activ LIKE 1 ) ORDER BY main_id ASC; SELECT main_id, main_type, main_title, main_body, main_modified, main_posted FROM main_data WHERE ( main_type RLIKE "news|about" AND main_lang LIKE @lng AND main_activ LIKE 1 ) ORDER BY main_type ASC; COMMIT; EOT; $query = mysqli_multi_query( $mysqli, $QUERY ) or die( mysqli_error( $mysqli ) ); if( $query ) { do { if( $result = mysqli_store_result( $mysqli ) ) { $subresult = mysqli_fetch_assoc( $result ); if( ! isset( $subresult['main_id'] ) ) continue; foreach( $subresult AS $k => $v ) { var_dump( $k , $v ); } } } while ( mysqli_next_result( $mysqli ) ); } mysqli_close( $mysqli ); ?> ---- Server IP: 212.124.37.9 Probable Submitter: 91.33.34.92 ---- Manual Page -- http://www.php.net/manual/en/function.mysqli-multi-query.php Edit -- https://master.php.net/note/edit/81566 Del: integrated -- https://master.php.net/note/delete/81566/integrated Del: useless -- https://master.php.net/note/delete/81566/useless Del: bad code -- https://master.php.net/note/delete/81566/bad+code Del: spam -- https://master.php.net/note/delete/81566/spam Del: non-english -- https://master.php.net/note/delete/81566/non-english Del: in docs -- https://master.php.net/note/delete/81566/in+docs Del: other reasons-- https://master.php.net/note/delete/81566 Reject -- https://master.php.net/note/reject/81566 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#136726) next »