Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Location
    Belgium
    Posts
    23

    Unanswered: problem with variables

    Hi,

    I've passed a variable $userCheck with a session, when I display it on my page (<?php echo $userCheck; ?>), it works correct.
    But when I want to use it in a query, and show the dynamic table, it won't work.
    What am I doing wrong ???

    Please help me, thanks in advance !!!!



    Code:
    <?php
    $maxRows_Admins = 10;
    $pageNum_Admins = 0;
    if (isset($HTTP_GET_VARS['pageNum_Admins'])) {
      $pageNum_Admins = $HTTP_GET_VARS['pageNum_Admins'];
    }
    $startRow_Admins = $pageNum_Admins * $maxRows_Admins;
    
    $colname_Admins = "Yveske";
    if (isset($HTTP_SESSION_VARS['userCheck'])) {
      $colname_Admins = (get_magic_quotes_gpc()) ? $HTTP_SESSION_VARS['userCheck'] : addslashes($HTTP_SESSION_VARS['userCheck']);
    }
    mysql_select_db($database_fisherintranet, $fisherintranet);
    $query_Admins = sprintf("SELECT * FROM Admins WHERE username = '%s' ORDER BY company ASC", $colname_Admins);
    $query_limit_Admins = sprintf("%s LIMIT %d, %d", $query_Admins, $startRow_Admins, $maxRows_Admins);
    $Admins = mysql_query($query_limit_Admins, $fisherintranet) or die(mysql_error());
    $row_Admins = mysql_fetch_assoc($Admins);
    
    if (isset($HTTP_GET_VARS['totalRows_Admins'])) {
      $totalRows_Admins = $HTTP_GET_VARS['totalRows_Admins'];
    } else {
      $all_Admins = mysql_query($query_Admins);
      $totalRows_Admins = mysql_num_rows($all_Admins);
    }
    $totalPages_Admins = ceil($totalRows_Admins/$maxRows_Admins)-1;
     include("../include/intranet_admin.php"); ?>

    dynamic table :
    Code:
    <table border="1" cellpadding="0" cellspacing="0">
      <tr> 
        <td>ID</td>
        <td>username</td>
        <td>company</td>
      </tr>
      <?php do { ?>
      <tr> 
        <td><?php echo $row_Admins['ID']; ?></td>
        <td><?php echo $row_Admins['username']; ?></td>
        <td><?php echo $row_Admins['company']; ?></td>
      </tr>
      <?php } while ($row_Admins = mysql_fetch_assoc($Admins)); ?>
      
    </table>
    You help me, and I'll try to help you

  2. #2
    Join Date
    May 2003
    Location
    KOREA Kyong-ju city
    Posts
    3

    Re: problem with variables

    HI'
    You Change Coding "<?php echo $userCheck; ?>" ==> "<?=$userCheck?>".....
    OK!
    Last edited by HBLEE; 05-28-03 at 00:03.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •