Jump to content

acctman

Members
  • Posts

    582
  • Joined

  • Last visited

Everything posted by acctman

  1. Hi I need help with querying multiple fields and formating the results. The user needs to query zc_city and zc_zip so what ever they type in needs to look in both fields and show results. the formating results should be zc_city, zc_state zc_zip (ie NEW YORK, NY 10011). I know I need to added zc_state and zc_zip to the SELECT query but I dont know how to make the result format correctly. The coding below will start to show auto complete results for New York when the user starts typing. I would also like for it to show the same results if the user type in the zip code too 10011... and start showing New York, NY 10011 Thanks in advance <?php $q = strtolower($_GET["q"]); if (!$q) return; $sql = "SELECT DISTINCT zc_city AS locale FROM search_zipcodes WHERE zc_city LIKE '$q%'"; $rsd = mysql_query($sql); while($rs = mysql_fetch_array($rsd)) { $cname = $rs['locale']; echo "$cname\n"; } ?>
  2. i was thinking about it, and thought all i need to do is process one table instead of too. basically i'm looking for any i_user that does not have an i_status of 2, but the tricky part for me atleast is that I can't figure out how to process the i_status results as a group. Meaning i_user can have like 1-100 i_status entries so the query needs to look at all of those entries as a group... Find all the entries for 010000 then tell me if i_status = 2 is present in any of them.
  3. this is how the table looks, and i need to retrieve 010000 since out of all of its entries there is no i_status = 2 tbl: rate_pictures i_user i_status 010000 1 010000 1 010000 1 010000 1 i_user i_status 130000 1 130000 1 130000 1 130000 2 i_user i_status 150000 1 150000 1 150000 1 150000 2
  4. can anyone help? i know its a pretty difficult query since I'm pretty much trying to run two queries in one
  5. this is what i've come up with so far, can anyone assist me. SELECT i_user FROM rate_pictures WHERE i_status != 1 AND i_admin = 1 ( SELECT m_id FROM rate_members )
  6. Table: rate_members Field: m_id 39 40 41 Table: rate_pictures Field: i_user Field: i_status So with those two tables... i want to grab all the m_id fields, then go to rate_pictures and match each m_id to i_user. an i_user entry can appear multiple times since its a picture table, so find all the matching i_user = m_id and only print out if the i_user = m_id does not have an i_status != 1 where i_admin = 1. so even if there is like 50 i_status entries for m_id (39) = i_user (39) if none of the i_status's = 1 and i_admin =1 then output the m_id. that'll let me know there is a problem with that profile.
  7. go to table rate_members get field m_id then go to rate_pictures where i_user = m_id check to see if any i_status entries have a 2 but no 0 or 1. Hope that's not confusing what i'm trying to do is check all member ids and see which i_user does not have a picture marked with a "1" in the i_status field. one i_user can have multiple i_status entries , so all the entries if no entry has a 1 for that i_user then output that i_user/m_id number. i_status = 1 main pic i_status = 0 pending approval i_status = 2 additional pics i'm doing a database/user clean up of where there might have be a coding error and user accounts were given the wrong status number. some users where given a 2 instead of a 1. so there images are not showing. I need to get a print out of those users so i can fix it really quick
  8. do you have an example of how the code would look/work
  9. Hi I need sample code on how to display a message based on referring url/domain. example: if user came from http://www.site1.com/link.php then the message they'd see on http://www.site.com/landing-page.php would be "Welcome Site1 Member's" and if they're coming from site2.com it would say "Site2 Member Welcome". thanks in advance
  10. how would i correct this left join with mysql 5? <!--[Loop Start QUERY:SELECT rm.m_rating, rm.m_user, rm.m_id, rm.m_date, rp.i_id, rp.i_rating FROM `rate_members` AS rm LEFT JOIN rate_pictures AS rp ON rm.m_id = rp.i_user WHERE rm.m_type = '1' AND rp.i_private = 0 AND rm.m_del != 1 AND rp.i_status=2 AND rm.m_rating > 0 AND rm.m_ratingcnt >= <%min_ratings%> ORDER BY RAND() LIMIT 8]-->
  11. anyone know of a site that list changes that would need to be made and common problems? I know there is something regarding sql JOIN queries ... i would love to see a listing or blog about the changes
  12. does anyone know of a site that list common errors or problems one would have when upgrading to to mysql 5? in php for example do I have to change any coding? will i have to change all coding to have mysql_ and not sql_?
  13. i found the problem, the limit 1 was cause the script to hault. i removed 'limit 1' and everything works mysql_query("DELETE FROM rate_members WHERE m_id='" .$id."' . limit 1");
  14. nothing no errors... everything processed fine but no entries were removed.
  15. Can someone assist me with solving my problem as to why the delete_record() function is not processing the queries. no error is being thrown, the unlink.php file has access to the mysql db, the records it's trying to delete is present. include $_SERVER['DOCUMENT_ROOT'] . '/files/unlink.php'; $id = '153062'; delete_record($id); //unlink.php function delete_record($id) { $user = mysql_result(mysql_query("SELECT m_user, m_id FROM rate_members WHERE m_id='" .$id."'"), 0, "m_user"); mysql_query("DELETE FROM ratemy_phpbb3.phpbb_users WHERE username='".$user."'"); $date = mysql_result(mysql_query("SELECT m_date, m_id FROM rate_members WHERE m_id='" .$id."'"), 0, "m_date"); usr_del_dir("/home/ratemy/public_html/rmbimgs/" . date("Y", $date) . "/" . date("m", $date) . "/" . $id . "/"); //remove db entries mysql_query("DELETE FROM rate_blogs WHERE b_user='" .$id."'"); mysql_query("DELETE FROM rate_favourites WHERE f_user='" .$id."'"); mysql_query("DELETE FROM rate_favourites WHERE f_fav='" .$id."'"); mysql_query("DELETE FROM rate_members_ban WHERE b_owner='" .$id."'"); mysql_query("DELETE FROM rate_members_ban WHERE b_banned='" .$id."'"); mysql_query("DELETE FROM rate_messages WHERE msg_sender='" .$id."'"); mysql_query("DELETE FROM rate_messages WHERE msg_recip='" .$id."'"); mysql_query("DELETE FROM rate_mobile_pics WHERE mob_user='" .$id."'"); mysql_query("DELETE FROM rate_phones WHERE ph_user='" .$id."'"); mysql_query("DELETE FROM rate_pictures WHERE i_user='" .$id."'"); mysql_query("DELETE FROM rate_picture_comments WHERE com_for='" .$id."'"); mysql_query("DELETE FROM rate_picture_comments WHERE com_user='" .$id."'"); mysql_query("DELETE FROM rate_private WHERE p_from='" .$id."'"); mysql_query("DELETE FROM rate_private WHERE p_to='" .$id."'"); mysql_query("DELETE FROM rate_profile_views WHERE v_for='" .$id."'"); mysql_query("DELETE FROM rate_ratings WHERE r_for='" .$id."'"); mysql_query("DELETE FROM rate_referrals WHERE ref_by='" .$id."'"); mysql_query("DELETE FROM rate_members_visitors WHERE profile_m_id='" .$id."'"); mysql_query("DELETE FROM rate_members_visitors WHERE visitor_m_id='" .$id."'"); //remove member mysql_query("DELETE FROM rate_members WHERE m_id='" .$id."' . limit 1"); }
  16. is there a reason why this query is not work err: PHP Warning: mysql_result(): supplied argument is not a valid MySQL result resource in ... $date = mysql_result(mysql_query("SELECT m_date, m_id FROM rate_members WHERE m_id=$id"), 0, "m_date");
  17. so i would do something like this... $res = mysql_fetch_array(mysql_query("SELECT rm.m_user, rm.m_id, rm.m_date, rp.i_id FROM rate_members AS rm LEFT JOIN rate_pictures AS rp ON rm.m_id = rp.i_user WHERE rm.m_type = '1' AND rp.i_private = 0 AND rm.m_del != 1 AND rp.i_status=2 LIMIT 24")); foreach ($res as $line) {
  18. i know the bracet is needed and the query above looks fine or am i missing something? while ($line = mysql_fetch_array(mysql_query("SELECT rm.m_user, rm.m_id, rm.m_date, rp.i_id FROM rate_members AS rm LEFT JOIN rate_pictures AS rp ON rm.m_id = rp.i_user WHERE rm.m_type=1 AND rp.i_private=0 AND rm.m_del != 1 AND rp.i_status=2")) { echo "<li id=\"mycarousel-item-1\">\n" . "\t <a href=\"http://" . $line['m_user'] . ".site.com\" />\n" . "\t <img width=50 height=50 src=\"/files/pvtexp.php?mid=" . $line['m_id'] . "&iid=" . $line['i_id'] . "&idat=" . date("Y", $line['m_date']) . "/" . date("m", $line['m_date']) . "&sec=3&sm=1\" title=" . $line['m_user'] . "/>\n" . "\t </a>\n" . "\t </li>\n"; }
  19. my code library is update. I like using the latest trends and optimized coding. thanks for the advice.
  20. i think i'll play it safe and use my existing old script since its just as good as the competitor and I know the backend coding. i'll just have to update the admin area and add video and payment system
  21. Here's my dilemma, i'm about to start a new website project that can be created with existing coding from another site I run. My existing site is based off an old script that I completely re-coded over the span of 2-3yrs and with the help of other programmers. So i'm 100% knowledgeable of the script and can pretty much code any custom feature for by myself. With that said, I can purchase a script that has about 95% of all the features required for my new project already coded. All I would have to do is redesign the interface. The clear option would seem to purchase the new script with the business notion of time is money. But, I'm going to have to learn the new script (which is not difficult at all since its php/mysql). I'll just be unfamiliar with where certain functions are, if I end up having to code something extra/new for the site. Pros vs cons ... Old script code Cons - i'll have to create an admin area to handle the new features - will have to code in about 5 new features Pros - I really know every line of coding in the script - I'm comfortable with the script and know I can create any new feature New Script: Cons - i'm not comfortable or knowledgable of the new script - future new custom features "may" take longer to code Pros - pretty much everything is done The new script looks like the best option but is it really? But what does everyone else think.
  22. what's the equivalent to time() to use with phpmyadmin for direct db insert? my time format looks like this 1231388410
  23. its being inserted directly into the database via phpmyadmin. i figureed the query would process a lot faster than going through http
×
×
  • 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.