Jump to content

can only get 1 set of data to show through db


runnerjp

Recommended Posts

hey guys... i have got this code

 

<?php
session_start();
require_once '../settings.php';
$id = $_SESSION['user_id'];
$query = "SELECT * FROM users WHERE id='$id'  "; 
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";
	}
	}
          ?>
<style type="text/css">
<!--
.style6 {
font-size: 18px;
font-style: italic;
}

-->
</style>

<table width="100%">
  <tr>
    <td colspan="5"><div align="center" class="style6">Welcome <?php echo $puser; ?>, would you like to go to your <a href="<?php echo get_username($_SESSION['user_id']);?>">profile</a></span></div></td>
  </tr>
  <tr>
    <td width="3%" valign="middle"> </td>
    <td width="9%" valign="middle"><a href="?page=update">Edit </a>my profile</td>
    <td width="69%"><?php	

$qProfile = "SELECT * FROM sysmsg ORDER BY msg_id DESC";
$rsProfile = mysql_query($qProfile);

while($row = mysql_fetch_array($rsProfile)){
$msg_id = $row['msg_id'];
$sent_on = $row['sent_on'];
$sent_by = $row['sent_by'];
$subject = $row['subject'];
$message = $row['message'];
$datetime = $row['sent_date'];

$sent_on = date("M jS, Y \a\\t h:i A T", $datetime);

echo("<p>Subject: <b>".$subject."</b></p><p><i>Posted by: ".$sent_by." on ".$sent_on."</i></p>
<p>".$message."<br><br></p>");
}
mysql_close();

if($id == 1){
echo "<a href=\"http://www.runningprofiles.com/members/index.php?page=admin\">Admin Index</a>\n";
}?>
</td>
    <td width="8%"> </td>
    <td width="11%"><?php 

$q = mysql_query($sql) or die("Error running query:".mysql_error());

if($row = mysql_fetch_array($q))
{
    echo "<img src='http://www.runningprofiles.com/members/images/thumbs/". $pid . "." . $row['ext']  . "' alt='' />";
}
else
{
    echo "<img src='http://www.runningprofiles.com/members/images/noimage.jpg' alt='' />";}

?>                                           </td>
  </tr>
  <tr>
    <td colspan="3"> </td>
    <td></td>
    <td><div align="center">
      <script type="text/javascript">
function popitup(url) {
var newwindow=window.open(url,'name','height=500,width=500');
if (window.focus) {newwindow.focus()}
return false;
}
    </script>
    <a href="uploader.php" onclick="return popitup(this.href);"
>update my image</a></div></td>
  </tr>
  <tr>
    <td colspan="5"></td>
  </tr>
  <tr>
    <td colspan="5"></td>
  </tr>
  <tr>
    <td colspan="5"> </td>
  </tr>
</table>



          

 

the problem is that the news.php shows fine but my inage does not i get this as an error

 

Warning: mysql_query() [function.mysql-query]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/runningp/public_html/members/include/main.php on line 64

 

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/runningp/public_html/members/include/main.php on line 64

Error running query:Access denied for user 'nobody'@'localhost' (using password: NO)

 

 

how comes access is denied when i add the news.php but when i dont it is allowed :S

it had

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


$qProfile = "SELECT * FROM sysmsg ORDER BY msg_id DESC";
$rsProfile = mysql_query($qProfile);

while($row = mysql_fetch_array($rsProfile)){
$msg_id = $row['msg_id'];
$sent_on = $row['sent_on'];
$sent_by = $row['sent_by'];
$subject = $row['subject'];
$message = $row['message'];
$datetime = $row['sent_date'];

$sent_on = date("M jS, Y \a\\t h:i A T", $datetime);

echo("<p>Subject: <b>".$subject."</b></p><p><i>Posted by: ".$sent_by." on ".$sent_on."</i></p>
<p>".$message."<br><br></p>");
}
mysql_close();

if($id == 1){
echo "<a href=\"http://www.runningprofiles.com/members/index.php?page=admin\">Admin Index</a>\n";
}

?>

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.