Jump to content
Fórum Script Brasil
  • 0

mysqli


zmais

Question

Como mudar este código para myqli?

 

 <?
                mysql_query("SET NAMES utf8");
                $sq7 = "select count(*) as total from testes_questoes as que ";
                $re8 = mysql_query($sq7) or die(mysql_error());
                $re7 = mysql_fetch_array($re8);
                $total6 = $re7["total"];
                $total6 = number_format($total6, 0, ',', '.');

                $teste = strtoupper($busca);

                mysql_query("SET NAMES utf8");
                $sql = "select codigo,nome from testes_categorias order by nome";
                $resultado = mysql_query($sql) or die(mysql_error());
                $enc = mysql_num_rows($resultado);

                if ($enc == 1) {
                    $regver = "REGISTRO ENCONTRADO";
                } else {
                    $regver = "REGISTROS ENCONTRADOS";
                }

                ?>

<?
                    while ($li = mysql_fetch_array($resultado)) {
                        $des = strtoupper($li["nome"]);
//                        $des = utf8_encode($des);
                        $codcate = $li["codigo"];

                        mysql_query("SET NAMES utf8");
                        $sq7 = "select count(*) as total from testes_questoes as que where que.codcate='$codcate'";
                        $re8 = mysql_query($sq7) or die(mysql_error());
                        $re7 = mysql_fetch_array($re8);
                        $total5 = $re7["total"];
                        $total5 = number_format($total5, 0, ',', '.');

                        ?>

 

<?
                        mysql_query("SET NAMES utf8");
                        $sql2 = "select codigo,upper(nome) as nome from testes_subcategorias where codcate=" . $codcate . " order by nome";
                        $resultado2 = mysql_query($sql2) or die(mysql_error());

                        while ($li2 = mysql_fetch_array($resultado2)) {
                            $cod2 = $li2["codigo"];
                            $des2 = strtoupper($li2["nome"]);
//                            $des2 = utf8_encode($des2);

                            mysql_query("SET NAMES utf8");
                            $sq7 = "select count(*) as total from testes_questoes as que where que.subcate='$cod2'";
                            $re8 = mysql_query($sq7) or die(mysql_error());
                            $re7 = mysql_fetch_array($re8);
                            $total5 = $re7["total"];
                            $total5 = number_format($total5, 0, ',', '.');

                            ?>

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      148691
    • Total Posts
      644524
×
×
  • Create New...