0

I am trying to fetch values from database, seems like i am fetching it right, but upon execution it is not working. it shows blank page, please guide as i am new to the PHP an MySql

$query = "select * from tbladmin";
$rs = mysql_query($query);
$html ="";
$i=1;

while($row = mysql_fetch_array($rs))
{
    $html .='<tr>
                 <td>'.$row['adm_id'].'</td>
                 <td>'.$row['adm_name'].'</td>
                 <td>'.$row['adm_email'].'</td>
                 <td>'.$row['adm_password'].'</td>
                 <td>'.$row['adm_gender'].'</td>
                 <td>
                     <img src="Uimages/'.$row['adm_photo'].'"
                          height="90%" 
                          width="90%" 
                          alt="No Photo"
                 </td></td>
             </tr>';
    $i=1;
}

<table class="listing" cellpadding="0" cellspacing="0">   
    <tr>
        <th bgcolor="#999999" scope="col"><strong>ID</strong></th>
        <th bgcolor="#999999" scope="col"><strong>Name</strong></th>
        <th bgcolor="#999999" scope="col"><strong>E-mail</strong></th>
        <th bgcolor="#999999" scope="col"><strong>Password</strong></th>
        <th bgcolor="#999999" scope="col"><strong>Gender</strong></th>
        <th bgcolor="#999999" scope="col"><strong>Photo </strong></th>
    </tr>
    <?php echo $html ?>
</table>
Strawberry
  • 33,750
  • 13
  • 40
  • 57

1 Answers1

0

Take a look at your server's php.ini configuration to check if the error reporting is set to something... Some servers hide critical errors to avoid giving hackers hints about the server's flaws.

; error_reporting
;   Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
;   Development Value: E_ALL
;   Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
error_reporting = E_ALL

More info :

; Error Level Constants:
; E_ALL             - All errors and warnings (includes E_STRICT as of PHP 5.4.0)
; E_ERROR           - fatal run-time errors
; E_RECOVERABLE_ERROR  - almost fatal run-time errors
; E_WARNING         - run-time warnings (non-fatal errors)
; E_PARSE           - compile-time parse errors
; E_NOTICE          - run-time notices (these are warnings which often result
;                     from a bug in your code, but it's possible that it was
;                     intentional (e.g., using an uninitialized variable and
;                     relying on the fact it's automatically initialized to an
;                     empty string)
; E_STRICT          - run-time notices, enable to have PHP suggest changes
;                     to your code which will ensure the best interoperability
;                     and forward compatibility of your code
; E_CORE_ERROR      - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING    - warnings (non-fatal errors) that occur during PHP's
;                     initial startup
; E_COMPILE_ERROR   - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR      - user-generated error message
; E_USER_WARNING    - user-generated warning message
; E_USER_NOTICE     - user-generated notice message
; E_DEPRECATED      - warn about code that will not work in future versions
;                     of PHP
; E_USER_DEPRECATED - user-generated deprecation warnings

As @Strawberry said in the comments, you might have a fatal error upon call of deprecated mysql* functions. Use mysqli* instead (and activate PHP's mysqli extension)

Goufalite
  • 2,253
  • 3
  • 17
  • 29