Jump to content


Photo

Using mySql 5.0 functions with PHP


  • Please log in to reply
7 replies to this topic

#1 jeva39

jeva39
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 09 September 2006 - 06:21 AM

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!

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 09 September 2006 - 06:30 AM

there is no diffrence with mysql and old mysql as a install setup read the mysql manual on there site.

good luck.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 jeva39

jeva39
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 09 September 2006 - 06:57 AM

The real problem is that all mysql functions don't work in PHP  and phpMyAdmin neither work (and the configuration is OK!).

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 09 September 2006 - 07:01 AM

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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 09 September 2006 - 10:33 AM

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:
<?php
phpinfo();
?>

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 mysql Support or mysqlI Support. If you find a section and its the mysqli section you'll need to use the mysqli 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.

#6 jeva39

jeva39
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 09 September 2006 - 05:17 PM

Thanks wildteen88 for your help. I use NuSphere Editor for see the phpinfo.php without need to upload the file and I found this. (I understand according to your post that mysql 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)

......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.......

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

Thanks again for your time....

#7 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 09 September 2006 - 06:10 PM

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:
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 }?>
Change the highlighted code above to this:
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
}
?>
Do you get anything now?


#8 jeva39

jeva39
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 09 September 2006 - 09:48 PM

Thanks but unfortunately don't work. If, with the same code (changing the "Connect" tag to ODBC format), I change the mySql functions by odbc functions 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. 




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users