Since moving to updated php 5.3.x I've been unable to continue my happy trail of using my old format of $queryb2="SELECT whatever FROM whereever WHERE username='$user' "; $resultb2=mysql_query($queryb2); $bank2=mysql_result($resultb2,"bank2"); Code (markup): without throwing some BS error about Boolean... Sooo now that we are into the new age with the "i" - can someone explain to me, in example code, how to achieve the same result with updated php code for "mysql I" ?
$bank2 = mysql_fetch_array($resultb2); This is assuming you are selecting only a single row. Otherwise you need to loop through the result set.
The first thing I'd ask is why not use mysql_fetch_object or mysql_fetch_array if you're returning a single row from the database? Also, mysqli supports the same type of procedural style as the legacy mysql_* queries, though object-oriented just makes more sense to use. Quick examples: //procedural mysqli select $db = mysqli_connect("localhost", "user", "pass", "database_name"); $query = "select bankCode, bankName from banks where bankId = " . $whateverId; $result = mysqli_query($db, $query); $thisBank = mysqli_fetch_array($result); echo "Bank Code: " . $thisBank["bankCode"] . "<br/>"; echo "Bank Name: " . $thisBank["bankName"]; //object oriented mysqli select (cleaner code) $db = new mysqli("localhost", "user", "pass", "database_name"); $result = $db->query("select bankCode, bankName from banks where bankId = " . $whateverId); $thisBank = $result->fetch_object(); echo "Bank Code: " . $thisBank->bankCode . "<br/>"; echo "Bank Name: " . $thisBank->bankName; //could also be written as $db = new mysqli("localhost", "user", "pass", "database_name"); $thisBank = $db->query("select bankCode, bankName from banks where bankId = " . $whateverId)->fetch_object(); echo "Bank Code: " . $thisBank->bankCode . "<br/>"; echo "Bank Name: " . $thisBank->bankName; Code (markup): Check the manual pages for myqli on php.net for examples of pretty much any type of query you'd want to run. Hope this helped you.