MySQL Forums
Forum List  »  PHP

PHP Mysql to MySQLi conversion
Posted by: Sameer Sachdeva
Date: April 22, 2016 07:16AM

I have an existing code built in WAMP PHP 5x version, but unable to convert it to XAMPP PHP7 mysqli.

This piece of code is to populate a dropdown with a unique ID that will be used to submit to next page or post method. I want replacement syntax of mysql with mysqli for this loop. I am assigning unique ID to dropdown (Var_tech_id), which will be passed on to the next page / post method. How can I convert this mysql_result to mysqli_ equivalent code? Please suggest.

while ($array = mysql_fetch_array($result))
{
$var_tech_id = mysql_result($con, $result,$i, 0);
$var_tech_name = mysql_result($con, $result,$i, 1);
print "<OPTION value=$var_tech_id>$var_tech_name</OPTION>";
$i++;
}
Please take a note that I tried couple of things mentioned in other forums, but it did not work for me

Options: ReplyQuote


Subject
Written By
Posted
PHP Mysql to MySQLi conversion
April 22, 2016 07:16AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.