Jump to content

How do I make it so..


Zoofu

Recommended Posts

For anyone who wants to know... this is the function

 

function uid($uid, $link = FALSE){

$sql = "SELECT * FROM `users` WHERE `id`='".$uid."' AND `image`='".$image."'";

$res = mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($res) == 0){

return "Invalid User";

}else {

$row = mysql_fetch_assoc($res);

if(!$link){

 

return $row['username'];

}else {

return "<a href=\"/index.php?act=profile&id=".$uid."\">".$row['username']."</a>";

}

}

}

Link to comment
https://forums.phpfreaks.com/topic/171106-how-do-i-make-it-so/#findComment-902340
Share on other sites

Still getting errors, tell me what I should do with these codes:

 

function uid($uid, $link = FALSE){
$sql = "SELECT * FROM `users` WHERE `id`='".$uid."'";
$res = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($res) == 0){
	return "Invalid User";
}else {
	$row = mysql_fetch_assoc($res);
	if(!$link){

	return $row['username'];	
	}else {
		return "<a href=\"/index.php?act=profile&id=".$uid."\">".$row['username']."</a>";
	}
}
}

 

and the part that matters:

 

$select_sql = "SELECT * FROM `forum_replies` WHERE `tid`='".$id."' ORDER BY id ASC LIMIT ".$end.",".$start.""; 
		$select_res = mysql_query($select_sql) or die(mysql_error()); 

		while($rowr = mysql_fetch_assoc($select_res)){
			echo "<tr><td colspan=\"2\" align=\"left\" class=\"forum_header\">Posted On: <em>".$rowr['date']."</em></td></tr>\n";
			echo "<tr><td align=\"left\" width=\"15%\" valign=\"top\" class=\"forum_header\">".uid($rowr['uid'], true)."<br><img src=".uid($image)."></td>\n"; //< --- There is where the image will go.
			echo "<td align=\"left\" valign=\"top\" class=\"forum_header\">\n";
			echo nl2br(topic($rowr['message']));
			echo "</td>\n";
			echo "</tr>\n";
		}
		echo "<form method=\"post\" action=\"./index.php?act=reply&id=".$row['id']."\">\n";
		echo "<tr><td colspan=\"2\" align=\"center\"><textarea style=\"width:300px; height:100px\" name=\"reply\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Add Reply\" style=\"width:100px\"></td></tr>\n";
		echo "</table>\n";

Link to comment
https://forums.phpfreaks.com/topic/171106-how-do-i-make-it-so/#findComment-902355
Share on other sites

Your code makes little sense.

 

Firstly you call the function passing at what we assume is a users id. uid($rowr['uid'], true)

 

The next time you call it you seem to pass it an undefined (at least not anywhere in your post) $image variable. uid($image)

 

How exactly do you expect your function to lookup a user based on an image? There is your problem. Now, for homework, fix it.

Link to comment
https://forums.phpfreaks.com/topic/171106-how-do-i-make-it-so/#findComment-902376
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.