Jump to content

[SOLVED] Issue with comments


djfox

Recommended Posts

I have a comment system in which is set up in the profiles of my site. Now, I use the exact same system as I do with submission display file. The comment works for submission display. It will work for the profiles. But instead of refreshing to the profile, it will reload to a version of the profile where none of the data from mysql database loads & it gives an error message on line 235. Here is the section with line 236 in which line 236 is the one with "while($r = mysql_fetch...":

 

<table border=0>

<?
$res = mysql_query("SELECT subject,content,date,id,sender FROM artistcomment WHERE userID=$gall ORDER BY id DESC");
while($r = mysql_fetch_row($res) ) $comments[] = $r;

if ($comments) foreach($comments as $c){
?>

<tr><td bgcolor="312D37" colspan=2><a href="trancer.php?gall=<? echo $c[4] ?>"><? echo $c[0] ?></a>       Date: <? echo $c[2] ?>       #<? echo $c[3] ?>
<tr><td colspan=2><? echo $c[1] ?>

<tr><td>
<?
}
?>
</table>

 

Here is the error message:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 236

 

Here is what error log says:

[01-Mar-2007 12:58:17] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 25

[01-Mar-2007 12:58:17] PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 26

[01-Mar-2007 12:58:17] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 233

[01-Mar-2007 12:58:17] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 25

[01-Mar-2007 12:58:17] PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 26

[01-Mar-2007 12:58:17] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 233

[01-Mar-2007 13:01:24] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 27

[01-Mar-2007 13:01:24] PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 28

[01-Mar-2007 13:01:24] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 235

[01-Mar-2007 13:01:24] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 27

[01-Mar-2007 13:01:24] PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 28

[01-Mar-2007 13:01:24] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 235

[01-Mar-2007 13:03:13] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 27

[01-Mar-2007 13:03:13] PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 28

[01-Mar-2007 13:03:13] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 235

[01-Mar-2007 13:03:13] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 27

[01-Mar-2007 13:03:13] PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 28

[01-Mar-2007 13:03:13] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 235

[01-Mar-2007 13:09:05] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 28

[01-Mar-2007 13:09:05] PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 29

[01-Mar-2007 13:09:05] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 236

[01-Mar-2007 13:09:05] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 28

[01-Mar-2007 13:09:05] PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 29

[01-Mar-2007 13:09:05] PHP Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trancer.php on line 236

 

 

 

 

Here is the entire code for the profile file:

<?php
//Date: February 25 2007
//For: www.secrettrance.net
//Description: Trancer Profile

session_start();
include("dbcon.php");
include("func.php");
require_once "auth.php";
require_once "includes/defines.php";




$lev=$_SESSION['level2'];

if($submit){
   $s = $sub." by ".$name;
   $b= emote($bod);
   mysql_query("INSERT INTO artistcomment (userID,subject,content,date,sender) VALUES ( '$g', '$s', '$bod', NOW(),$send)")or die ( mysql_error());
   mysql_query("INSERT INTO messagedata (recBoxID, sendBoxID, content, subject, isNew, date) VALUES ($gall, '1', 'Trancer Comment Recieved <br><a href=trancer.php?g=$gall>Please click here to go to your trancer profile</a>.<br>This is automated message please do not reply.', 'New trancer comment received!', 1, NOW() )");

}


//get the users information
$res = mysql_query("SELECT login, level, rName, age, gender, aim, yahoo, msn, icq, livejournal, bio,email, country, website,mood, status, icon, webcam, arttype FROM userdata WHERE id=$gall");
$user = mysql_fetch_row($res);
mysql_free_result($res);



$res = mysql_query("SELECT COUNT(*) FROM artistcomment WHERE userID='$gall'");
$numCom = mysql_fetch_row($res);
mysql_free_result($res);

$res = mysql_query("SELECT COUNT(*) FROM image WHERE gallNum='$gall'");
$numImage = mysql_fetch_row($res);
mysql_free_result($res);

$res = mysql_query("SELECT id, name, gallNum, URL, description, addDate FROM image WHERE gallNum='$gall' ORDER BY id DESC");
$log = $user[0];




