Jump to content

pacitto513

New Members
  • Posts

    8
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

pacitto513's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for your help. In the past Ive used this method that you mentioned many times however I was never too sure what the most efficient way for both the server/mySQL database and website was.
  2. So would you recommend just creating a seperate table called 'subscribers' and just go from there and use that instead? Would this be the most efficient normalized method?
  3. Hello , I have a database and in this database there is a table called 'circles'. This table consists of a field/column called 'subscribers' and in this column there are multple arrays (e.g., '5', '6', '7'....) that I can explod in php. Now, my question is there a way where I can use the mysql_query("UPDATE") code in order to add another array value onto the end of the existing array list inside the 'subscribers' column? If so, how do I do this? Please help all code and examples are welcome. Thanks
  4. Would someone be willing to help me out with this one, with respect to the code that I have already provided??
  5. Hmm okay, thank you for the advice. I;ve never tried making a calculation witihn a query - gonna be tricky.
  6. Hey everyone, I'm having an issue with attempting to select items from mySQL database using a function that grabs the latitude and longitude of a member and shows how far they live from the user logged in. Every time I run my code I get the following error message: FUNCTION databasename.distance does not exist. I have tried everything I can think of, can someone please help me out on this one! <?php //// GRAB USER LOGGED-IN SEARCH/PERSONAL INFORMATION.////// $uBlatlon = ''; $sql_user_data = mysql_query("SELECT id, lat, lon FROM members WHERE id='$id' LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($sql_user_data)) { $userid = $row["id"]; $userlat = $row["lat"]; $userlon = $row["lon"]; } //// distance FUNCTION //// function distance($lat1,$lon1,$lat2,$lon2,$unit) { $theta = $lon1 - $lon2; $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); $dist = acos($dist); $dist = rad2deg($dist); $miles = $dist * 60 * 1.1515; $unit = strtoupper($unit); if ($unit == "K") { return ($miles * 1.609344); } else if ($unit == "N") { return ($miles * 0.8684); } else { return $miles; } } $sql_locals_match = mysql_query("SELECT username lat, lon FROM members WHERE distance(lat,lon,'$userlat','$userlon','K') <= '$distance' ORDER BY last_login DESC") or die (mysql_error()); while($row = mysql_fetch_array($sql_locals_match)) { $memberusername = $row["username"]; $memberlat = $row["lat"]; $memberlon = $row["lon"]; $totaldistance = round(distance($memberlat, $memberlon, $userlat, $userlon,"K")); if ($totaldistance < $distance) { $member_display_list .=''.$memberusername.' - '.$totaldistance.' KM AWAY <br><br>'; }else{ continue; } } ?>
  7. Hey everyone, I have been running my code over and over again making various changes tryingto solve this error, however nothing has worked. The following error keeps ocurring: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\Website-1.0\root\home.php on line 11 The following line(s) this error is referring to are as followed: $sql_user_data = mysql_query("SELECT id, username, fullname, city, posts FROM members WHERE id='$userid' LIMIT 1"); while($row = mysql_fetch_array($sql_user_data)){ Does anyone know how to fix this error?? Thanks.
  8. Hey everyone, I have this php code below and for some reason I keep getting the following error message when my page is loaded: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\Website-v1.0\root\home.php on line 47 Iv tried changing a few things within my code but nothing seems to work. Any ideas on how to fix this bug? <?php $post_user_pic= ''; $postDisplayList = ''; $deletepost= ''; $sql_posts_data = mysql_query("SELECT postid, member_id, location, post_body, post_date, replies FROM posts ORDER BY post_date DESC LIMIT 10"); while($row = mysql_fetch_array($sql_posts_data)){ $postid = $row["postid"]; $postuserid = $row["member_id"]; $post_body= $row["post_body"]; $location = $row["location"]; $postreplies = $row["replies"]; $post_date = $row["post_date"]; $post_date = strftime("%b %d, %Y at %I:%M %p", strtotime($post_date)); $sql_postmem_data = mysql_query("SELECT id, username, fullname FROM members WHERE id='$postuserid' LIMIT 1"); while($row = mysql_fetch_array($sql_postmem_data)){ $postmemberid = $row["id"]; $postusername = $row["username"]; $postfullname = $row["fullname"]; $post_user_check_pic = "members/$postmemberid/image01.jpg"; $post_user_default_pic = "members/0/defaultpic.jpg"; if (file_exists($post_user_check_pic)) { $post_user_pic = "<img src=\"$post_user_check_pic\" width=\"50px\" height=\"50px\" ?BORDER=\"0\" border=\"0\" />"; } else { $post_user_pic = "<img src=\"$post_user_default_pic\" width=\"50px\" height=\"50px\" ?BORDER=\"0\" border=\"0\" />"; } if (isset($_SESSION['id'])) { if($_SESSION['id']==$uid){ $postDisplayList .= ''; } else $postDisplayList .= ''; } } } ?>
×
×
  • 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.