Jump to content

pro_se

Members
  • Posts

    131
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

pro_se's Achievements

Member

Member (2/5)

0

Reputation

  1. Try: UPDATE 'pages' SET 'ID_MAIN'='ID_MAIN++' WHERE 'ID_MAIN'='$Update'
  2. like, when I do array_sum($votes_array), i get a small number like 4. its supposed to be counting all the rows in the table..... something is not right with the inserting into an array part of it...
  3. actually, wait..... I have like 30 entries in the table right, and its not making sense because when I do <?php print_r($votes_array); ?> its only printing out one of the rows. I want to get the sum of all the rows, not just one of them...
  4. WOW! Thanks man, that really helped me out! I appreciate it!
  5. <?php $pre_toid = explode("?id=", $_SERVER['HTTP_REFERER']); $toid = $pre_toid[1]; $result = mysql_query("SELECT * FROM `hub` where to_id='".$toid."'"); $nvotes=mysql_num_rows($result); while($row=mysql_fetch_array($result)) { $dbratings = $row["rating"]; $votes_array = array("votes" => $dbratings); } $added_votes = array_sum($votes_array); $divided_votes = $added_votes/$nvotes; $total_rating = $divided_votes; ?> Ok, I got that far, but there is something wrong with the while loop. When I try and print or add the array it only prints or gets the sum of one vote from the array, and I know for a fact that there are at least 30 entries in the table.
  6. So, what I am doing is adding integers from an array (the one I pulled out of the mysql db) together, how can I add the multiple rows I am pulling out... I was thinking of using array_sum, but I did not know how to go about using it..
  7. Well, I can make queries like that shows. What I want to do with inserting the selected table into an array is what I am unsure about.
  8. Hi, I am working on a project where I need to select rows from a table called 'hub' and take the rows where 'to_id' = '$to_id' and put them into an array. How can I get MySql info into an array? Any help is appreciated.
  9. okay, I got the stupid thing to have the if/ else thing work.. now.. all I am getting is the same three friends.. all of them are the same.. how can i display all the friends different? function getfriendsforuid($puid) { $query = "SELECT * FROM `friends` WHERE `passive_id` = '$puid' AND `accpet` = 'y' LIMIT 3"; $result_query = mysql_query($query); $numfriends = mysql_num_rows($result_query); $repeat = 0; while ($repeat < $numfriends) { while($fname1lname = mysql_fetch_assoc($result_query)) { $friend = $fname1lname["acting_id"]; $query = "SELECT * FROM `pics` WHERE `uid` = '$friend' AND `default` = 'y'"; $result_query = mysql_query($query); while($fnam2elname = mysql_fetch_assoc($result_query)) { $pic = $fnam2elname["path"]; $query2 = "SELECT * FROM `user` WHERE `id` = '$friend'"; $result_query2 = mysql_query($query2); while($fnamelname2 = mysql_fetch_assoc($result_query2)) { $uname = $fnamelname2["username"]; $query3 = "SELECT * FROM `pics` WHERE `uid` = '$friend' AND `default` = 'y'"; $numpics = mysql_query($query3); $picsfound = mysql_num_rows($numpics); if ($picsfound >= 1) { echo "<div class=\"friendbar\"><a href=\"/profile/$fnamelname2[username]\"><img border=\"0\" src=\"/u/s_$pic\"></a></div>"; } } } } if ($picsfound == 0) {echo "<div class=\"friendbar\"><a href=\"/profile/$uname\"><img border=\"0\" src=\"/u/s_np.jpg\"></a></div>";} $repeat++; } } and a link to my site is: http://notexting.com/profile/cvarma
  10. well, <?php $file = "something.txt" echo substr($file, 2092); ?>
  11. <?php $string = "String Here... " echo substr($string, 240); ?> Try that out and tell me if it works..
×
×
  • 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.