$Title = "Secret Trance: Trancer: $user[0]";

require_once "header.php";
require_once "hidestatus.php";
?>





<table border=0 width=100%><? //1 
?>
<tr>
<td bgcolor="4A4553">
<table border=0 width=100%>
<tr>
<td bgcolor="312D37" valign=center><table border=0><tr><td valign=center><a href="trancer.php?gall=<? echo $gall ?>"><img src="<? echo $user[16]; ?>" width=50 height=50 border=0></a><td valign=center> <font size=6><b><? echo $user[0]; ?></b></font></table>
<tr>
<td>
<table border=0 width=100%> <? //2 
?>
<tr>
<td valign=top>
Real Name: <b><? echo $user[2]; ?></b>
<br>Level: <b><? echo $user[1]; ?></b>
<br>Status: <b><? echo $user[15]; ?></b>
<br>Gender: <b><? echo $Gender[$user[4]] ?></b>
<br>Age: <b><? echo $user[3] ?></b>
<br>Country: <b><? echo $user[12] ?></b>
<br>Mood: <b><? echo isset($user[14])?$Moods[$user[14]]:$Moods[0]; ?></b>
<br>Artist Type: <b><? echo isset($user[18])?$arttype[$user[18]]:$arttype[0]; ?></b>


<td valign=top>
<div align=center>
<table border=0>
<tr>
<td valign=top>
<div align=left>
Aim: <b><? echo $user[5]; ?></b>
<br>Yahoo: <b><? echo $user[6]; ?></b>
<br>Msn: <b><? echo $user[7]; ?></b>
<br>Icq: <b><? echo $user[8]; ?></b>
<br>Livejournal: <b><? echo $user[9]; ?></b>
<br>Website: <b><a href="<? echo $user[13] ?>" target="_blank">Visit</a></b>
<br>E-Mail: <b><a href="mailto:<? echo $user[11] ?>"><? echo $user[11] ?></a></b>
</div>
</table>
</div>


<td valign=top>
<div align=right>
<table border=0>
<tr>
<td valign=top>
<div align=left>
Images: <b><? echo $numImage[0] ?></b>
<br>Profile Comments: <b><? echo $numCom[0] ?></b>
<br>Policy Violations: <b>0</b>
</div>
</table>
</div>


</table> <? //2 
?>
</table>
</table><? //1 
?>





<table border=0 width=100%><? //1 
?>
<tr>
<td>
<tr>
<td bgcolor="4A4553">
<table border=0 width=100%><? //2 
?>
<tr>
<td bgcolor="312D37"><center><b>Trancer Tools</b></center>
<tr>
<td>
<center><a href="message.php?sendname=<? echo $user[0]; ?>">Send a Private Entranced Message to <? echo $user[0]; ?></a></center>
</table><? //2 
?>
</table><? //1 
?>






<table border=0 width=100%><? //0 
?>
<tr>
<td>
<tr>
<td width=50% valign=top>
<table border=0 width=100%><? //1 
?>
<tr>
<td bgcolor="4A4553">
<table border=0 width=100%><? //2 
?>
<tr>
<td bgcolor="312D37"><b>Recent Trances</b>
<tr>
<td>

<table border=0>
<?
$n = $_SESSION['sess_name'];
$rr = rtrim($user[0]);
$rt = rtrim($n);

?>
<?
//Get each image in the users gallery
$offset = isset($_REQUIRE['offset'])?$_REQUIRE['offset']:0;

  if(!$offset || $offsett<0) $offset=0;
  $recent = 0;
