note 95049 added to function.explode

From: Date: Thu, 10 Dec 2009 19:11:25 +0000
Subject: note 95049 added to function.explode
Groups: php.notes 
Request: Send a blank email to php-notes+get-163825@lists.php.net to get a copy of this message
/* Convert mysql_fetch_array in an php array */ $sql = "CREATE TABLE IF NOT EXISTS country ( iso varchar(2) collate latin1_general_ci NOT NULL, country varchar(80) collate latin1_general_ci NOT NULL, PRIMARY KEY (iso)) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;"; $exesql = mysql_query($sql); $country = "INSERT INTO country (iso, country) VALUES ('AD', 'Andorra'), ('AF', 'Afghanistan'),('AI', 'Anguilla'),('AL', 'Albania'),('AM', 'Armenia'),('AO', 'Angola');"; $insert = mysql_query($country); $view = "SELECT * FROM country;"; $result = mysql_query($view); $p = ""; while ($theco = mysql_fetch_array($result)) { $p .= "".$theco['country']."-"; } $myarray = explode("-", $p); echo "".$myarray[0]."<br />"; echo "".$myarray[1]."<br />"; echo "".$myarray[2]."<br />"; ---- Server IP: 69.147.83.197 Probable Submitter: 151.56.179.20 ---- Manual Page -- http://www.php.net/manual/en/function.explode.php Edit -- https://master.php.net/note/edit/95049 Del: integrated -- https://master.php.net/note/delete/95049/integrated Del: useless -- https://master.php.net/note/delete/95049/useless Del: bad code -- https://master.php.net/note/delete/95049/bad+code Del: spam -- https://master.php.net/note/delete/95049/spam Del: non-english -- https://master.php.net/note/delete/95049/non-english Del: in docs -- https://master.php.net/note/delete/95049/in+docs Del: other reasons-- https://master.php.net/note/delete/95049 Reject -- https://master.php.net/note/reject/95049 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#163825) next »