runnerjp Posted April 10, 2008 Share Posted April 10, 2008 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 Link to comment https://forums.phpfreaks.com/topic/100496-can-only-get-1-set-of-data-to-show-through-db/ Share on other sites More sharing options...
poleposters Posted April 10, 2008 Share Posted April 10, 2008 Check to make sure you have the connection info in all the right places. Link to comment https://forums.phpfreaks.com/topic/100496-can-only-get-1-set-of-data-to-show-through-db/#findComment-513934 Share on other sites More sharing options...
runnerjp Posted April 10, 2008 Author Share Posted April 10, 2008 i have because each on there own work fine... put them together and it does not seem to work :S Link to comment https://forums.phpfreaks.com/topic/100496-can-only-get-1-set-of-data-to-show-through-db/#findComment-513941 Share on other sites More sharing options...
craygo Posted April 10, 2008 Share Posted April 10, 2008 what does news.php have in it. Link to comment https://forums.phpfreaks.com/topic/100496-can-only-get-1-set-of-data-to-show-through-db/#findComment-513964 Share on other sites More sharing options...
runnerjp Posted April 10, 2008 Author Share Posted April 10, 2008 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"; } ?> Link to comment https://forums.phpfreaks.com/topic/100496-can-only-get-1-set-of-data-to-show-through-db/#findComment-513971 Share on other sites More sharing options...
craygo Posted April 10, 2008 Share Posted April 10, 2008 problem is you closed the connection after your first query mysql_close(); in order to reopen it you would have to require setting again. Just move it to the end or get rid of it. Ray Link to comment https://forums.phpfreaks.com/topic/100496-can-only-get-1-set-of-data-to-show-through-db/#findComment-513977 Share on other sites More sharing options...
runnerjp Posted April 10, 2008 Author Share Posted April 10, 2008 doh lol didnt see that ty very much Link to comment https://forums.phpfreaks.com/topic/100496-can-only-get-1-set-of-data-to-show-through-db/#findComment-514160 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.