while( $rows = mysql_fetch_row($res) ){
   if( $recent >= $offset && $recent < ($offset + 10 )){
if( $recent%2 == 0 ){
echo "<tr><td><tr><td><tr><td><tr><td><tr>";
    }
    //Display each image in gallery
    echo "<td width=16%><center><a href='trances.php?id=$rows[0]'><img src=thumbnail.php?img=$rows[3] border=0></a>";
    echo "<br><b><a href='trances.php?id=$rows[0]'>$rows[1]</a></b><br> $rows[5]";
   
    //If this is the current users gallery with proper level or an admin allow edit
    if( $gall==$rows[2] && $rr == $rt && $user[2] > 0 || $lev > 7) {
       echo "<br><font size=2><a href='tranceedit.php?id=$rows[0]'>Edit trance.</a></font>";
    }

    //If this is the current users gallery or an admin allow delete
    if( $rr == $rt || $lev > 7){
      echo "<br><font size=2><a href='deletetrance.php?id=$rows[0]'>Delete trance.</a></font>";
    }
    
    echo "</center>";
  }
  $recent = $recent + 1;
}
?>
</table>

</table><? //2 
?>
</table><? //1 
?>


<td width=50% valign=top>
<table border=0 width=100%><? //1 
?>
<tr>
<td bgcolor="4A4553">
<table border=0 width=100%><? //2 
?>
<tr>
<td bgcolor="312D37"><b>Biography</b>
<tr>
<td>
<? echo $user[10] ?>
</table><? //2 
?>
<tr>
<td>
<tr>
<td bgcolor="4A4553">
<table border=0 width=100%><? //3
?>
<tr>
<td bgcolor="312D37"><b>Entranced Comments</b>
<tr>
<td>

<table border=0>

<?
$res = mysql_query("SELECT subject,content,date,id,sender FROM artistcomment WHERE userID=$gall ORDER BY id DESC");
while($r = mysql_fetch_row($res) ) $comments[] = $r;

if ($comments) foreach($comments as $c){
?>

<tr><td bgcolor="312D37" colspan=2><a href="trancer.php?gall=<? echo $c[4] ?>"><? echo $c[0] ?></a>       Date: <? echo $c[2] ?>       #<? echo $c[3] ?>
<tr><td colspan=2><? echo $c[1] ?>

<tr><td>
<?
}
?>
</table>

</table><? //3
?>
<tr>
<td>
<tr>
<td bgcolor="4A4553">
<table border=0 width=100%><? //4 
?>
<tr>
<td bgcolor="312D37"><b>Leave an Entranced Comment</b>
<tr>
<td>
<?
$n = $_SESSION['sess_name'];
$rr = rtrim($user[0]);
$rt = rtrim($n);
?>
<?
if( $_SESSION['sess_name'] ){
$sender=$_SESSION['gal'];
?>
<form action="trancer.php">
<input type=hidden name="name" value="<? echo $_SESSION['sess_name'] ?>">
<input type=hidden name="g" value="<? echo $gall ?>">
<input type=hidden name="send" value="<? echo $sender ?>">
Subject:<input type="text" name="sub" size="40"><br>
Body: <font size=2><a href="emoticons.php" target="_blank">Emoticon Legend</a></font> 
<br><textarea rows="5" cols="65" name="bod" style="border: 0px; background-color:#141317; color: #B6ABCE;"></textarea><br> 
<input type="submit" name="submit" value="Leave Entranced Comment">
</form>
<? 
}
?>
</table><? //4 
?>
</table><? //1 
?>
</table><? //0 
?>






<table border=0 width=100%><? //1 
?>
<tr>
<td>
<tr>
<td bgcolor="4A4553">
<table border=0 width=100%><? //2 
?>
<tr>
<td bgcolor="312D37">
<tr>
<td>
</table><? //2 
?>
</table><? //1 
?>






<?
require_once "footer.php";
?>

 

 

 

In summary:

What should be happening

When the comment box is filled out & submitted, the profile file (trancer.php) should reload with the user`s information (the user the comment is being submitted to) along with the new comment. Also, a private message should be sent to owner of the profile that a new comment was added.

 

The problem is

The page loads, but all of the user`s information is gone. An error message sits in the spot where comments should be displayed (see above for error message). No private message is sent. You would have to edit the url bar to get to the user`s profile for it to display all the information again. New comment is there but has apparently been submitted twice.

 

I can provide you with a username & password to use if you want to test this out to see what exactly is happening when the comment is posted. (I know I`m no good at describing things.)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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