Jump to content

with sql quary i get a blank page :S


runnerjp

Recommended Posts

hey guys... on on my index.php i have this code

 <?php 
if (isset($_GET['section'])) {
  $section = $_GET['section'];
} else {
  $section = 'main';
}
$file = "include/".$section.".php";
if (file_exists($file)) {
    require($file);
} 
?>

 

and this means the data gets added from the section... allworks ish lol

 

so when i got to main.php (code showm below) it will not show the data if my sql quary is there???

 

 

<?php
session_start();
require_once '../settings.php';?>
<?

$query = "SELECT * FROM users WHERE Username = '$username' LIMIT 1"; 
if ($result = mysql_query($query)){
    if (mysql_num_rows($result)) {
        $array = mysql_fetch_assoc($result);
        $pemail = $array['Email'];
        $puser = $array['Username'];
        $pid = $array['ID'];   
        $pfirst_name = $array['first_name'];  
        $plast_name = $array['last_name'];
	$pabout_me = $array['about_me'];
	$pevents = $array['events'];



        $sql = "SELECT `ext` FROM `user_images` WHERE `user_id`='$pid' LIMIT 1"; 
       ?>
<table width="100%">
  <tr>
    <td colspan="2"><div align="center">Welcome <?php echo $puser; ?> </div></td>
  </tr>
  <tr>
    <td colspan="2"> </td>
  </tr>
  <tr>
    <td width="50%"><a href="<?php echo get_username($_SESSION['user_id']);?>">MyProfile</a></td>
    <td width="50%"><a href="?section=uploader">change profile picture</a></td>
  </tr>
  <tr>
    <td colspan="2"> </td>
  </tr>
  <tr>
    <td colspan="2"> </td>
  </tr>
  <tr>
    <td colspan="2"> </td>
  </tr>
</table>

 

its strange because without

$query = "SELECT * FROM users WHERE Username = '$username' LIMIT 1"; 
if ($result = mysql_query($query)){
    if (mysql_num_rows($result)) {
        $array = mysql_fetch_assoc($result);
        $pemail = $array['Email'];
        $puser = $array['Username'];
        $pid = $array['ID'];   
        $pfirst_name = $array['first_name'];  
        $plast_name = $array['last_name'];
	$pabout_me = $array['about_me'];
	$pevents = $array['events'];



        $sql = "SELECT `ext` FROM `user_images` WHERE `user_id`='$pid' LIMIT 1"; 
       ?>

it shows the table and data but with it i get blank page :S

Link to comment
https://forums.phpfreaks.com/topic/91231-with-sql-quary-i-get-a-blank-page-s/
Share on other sites

Archived

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

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