Jump to content

Archived

This topic is now archived and is closed to further replies.

jeva39

Using mySql 5.0 functions with PHP

Recommended Posts

I understand that In order to have MySql 5.0 functions available in PHP, I must compile PHP with support for the mysqli extension. Please, how I can do this? I use PHP 4.3

Thanks!

Share this post


Link to post
Share on other sites
there is no diffrence with mysql and old mysql as a install setup read the mysql manual on there site.

good luck.

Share this post


Link to post
Share on other sites
The real problem is that all mysql functions don't work in PHP  and phpMyAdmin neither work (and the configuration is OK!).

Share this post


Link to post
Share on other sites
i dont mean to be rude bu you dont need such a high database version use a version that does work with you operating system then ok.

Share this post


Link to post
Share on other sites
If mysql functions are not working then the mysql extension hasnt been loaded correctly.

Create a new php file called it info.php. now add the following code to the file:
[code=php:0]<?php
phpinfo();
?>[/code]

Upload to your website, now goto mysite.com/info.php

Scroll down the page, do you see a MySQL section at all. To find the MySQL section when running the phpinfo function search for [b]mysql Support[/b] or [b]mysqlI Support[/b]. If you find a section and its the mysqli section you'll need to use the mysql[b]i[/b] functions and not the standard mysql functions, or use the mysql functions if its the standard mysql extension thats enabled. if you find nothing then the mysql extension has been enabled.

Share this post


Link to post
Share on other sites
Thanks wildteen88 for your help. I use NuSphere Editor for see the [b]phpinfo.php [/b] without need to upload the file and I found this. (I understand according to your post that [b]mysql [/b] functions are enabled, right?)


                       mysql
MySQL Support                  enabled
Active Persistent Links              0 
Active Links                            0 
Client API version                 3.23.49 

Directive                          Local Value              Master Value
mysql.allow_persistent            On                           On
mysql.connect_timeout           60                           60
mysql.default_host              no value                   no value
mysql.default_password       no value                   no value
mysql.default_port              no value                   no value
mysql.default_socket           no value                  no value
mysql.default_user              no value                  no value
mysql.max_links                  Unlimited                 Unlimited
mysql.max_persistent          Unlimited                 Unlimited
mysql.trace_mode              Off                           Off

The code I use for try an example is this: (Really I'm absolutely new to PHP. Allways I work with ASP/ASP.NET)

[code]......more code.....

<?php

$con = mysql_connect("localhost", "root", "doremi");
mysql_select_db("jv");
$sql = "select id,tema,ritmo, archivo,fecha from temas order by tema";

$queryexe = mysql_query($sql);
  print($queryexe);
while(mysql_fetch_row($queryexe))
    {
  $id = mysql_result($queryexe, 1); //Puede ser $id= odbc_result($queryexe, "id");
  $tema = mysql_result($queryexe, 2); 
  $ritmo = mysql_result($queryexe, 3);
  $archivo = mysql_result($queryexe, 4);
  $fecha = mysql_result($queryexe, 5);
?>
    <tr>
    <td class="listas" bgcolor="#f7efde"> <?php print ("$tema"); ?></td>
    <td class="listas" bgcolor="#f7efde"> <?php print ("$ritmo"); ?></td>
    <td class="listas" bgcolor="#f7efde"> <?php print ("$archivo"); ?></td>
    <td class="listas" bgcolor="#f7efde"> <?php print ("$fecha"); ?></td>
    </tr>
<?php }?>

........more code.......[/code]

This code don't send any error but don't process nothing!

Thanks again for your time....

Share this post


Link to post
Share on other sites
The mysql extension is enabled then as you can see the mysql section when you run the phpinfo function.

The only problems i see with your code is this:
[code]while(mysql_fetch_row($queryexe))
    {
  $id = mysql_result($queryexe, 1); //Puede ser $id= odbc_result($queryexe, "id");
  $tema = mysql_result($queryexe, 2); 
  $ritmo = mysql_result($queryexe, 3);
  $archivo = mysql_result($queryexe, 4);
  $fecha = mysql_result($queryexe, 5);
?>
    <tr>
    <td class="listas" bgcolor="#f7efde"> <?php print ("$tema"); ?></td>
    <td class="listas" bgcolor="#f7efde"> <?php print ("$ritmo"); ?></td>
    <td class="listas" bgcolor="#f7efde"> <?php print ("$archivo"); ?></td>
    <td class="listas" bgcolor="#f7efde"> <?php print ("$fecha"); ?></td>
    </tr>
<?php }?>[/code]
Change the highlighted code above to this:
[code=php:0]while($row = mysql_fetch_row($queryexe))
{
?>
    <tr>
      <td class="listas" bgcolor="#f7efde"><?php print $row['tema']; ?></td>
      <td class="listas" bgcolor="#f7efde"><?php print $row['ritmo']; ?></td>
      <td class="listas" bgcolor="#f7efde"><?php print $row['archivo']; ?></td>
      <td class="listas" bgcolor="#f7efde"><?php print $row['$fecha']; ?></td>
    </tr>
<?php
}
?>[/code]
Do you get anything now?

Share this post


Link to post
Share on other sites
Thanks but unfortunately don't work. If, with the same code (changing the "Connect" tag to ODBC format), I change the [b]mySql functions [/b] by [b]odbc functions [/b] work. Otherwise, no. I do not know what happens. In my Web Server neither work but by another reason: I don't know how or what privileges I need to manage mySql and although I send the ticket to consult the problem, not yet have responded to me. 

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.