The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Please help with query.
Well I'm trying to get the overall feedback rating from photopost classifieds to show in the vbulletin profile page.
So I've made a file called getfeedback.php and put it in my includes folder for vb. Then in the member.php file for vbulletin I've put this getfeedback.php as require_once(DIR . '/includes/getfeedback.php'); In the getfeedback.php file I have the following code. Code:
<?php $dbhost = 'localhost'; $dbuser = 'database_username'; $dbpass = 'database_password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'database_name'; mysql_select_db($dbname); $query = "SELECT foruser, rating, username FROM cp_feedback WHERE rating = 3 AND foruser = 6"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $ratingPosTotal += 1; } $query = "SELECT foruser, rating, username FROM cp_feedback WHERE rating = 1 AND foruser = 6"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $ratingNegTotal += 1; } $feedbackRatingTotal = $ratingPosTotal - $ratingNegTotal; ?> So then in my MEMBERINFO template for vb I have added a line that will show $userinfo[username]'s Feedback Rating: $feedbackRatingTotal and then this will show the users feedback rating score. But where I have this code: Code:
AND foruser = 6"; I don't really know much about php so can someone help me, what would I insert to make it be AND foruser = whatever userid of the profile I'm looking at? I've tried just about everything I can think of but nothing is working. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|