Jump to content

mauri_gato

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mauri_gato's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you wildteen88, it was my mistake. I had 2 conexion files in my server (that dreamweaver made) and just one in my computer. That's why one was uppercase and the other was not. Really appreciated your help, thanks a lot.
  2. I am developing a site that uses multiple queries. [b]It works fine on my remote server of my company[/b]. But when i use my own prove server with Apache or even IIS and PHP 4 and even 5 i get the same error when executing a query: [b]Notice: Undefined variable: Clinica in e:\Inetpub\wwwroot\Prueba\Bienvenida5.php on line 79 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in e:\Inetpub\wwwroot\Prueba\Bienvenida5.php on line 79[/b] I don't know what might be happening, i have the exact copy of the site in my system. Here is the section code that doesn't run: [code]           <TR>             <TD height="             <?php                 mysql_select_db($database_clinica, $clinica);                 $query_rsMenu = "SELECT COUNT(m.menCod) * 21 AS Total FROM Menu m, Privilegio p, Grupo g, Miembro i, Usuario u WHERE m.menSuperior IS NULL AND m.menCod = p.menCod AND p.gruCod = g.gruCod AND i.gruCod = g.gruCod AND i.usuCod = u.usuCod AND u.usuNombre = '".$_SESSION['usuNombre']."'";                 $rsMenu = mysql_query($query_rsMenu, $Clinica) or die(mysql_error());                 $row_rsMenu = mysql_fetch_assoc($rsMenu);                 echo $row_rsMenu['Total'];             ?>">&nbsp;<?php echo($query_rsMenu); ?></TD>           </TR> [/code] The code should generate the height of a column in base of $_SESSION['usuNombre']. Help me please, thank you guys.
  3. Thank you guys, that was my mistake. I don't completely understand why it must be declared as global, but i really appreciated your help.
  4. I think my query is good, because this code runs as i want: [code] <?php require_once('../Connections/Clinica.php'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Documento sin t&iacute;tulo</title> </head> <body>             <table width="95%" border="0" cellspacing="3" align="center">     <tr>       <td><div align="center"><strong>Apellido Paterno </strong></div></td>       </tr>     <tr>         <td><div align="center"><?php //fun();               mysql_select_db($database_Clinica, $Clinica);             $query = "SELECT enfAP FROM Enfermera";             $rs = mysql_query($query, $Clinica) or die(mysql_error());             $row = mysql_fetch_assoc($rs);             echo $row['enfAP'];         ?></div></td>     </tr>   </table> </body> </html> [/code] However when i use that code in a function, it doesn't work, here is the code: [code] <?php require_once('../Connections/Clinica.php'); ?> <?php function fun() {     mysql_select_db($database_Clinica, $Clinica);     $query = "SELECT enfAP FROM Enfermera";     $rs = mysql_query($query, $Clinica) or die(mysql_error());     $row = mysql_fetch_assoc($rs);     echo $row['enfAP']; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Documento sin t&iacute;tulo</title> </head> <body>             <table width="95%" border="0" cellspacing="3" align="center">     <tr>       <td><div align="center"><strong>Apellido Paterno </strong></div></td>       </tr>     <tr>         <td><div align="center"><?php fun();  ?></div></td>     </tr>   </table> </body> </html> [/code] When i declare those variables as globals neither code runs, help me please...
  5. I need to execute a query inside a function in php. Then i used this instruction: mysql_query(), which works fine outside a function. Nevertheless when i use it inside a funcion it just doesn't execute the query and the page loading stops there. Here is a simple example to show you what is going on: <?php require_once('./Connections/Con.php'); function fun() { mysql_select_db($database, $Con); $query = "SELECT enfAP FROM Enfermera where enfCod=1"; [b]$rs = mysql_query($query, $Con) or die(mysql_error()); //Here is where the execution stops[/b] $row = mysql_fetch_assoc($rs); echo $row['Col1']; } ?> <!--Some html code...--> <?php [b] fun(); //Here i call the function [/b] ?> Please help me, is there another way to execute a query inside a function?, Thanks mauricio
×
×
  • Create New...

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.