Jump to content

brown2005

Members
  • Posts

    942
  • Joined

  • Last visited

Everything posted by brown2005

  1. Hi, sorry I already have that done, I am just trying to work out if that query is the correct way to do what I am trying to achieve.
  2. $word = $_GET['word'] ? $_GET['word'] : ""; if($word == ""){$crap = "";}else{ $crap = "AND table3_n = $word'';} SELECT * FROM table1,table2,table3,table4,table5 WHERE table1_f = table2_id AND table1_g = table3_id AND table4_p = table1_id AND table5 _m = table4_id $crap ORDER BY RAND() LIMIT 1 this is what i mean above. so if there is no word it shows all results, but if there is a word, it will only show results with that word. is this code correct? Thanks in advance
  3. date("Y-m-d"); thats how i enter them in mine.
  4. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <?php // delete airplane in database // Connect to database ===================================================== include("connect_db.php"); // retrieve form data from form2.html ========================================== $id = $_POST['id'] ? $_POST['id'] : ""; // Send query =========================================================== $query = mysql_query ("SELECT * FROM airplanes WHERE id='$id'"); if (!$query){ die('Error :' .mysql_error()); } $num = mysql_num_rows($query); // Check to see if record exists ============================================== if($num) > 0){ mysql_query("DELETE FROM airplanes WHERE id='$id'"); print 'Airplane successfully deleted'; }else{ print '<big style="color: red;"><span style="font-weight: bold;"> ERROR MESSAGE:</span></big> ID number not found'; echo "<br />"; echo "<br />"; print 'Use the BACK button on your browser to try again'; echo "<br />"; } echo "<br />"; echo '<p>Return to <a href="members_menu.html">Members Menu Here</a></p>'; ?> </body> </html> i am no pro, and maybe there is a better way, but thats how i would write it
  5. SELECT * FROM table1,table2,table3,table4,table5 WHERE table1_f = table2_id AND table1_g = table3_id AND table4_p = table1_id AND table5 _m = table4_id ORDER BY RAND() LIMIT 1 Right, Now What I want to do, is have a filter form, which posts to the above, and if: $filter1 = ""; it wont be include in the above code $filter1 = "word"; then i want to include AND table3_n = '$filter1'; in the above code thanks in advance.
  6. if($login_count == 1) { while ($row = mysql_fetch_array($login_sql, MYSQL_ASSOC)) { $_SESSION['MembersID'] = $row['members_id']; session_register('MembersID'); }} this works fine and logs me in on my website with the script and displays the correct id with: if(isset($_SESSION['MembersID'])){ $session_id = $_SESSION['MembersID']; echo'<li><a href="https://members.selmgec.co.uk/">Welcome, '.$session_id.'</a></li>'; } but how can i pass it onto another website i own, using the same database connection.
  7. Hi, that is exactly what I want to do. I have never used jquery before, do you have a link to get the full script to make this work? Or could you explain. Thanks
  8. Hi, I was wondering if any one knows of a tutorial or script where I can use a query popup box but have it show different content based on different links clicked. thanks.
  9. SELECT DISTINCT(keywords_keyword), photos_extension FROM photos,photos_keywords,keywords,photos_websites WHERE photos_keywords_photo=photos_id AND photos_keywords_keyword=keywords_id AND photos_websites_website='3' ORDER BY keywords_keyword ASC this code gets all the correct websites, but I would like to get one website per keywords_keyword, how can I do this please?
  10. ok thanks. so it does not matter which way? is either of them faster or better to use than the other?
  11. WHERE table1.id IN (SELECT table2.domain FROM table2 WHERE table2.user='1') with regards to the above, is this the correct way of doing it?
  12. if($keyword !== "") { //Explode the keywords on spaces $keywordsAry = explode(' ', $keyword); //Remove empty array items array_filter($keywordsAry); //Create keyword string with single quotes around values $keywordsStr = "'" . implode("', '", $keywordsAry) . "'"; $query = "SELECT * FROM domains, domains_keywords, keywords WHERE domains_keywords_domain = domains_id AND domains_keywords_keyword = keywords_id' AND keywords_keyword IN ({$keywordsStr})"; $get = mysql_query($query); } right so say i have in the database id 1 website 1 keyword cabbage id 2 website 2 keyword cabbage id 3 website 1 keyword brussel and in my text box i put cabbage brussel i just want it to come up with website 1.. cause it has both... is that code the best way?
  13. table 1 id url table 2 id domain user how can i select records from table 1, where table1.id is in table2.domain and user=1 is it SELECT * FROM table1, table2 WHERE table1.id=table2.domain AND table2.user=1 or is there a better/faster way? thanks in advance.
  14. if($keyword == ""){}else{ $get = mysql_query("SELECT * FROM domains, domains_keywords, keywords WHERE domains_keywords_domain=domains_id AND domains_keywords_keyword=keywords_id AND keywords_keyword='$keyword'"); } so i have a textbox at the mo that you can put one keyword in and get results based on this one keyword. how can I change this to a textarea and if say someone enters two keywords.. it will find results based on them having both keywords. thanks in advance
  15. well say I wanted to get my website critiqued, by say web design experts and separate critiques from website users?
  16. If you wanted to get my website critiqued, what would be the key factors you look for? i.e. speed of load, etc
  17. $string = " hel lo "; $string = rtrim($string); $string= ltrim($string); which trims the whitespace from the front and back, but how do i remove the middle space? Thanks
  18. I was wondering can you read the keywords of a website in an iframe? i.e. say my website is www.mywebsite.com and on there was an iframe with google.co.uk can i read the keywords of the google site on my site? Thanks in advance.
  19. SELECT genders_name, COUNT(genders_name) AS genders_count FROM people, members, genders WHERE members_person=people_id AND people_gender=genders_id GROUP BY genders_name ORDER BY genders_name ASC I have the above code, which would say echo in php Gender Number Percentage Male 2 Female 1 I would like to add the percentage fields for this, can this be done in the above mysql code or does it need to be a separate code? Thanks
  20. I have three tables that I can link up via mysql and get the results I need, but I could also query just the one table and get the info from the other two via a function, my question is which is the faster and/or better way and why? Thanks
  21. Hi, If you have say another field. account_status enum '0','1' with 0 being unapproved and 1 being approve, when someone clicks on the button, it will change the id you selected to 1, then you can have a little approval message which says which one is approved so say... ID 1 Status Approved
  22. if($id > 0) { $where = "WHERE domains_id='$id'"; }else{ $order = "ORDER BY RAND()"; } $get_mail = mysql_query("SELECT * FROM domains $order $where LIMIT 1")
  23. Hi, I have an icon, that when I click, refreshes the page and loads a new iframe src each time. What I want to do is elimante the need to refresh the whole page, and just refresh the iframes src. can this be done with ajax and does anyone know any code examples. thank you.
  24. some of these are pure class.. look at http://www.buzzfeed.com/awesomer/the-24-best-chat-roulette-screenshots-nsfw
  25. omg at the first one. you shouldnt laugh lol!
×
×
  • 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.