Jump to content

Search the Community

Showing results for tags 'SQL'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 166 results

  1. Help! Injection jsql

    Hola buenas, tengo que decir que todavia estoy aprendiendo, soy muy nobato en este tema, aprendiendo me he quedado bloqueado y no se como seguir, se lo que son los dorks, el sqliv sqlmap ect... yo uso el jsql injection. Me gustaria saber como centrar una lista de dorks en una sola url, ya que todos los videos que he visto, lo que hacen es poner un dork en google y cojer una paguina al azar, lo suyo seria cojer una url deseada y meterle dorks para hallar una vuneración y de ahi ver/modificar/actualizar los datos de la paguina web. Estoy intentado cojer los datos de un juego online que creo que tiene algo (muy poco) de seguridad ante injection sql que es www.boombang.nl/index.php. Si hay alguna alma caritativa que sepa del tema y me puede ayudar, mil gracias adelantadas
  2. Do i need to change variable?

    Hello. Stupid question here. So when i write sql code inside variable, do i need to change it (the variable) everytime or will php be able to see to difference? Lile this: $sql = "select * from users" $result = execute sqk here... $row = output here.. fetch data... $sql = "select * from stars" ... And so forth? Or do i need to change the variable everytime so php can know each different sql code and fetches everytime? Thx in advance.. Ps: writing from a cellphone, sorry if i dont deliver perfect info, so hope you understand the question If not, ask and ill retype the question when home later tonight at my laptop Thanks a lot
  3. search query done... i think?

    Hello W3S - me again... So i have this little peace of code: if( isset($_POST['FORMNAME_submit_search']) ) { $qur = ""; @$SearchKeywords = mysqli_real_escape_string($dblink, $_POST['FORMNAME_SogProfilBar_Keywords']); // Search Bar Profil Keywords @$MinAlder = mysqli_real_escape_string($dblink, $_POST['FORMNAME_MinAlder']); // Minimum Alder @$MaxAlder = mysqli_real_escape_string($dblink, $_POST['FORMNAME_MaxAlder']); // Maximum Alder @$Landsdel = mysqli_real_escape_string($dblink, $_POST['FORMNAME_Landsdel']); // Landsdel @$Kon = mysqli_real_escape_string($dblink, $_POST['FORMNAME_Kon']); // Køn @$MinHojde = mysqli_real_escape_string($dblink, $_POST['FORMNAME_MinHojde']); // Minimum Højde @$MaxHojde = mysqli_real_escape_string($dblink, $_POST['FORMNAME_MaxHojde']); // Maximum Højde @$Etnicitet = mysqli_real_escape_string($dblink, $_POST['FORMNAME_Etnicitet']); // Etnicitet @$Sprog = mysqli_real_escape_string($dblink, $_POST['FORMNAME_Sprog']); // Sprog @$MinVaegt = mysqli_real_escape_string($dblink, $_POST['FORMNAME_MinVaegt']); // Minimum Vægt @$MaxVaegt = mysqli_real_escape_string($dblink, $_POST['FORMNAME_MaxVaegt']); // Maximum Vægt @$Tatoveringer = mysqli_real_escape_string($dblink, $_POST['FORMNAME_Tatoveringer']); // Tatoveringer @$Kategorier = mysqli_real_escape_string($dblink, $_POST['FORMNAME_Kategorier']); // Kategorier // Søgning af ALT starter her. $query = " SELECT users.users_id, any_value(users.users_fornavn), any_value(users.users_mellemnavn), any_value(users.users_efternavn), any_value(users.users_email), any_value(users.users_city), any_value(users.users_zipcode), any_value(users.users_birthday_date), any_value(users.users_address), any_value(users.users_tlf_telefon), any_value(users.users_tlf_mobil), users_info.usersinfo_FK_users_id, any_value(users_info.usersinfo_id), any_value(users_info.usersinfo_profilesearch_viewable), any_value(users_info.usersinfo_hojde_cm), any_value(users_info.usersinfo_vaegt_kg), any_value(users_info.usersinfo_ErfaringKvalifikationer), any_value(users_info.usersinfo_beskaeftigelse), any_value(users_info.usersinfo_FK_usersinfoHairColor_id), any_value(users_info.usersinfo_FK_usersinfoEyeColor_id), any_value(users_info.usersinfo_FK_usersinfoBukseBredde_id), any_value(users_info.usersinfo_FK_usersinfoBukseLaengde_id), any_value(users_info.usersinfo_FK_usersinfoBluseStorrelse_id), any_value(users_info.usersinfo_FK_usersinfoSkoStorrelse_id), any_value(users_info.usersinfo_FK_usersinfoLandsdel_id), any_value(users_info.usersinfo_FK_usersinfoEtnicitet_id), any_value(users_info.usersinfo_FK_usersinfoTatoveringer_id), any_value(users_info.usersinfo_FK_usersinfoKategorier_id), any_value(users_info.usersinfo_FK_usersinfoSprog_id) FROM users INNER JOIN users_info ON users.users_id = users_info.usersinfo_FK_users_id "; // Search patterns - needs editing! from old-original to my version so it fits! include_once("index.search_patterns_setup.php"); // fortsætter herunder $query .= " GROUP BY users_id, usersinfo_FK_users_id"; $result = mysqli_query($dblink, $query) or die(mysqli_error($dblink)); if( mysqli_num_rows($result) > 0 ) { while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { //echo '<p>her er jeg!</p>'; // indsæt søge resultater her! (DET ING VIIIIRKER!) $output = '<p>'.$query.'</p>'; echo $output; echo '<p>'.$row['users_fornavn'].'</p>'; } } else { $row = '<p>Der var desværre ingen resultater på din søgning. Prøv igen.</p>'; echo $row; $output = '<p>'.$query.'</p>'; echo $output; die(); } } else { include_once("index.no_search_show_cards_profiles.php"); } The small code above is the main file. This code here is where i check for patterns and what has been checked in the form for searching etc... /////////////////////////// ALDER /////////////////////////// if( $MinAlder > 0 ) { echo clauseCHECK_AND(); //echo "<p>".clauseCHECK_AND()."</p>"; // dob = Date Of Birth $time = new DateTime('now'); $newtime = $time->modify('-'.$MinAlder.' year')->format('Y-m-d'); $query .= $clause." users_birthday_date <= '$newtime' "; } if( $MaxAlder > 0 ) { //echo clauseCHECK_AND(); //echo "<p>".clauseCHECK_AND()."</p>"; // dob = Date Of Birth $time = new DateTime('now'); $newtime = $time->modify('-'.$MaxAlder.' year')->format('Y-m-d'); $query .= $clause." users_birthday_date >= '$newtime' "; } /////////////////////////// KØN /////////////////////////// if( !empty($Kon) ) { echo clauseCHECK_AND(); //echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause." usersGender_id = '$Kon' "; } /////////////////////////// LANDSDEL /////////////////////////// if( !empty($Landsdel) ) { echo clauseCHECK_AND(); //echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause." usersinfoLandsdel_id = '$Landsdel' "; } /////////////////////////// ETNICITET /////////////////////////// if( !empty($Etnicitet) ) { echo clauseCHECK_AND(); //echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause." usersinfoEtnicitet_id = '$Etnicitet' "; } /////////////////////////// TATOVERINGER /////////////////////////// if( !empty($Tatoveringer) ) { // når jeg skifter til checkboxes, bruger jeg clauseCHECK_OR()! Som den bruges i de originale! Tjek for eksempler! echo clauseCHECK_AND(); //echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause." usersinfoTatoveringer_id = '$Tatoveringer' "; } /////////////////////////// SPROG /////////////////////////// if( !empty($Sprog) ) { // når jeg skifter til checkboxes, bruger jeg clauseCHECK_OR()! Som den bruges i de originale! Tjek for eksempler! echo clauseCHECK_AND(); //echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause." usersinfoSprog_id = '$Sprog' "; } /////////////////////////// KATEGORIER /////////////////////////// if( !empty($Kategorier) ) { // når jeg skifter til checkboxes, bruger jeg clauseCHECK_OR()! Som den bruges i de originale! Tjek for eksempler! echo clauseCHECK_AND(); //echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause." usersinfoKategorier_id = '$Kategorier' "; } /////////////////////////// VÆGT /////////////////////////// if( $MinVaegt>0 && $MaxVaegt<1 ) { $reg_vaegt_max="999"; } if( $MaxVaegt>0 && $MinVaegt<1 ) { $reg_vaegt_min="1"; } if( $MinVaegt>0 || $MinVaegt>0 ) { // når jeg skifter til checkboxes, bruger jeg clauseCHECK_OR()! Som den bruges i de originale! Tjek for eksempler! echo clauseCHECK_AND(); //echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause."userinfo_vaegt_kg BETWEEN $MinVaegt AND $MaxVaegt "; $clause = " OR "; } /////////////////////////// HØJDE /////////////////////////// if( $MinHojde>0 && $MaxHojde<1 ) { $reg_hoejde_max="999"; } if( $MaxHojde>0 && $MinHojde<1 ) { $reg_hoejde_min="1"; } if( $MinHojde>0 || $MinHojde>0 ) { // når jeg skifter til checkboxes, bruger jeg clauseCHECK_OR()! Som den bruges i de originale! Tjek for eksempler! echo clauseCHECK_AND(); //echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause."usersinfo_hojde_cm BETWEEN $MinHojde AND $MaxHojde "; $clause = " OR "; } /////////////////////////// KEYWORDS /////////////////////////// //if keyword set, goes here if( !$SearchKeywords=="" ) { echo clauseCHECK_AND(); // Initial clause //echo "<p>".clauseCHECK_AND()."</p>"; // Initial clause // search query $c = " users_id LIKE '%$SearchKeywords%' OR users_fornavn LIKE '%$SearchKeywords%' OR users_mellemnavn LIKE '%$SearchKeywords%' OR users_efternavn LIKE '%$SearchKeywords%' "; $query .= $clause." $c"; } Now, i have a little trouble with the latest version of MySQL installed, i always keep getting the error: Expression #12 of SELECT list is not in GROUP BY clause and contains nonaggregated column (...) which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by So i had to change my main SQL a little, which is why i added "any_value()" to my main sql as a temporary solution, and seems to work, only whenever i get an output, i cannot actually row out any output Oo? Whenever i try to output say "users_fornavn", which is Danish for first name... i get index undefined error... any ideas? I can only assume it it the sql that has the error? Hope you guys can help out a little. PS: Note that the "any_value()" part, was only supposed to be a temporary solution for a customer that want's the website up and running somewhere by next week, so i thought to add the any_value() sql function for now and at a later point be more specific about the code. I just need the rough ways for now so i am able to change that at a later point. Thanks in advance! Really hope you peepz can help me out!
  4. DILEMMA: My goal is to style the body of a newsletter template. Although I am able to get the formatting into the database and -table, I am unable to retrieve it for insertion in the newsletter's template. Please find below an example of the way in which the value string of only one of the several SQL INSERT statements is created. The string that results is later combined with a name string and other elements of a valid INSERT statement. EXAMPLE OF THE WAY THE INSERTED VALUE IS FORMATTED include_once('../_utilities/php/classes/class.lunarpages.php'); $lunarpages = new Lunarpages(); $mysqli_obj = $lunarpages->get_mysqli_obj(); var_dump($mysqli_obj); $sql_letter_val = "('"; $substr_start = 0; $substr_length = 8; foreach ($newsvar_names as $name => $value) { if (substr($name, $substr_start, $substr_length) == '$letter_') { $sql_letter_val .= $mysqli_obj->real_escape_string($value) . "', '"; } } WHAT APPEARS IN THE DATA TABLE AFTER INSERTION <h1>ようこそ!</h1> <p>「<span style='font-family:Bradley Hand, cursive;font-size:1.8em;'>Seven Gates</span>」と言うのは文法キャプチッブのオンラインニューズレターです。</p> <p>このニューズレターの初版は文法キャプチッブの紹介としてニューズレターの構成及び文法キャプチッブの本質をユーザー達にその母語で説明しています。第二版のニューズレター以降のニューズレターは英語で書いてあるものです。もしニューズレターの初版を英語でも読んだ方が好いとすれば、ウェブ型の変形が<a href='https://www.grammarcaptive.com/?newsletter=1' title='Seven Gates - Edition No. 1' target='_blank'>ここに</a>見付かります。</p> THE RETRIEVAL CODE public function get_letter_data() { $sql = "SELECT letter.*, qa.qa_question, qa.qa_answer FROM sevengates_letter AS letter JOIN sevengates_qa AS qa ON qa.letter_no = letter.letter_no WHERE letter.letter_no =?"; $mysqli_stmt = $this->mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $this->letter_no); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $prelim_result[] = $c; } foreach ($prelim_result as $arr) { foreach ($arr as $name => $value){ $letter_results[$name] = $value; } } return $letter_results; } WHAT IS RETRIEVED and APPEARS IN THE NEWSLETTER ようこそ! DISCUSSION: Everything after the <h1> element has been omitted. QUESTION: What must I do to get everything after ようそう!to appear? Roddy
  5. Hello W3S! So i have some problems again, hoping you can help me clear it out. I am currently trying to make a search page where a user can search for profiles with different profiles information such as tattoos, height, etc. And i have some difficulties making it work, hoping you can spot some sort of errors that i cannot. Please note that it's been a while since i've been making a fully working searcher with php and sql, so sorry for the messed up code, if so hehe Okay. So i have 6 files, follows as such: 1. index.php (being the main file) - (LOCATION: ROOT/FILE_HERE.php), 2. PAGE_searchprofiles.php (being where the search coding begins AND output is coming) - (LOCATION: ROOT/include/files/www-files/FILE_HERE.php), 3. functions.pagination.class.php (being my pagination class, used on file PAGE_searchprofiles.php) - (LOCATION: ROOT/FILE_HERE.php), 4. functions.php (my php functions into 1 file) - location is root 5. index.search_patterns_setup.php (being used on file PAGE_searchprofiles.php, being where i use if/else statements to compile a proper sql) - location root 6. index.no_search_show_cards_profiles.php (being used on file PAGE_searchprofiles.php, showing ALL profiles if no search has been done so far.) - location root ------------------------------------------- okay, those are file names and locations. the idea is that when there is a search, the searched profiles should be shown, else, show all files. I got that part working perfectly, but now comes the actual search query where i get a little lost (i think). And please take note that this is a search query from a past coder, doing this for a company and this coder has done some terrible coding... i think... i have a hard time seeing what he has done and not. At some places he has done a quite good job, but the search part, not so much. So, i will share the code below here for ALL files, and after that coding, i will write about the problem at hand again. -------------------------------------- index.php <?php ob_start(); session_start(); define("DEFINED_FILE:DEFINES_1", TRUE); require_once("include/files/www-files/random_uncategorized_useful_files/defines.php"); // Defines require_once("include/files/www-files/random_uncategorized_useful_files/report_methods.php"); // Reportings require_once("database/connection.php"); DB_open_main_connection(); // $dblink ?> <!DOCTYPE html> <html lang="da"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Release 1 - Version 1</title> <!-- Bootstrap V.4.0.0 CSS files --> <link rel="stylesheet" href="include/css/bootstrap.min.css" /> <!-- My Custom CSS Files --> <link rel="stylesheet" href="include/css/global_custom_css_design.css" /> <link rel="stylesheet" href="include/css/5.css" /> <link rel="stylesheet" href="include/css/navigation_menu_5.css" /> <!-- other css files --> <link rel="stylesheet" href="include/css/fontawesome-all.min.css"> <!-- Jquery (necessary for Bootstrap's JavaScript plugins) and Bootstrap V.4.0.0 JS Script files --> <script src="include/js/jquery-3.2.1.js"></script> <script src="include/js/bootstrap.min.js"></script> <script src="include/js/bootstrap.bundle.js"></script> <script src="include/js/5.js"></script> </head> <body> <?php # Require Navigation Menu require_once("include/files/www-files/nav-menu.php"); # Including PAGE_signup1.php include_once("include/files/www-files/PAGE_searchprofiles.php"); ?> <div class="mt-3"></div> <?php # Require Footer require_once("include/files/www-files/footer.php"); // close connection $dblink->close(); // MAIN Connection ?> </body> </html> PAGE_searchprofiles.php <?php require_once("functions.php"); //////////////////////////////////////////////////////////////////////////////////////////////////// // Notes //////////////////////////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------ // comma separeret DB output for ALLE checkboxes (Tatovering & Kategori - vi bruger explode!) //------------------------------------------------------------------------------------------------ /* I DB (users_info) laver jeg en "text" for både kategori og tatovering checkboxes da jeg skal bruge string til comma (sådan forstår jeg det!). Jeg indsætter komma sepereret tal, og bruger php funktionen explode til at sepererer tallene. Jeg bruger senere tallene til at "selecte" ud fra ID hos diverse tabeller, senere hen vise diverse som er blevet vist/valgt/osv. */ //////////////////////////////////////////////////////////////////////////////////////////////////// // Lists //////////////////////////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------ // FORM - names //------------------------------------------------------------------------------------------------ // my notes: maybe add "multiple" to the select? Style it to be a normale dropdown... look into alternatives! // FORMNAME_SogProfilBar_Keywords (Søg Profil Bar) // FORMNAME_MinAlder (Alder :: Minimum) // FORMNAME_MaxAlder (Alder :: Maximum) // FORMNAME_Landsdel (Landsdel "SelectOption") // FORMNAME_Kon (Køn "SelectOption") // FORMNAME_MinHojde (Højde :: Minimum) // FORMNAME_MaxHojde (Højde :: Maximum) // FORMNAME_Etnicitet (Etnicitet "SelectOption") // FORMNAME_Sprog (Sprog "SelectOption") // FORMNAME_MinVaegt (Vægt :: Minimum) // FORMNAME_MaxVaegt (Vægt :: Maximum) // FORMNAME_Tatoveringer (Tatoveringer "SelectOption") // FORMNAME_Kategorier (Kategorier "SelectOption") // FORMNAME_submit_search (Søg "Submit Button") //------------------------------------------------------------------------------------------------ // Queries - already being used //------------------------------------------------------------------------------------------------ // $query_1 (selecting all data from DB-Table users_info) // $query_2 (Landsdel -> SelectOption) // $query_3 (Køn -> SelectOption) // $query_4 (Etnicitet -> SelectOption) // $query_5 (Sprog -> SelectOption) // $query_6 (Tatoveringer -> SelectOption) // $query_7 (Kategori -> SelectOption) // $query_100 (outputting all cards/profiles to the "profiles" area) //------------------------------------------------------------------------------------------------ // Queries //------------------------------------------------------------------------------------------------ $query_1 = "SELECT * FROM users_info"; $result_1 = mysqli_query($dblink, $query_1) or die ( mysqli_error($dblink) ); $row_1 = mysqli_fetch_array($result_1); ?> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <br /> <h1 class="text-muted text-center">Søg Profiler</h1> </div> </div> </div> <div class="container"> <form method="post" action="index.php"> <div class="row mb-3"> <!-- Søg Profil Bar --> <div class="input-group"> <input type="text" class="form-control" placeholder="Søg Profil" name="FORMNAME_SogProfilBar_Keywords"> <div class="input-group-append"> <button type="submit" class="btn btn-outline-secondary" name="FORMNAME_submit_search">Søg</button> <button type="button" class="btn btn-outline-secondary JQUERY_ACTION_expand_search">Udvid Søgning</button> </div> </div> </div><!-- //.row --> <div class="row"> <div class="container"> <div class="row"> <!-- Min.Alder --> <div class="col-md-3"> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text">Min.Alder</span> <span class="input-group-text">ÅR</span> </div> <input type="number" class="form-control" placeholder="Min.Alder" min="0" name="FORMNAME_MinAlder"> </div> </div> <!-- Max.Alder --> <div class="col-md-3"> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text">Max.Alder</span> <span class="input-group-text">ÅR</span> </div> <input type="number" class="form-control" placeholder="Max.Alder" min="0" name="FORMNAME_MaxAlder"> </div> </div> <!-- Landsdel --> <div class="col-md-3"> <div class="input-group"> <div class="input-group-prepend"> <label class="input-group-text" for="inputGroupSelect_LANDSDEL">Landsdel</label> </div> <select class="custom-select" id="inputGroupSelect_LANDSDEL" name="FORMNAME_Landsdel"> <option selected disabled hidden>Landsdel</option> <?php $query_2 = "SELECT * FROM users_info_landsdel"; $result_2 = mysqli_query($dblink, $query_2) or die ( mysqli_error($dblink) ); while( $row_2 = mysqli_fetch_array($result_2) ) { $selected = ($row_2['usersinfoLandsdel_id'] == $row_1['usersinfo_FK_usersinfoLandsdel_id']) ? 'selected="selected"' : ''; echo '<option value="'.$row_2['usersinfoLandsdel_id'].'" '.$selected.'>'.$row_2['usersinfoLandsdel_name'].'</option>'; } ?> </select> </div> </div> <!-- Køn --> <div class="col-md-3"> <div class="input-group"> <div class="input-group-prepend"> <label class="input-group-text" for="inputGroupSelect_KØN">Køn</label> </div> <select class="custom-select" id="inputGroupSelect_KØN" name="FORMNAME_Kon"> <option selected disabled hidden>Køn</option> <?php $query_3 = "SELECT * FROM users_gender"; $result_3 = mysqli_query($dblink, $query_3) or die ( mysqli_error($dblink) ); while( $row_3 = mysqli_fetch_array($result_3) ) { $selected = ($row_3['usersGender_id'] == $row_1['users_FK_usersGender_id']) ? 'selected="selected"' : ''; echo '<option value="'.$row_3['usersGender_id'].'" '.$selected.'>'.$row_3['usersGender_name'].'</option>'; } ?> </select> </div> </div> </div><!-- //.row --> </div><!-- //.container --> </div><!-- //.row --> <div class="row" style="display: none;"> <div class="container mt-3 mb-3"> <div class="row mb-3"> <div class="col-md-3"> &nbsp; </div> <div class="col-md-3"> &nbsp; </div> <div class="col-md-3"> &nbsp; </div> <div class="col-md-3"> <button type="button" class="btn JQUERY_ACTION_minimize_search">Minimer Søgning</button> </div> </div><!-- //.row --> <div class="row mb-3"> <!-- Min.Højde --> <div class="col-md-3"> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text">Min.Højde</span> <span class="input-group-text">CM</span> </div> <input type="number" class="form-control" placeholder="Min.Højde" min="0" name="FORMNAME_MinHojde"> </div> </div> <!-- Max.Højde --> <div class="col-md-3"> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text">Max.Højde</span> <span class="input-group-text">CM</span> </div> <input type="number" class="form-control" placeholder="Max.Højde" min="0" name="FORMNAME_MaxHojde"> </div> </div> <!-- Etnicitet --> <div class="col-md-3"> <div class="input-group"> <div class="input-group-prepend"> <label class="input-group-text" for="inputGroupSelect_ETNICITET">Etnicitet</label> </div> <select class="custom-select" id="inputGroupSelect_ETNICITET" name="FORMNAME_Etnicitet"> <option selected disabled hidden>Etnicitet</option> <?php $query_4 = "SELECT * FROM users_gender"; $result_4 = mysqli_query($dblink, $query_4) or die ( mysqli_error($dblink) ); while( $row_4 = mysqli_fetch_array($result_4) ) { $selected = ($row_4['usersinfoEtnicitet_id'] == $row_1['usersinfo_FK_usersinfoEtnicitet_id']) ? 'selected="selected"' : ''; echo '<option value="'.$row_4['usersinfoEtnicitet_id'].'" '.$selected.'>'.$row_4['usersinfoEtnicitet_name'].'</option>'; } ?> </select> </div> </div> <!-- Sprog --> <div class="col-md-3"> <div class="input-group"> <div class="input-group-prepend"> <label class="input-group-text" for="inputGroupSelect_SPROG">Sprog</label> </div> <select class="custom-select" id="inputGroupSelect_SPROG" name="FORMNAME_Sprog"> <option selected disabled hidden>Sprog</option> <?php $query_5 = "SELECT * FROM users_info_sprog"; $result_5 = mysqli_query($dblink, $query_5) or die ( mysqli_error($dblink) ); while( $row_5 = mysqli_fetch_array($result_5) ) { $selected = ($row_5['usersinfoSprog_id'] == $row_1['usersinfo_FK_usersinfoSprog_id']) ? 'selected="selected"' : ''; echo '<option value="'.$row_5['usersinfoSprog_id'].'" '.$selected.'>'.$row_5['usersinfoSprog_name'].'</option>'; } ?> </select> </div> </div> </div><!-- //.row --> <div class="row"> <!-- Min.Vægt --> <div class="col-md-3"> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text">Min.Vægt</span> <span class="input-group-text">KG</span> </div> <input type="number" class="form-control" placeholder="Min.Vægt" min="0" name="FORMNAME_MinVaegt"> </div> </div> <!-- Max.Vægt --> <div class="col-md-3"> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text">Max.Vægt</span> <span class="input-group-text">KG</span> </div> <input type="number" class="form-control" placeholder="Max.Vægt" min="0" name="FORMNAME_MaxVaegt"> </div> </div> <!-- Tatoveringer --> <div class="col-md-3"> <div class="input-group"> <div class="input-group-prepend"> <label class="input-group-text" for="inputGroupSelect_TATOVERINGER">Tatoveringer</label> </div> <select class="custom-select" id="inputGroupSelect_TATOVERINGER" name="FORMNAME_Tatoveringer"> <option selected disabled hidden>Tatoveringer</option> <?php $query_6 = "SELECT * FROM users_info_tatoveringer"; $result_6 = mysqli_query($dblink, $query_6) or die ( mysqli_error($dblink) ); while( $row_6 = mysqli_fetch_array($result_6) ) { $selected = ($row_6['usersinfoTatoveringer_id'] == $row_1['usersinfo_FK_usersinfoTatoveringer_id']) ? 'selected="selected"' : ''; echo '<option value="'.$row_6['usersinfoTatoveringer_id'].'" '.$selected.'>'.$row_6['usersinfoTatoveringer_name'].'</option>'; } ?> </select> </div> </div> <!-- Kategorier --> <div class="col-md-3"> <?php //include_once("include/files/www-files/form_parts/searchprofiles_multiselect/multiselect_kategori.php"); ?> <div class="input-group"> <div class="input-group-prepend"> <label class="input-group-text" for="inputGroupSelect_KATEGORI">Kategorier</label> </div> <select class="custom-select" id="inputGroupSelect_KATEGORI" name="FORMNAME_Kategorier"> <option selected disabled hidden>Kategorier</option> <?php $query_7 = "SELECT * FROM users_info_kategorier"; $result_7 = mysqli_query($dblink, $query_7) or die ( mysqli_error($dblink) ); while( $row_7 = mysqli_fetch_array($result_7) ) { $selected = ($row_7['usersinfoKategorier_id'] == $row_1['usersinfo_FK_usersinfoKategorier_id']) ? 'selected="selected"' : ''; echo '<option value="'.$row_7['usersinfoKategorier_id'].'" '.$selected.'>'.$row_7['usersinfoKategorier_name'].'</option>'; } ?> </select> </div> </div> </div><!-- //.row --> </div><!-- //.container --> </div><!-- //.row (udvidet søgning) --> </form> </div> <div class="mt-3"></div> <div class="container"> <?php if( isset($_POST['FORMNAME_submit_search']) ) { //include_once("functions.pagination.class.php"); // include pagination $qur = ""; @$SearchKeywords = mysqli_real_escape_string($dblink, $_POST['FORMNAME_SogProfilBar_Keywords']); // Search Bar Profil Keywords @$MinAlder = mysqli_real_escape_string($dblink, $_POST['FORMNAME_MinAlder']); // Minimum Alder @$MaxAlder = mysqli_real_escape_string($dblink, $_POST['FORMNAME_MaxAlder']); // Maximum Alder @$Landsdel = mysqli_real_escape_string($dblink, $_POST['FORMNAME_Landsdel']); // Landsdel @$Kon = mysqli_real_escape_string($dblink, $_POST['FORMNAME_Kon']); // Køn @$MinHojde = mysqli_real_escape_string($dblink, $_POST['FORMNAME_MinHojde']); // Minimum Højde @$MaxHojde = mysqli_real_escape_string($dblink, $_POST['FORMNAME_MaxHojde']); // Maximum Højde @$Etnicitet = mysqli_real_escape_string($dblink, $_POST['FORMNAME_Etnicitet']); // Etnicitet @$Sprog = mysqli_real_escape_string($dblink, $_POST['FORMNAME_Sprog']); // Sprog @$MinVaegt = mysqli_real_escape_string($dblink, $_POST['FORMNAME_MinVaegt']); // Minimum Vægt @$MaxVaegt = mysqli_real_escape_string($dblink, $_POST['FORMNAME_MaxVaegt']); // Maximum Vægt @$Tatoveringer = mysqli_real_escape_string($dblink, $_POST['FORMNAME_Tatoveringer']); // Tatoveringer @$Kategorier = mysqli_real_escape_string($dblink, $_POST['FORMNAME_Kategorier']); // Kategorier // Søgning af ALT starter her. $query = "SET SESSION sql_mode='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION'"; $result = mysqli_query($dblink, $query) or die(mysqli_error($dblink)); $query = htmlentities(" SELECT DISTINCT users_id, users_fornavn, users_mellemnavn, users_efternavn, users_email, users_city, users_zipcode, users_birthday_date, users_address, users_tlf_telefon, users_tlf_mobil, usersinfo_profilesearch_viewable, usersinfo_hojde_cm, usersinfo_vaegt_kg, usersinfo_ErfaringKvalifikationer, usersinfo_beskaeftigelse, usersinfo_FK_usersinfoHairColor_id, usersinfo_FK_usersinfoEyeColor_id, usersinfo_FK_usersinfoBukseBredde_id, usersinfo_FK_usersinfoBukseLaengde_id, usersinfo_FK_usersinfoBluseStorrelse_id, usersinfo_FK_usersinfoSkoStorrelse_id, usersinfo_FK_usersinfoLandsdel_id, usersinfo_FK_usersinfoEtnicitet_id, usersinfo_FK_usersinfoTatoveringer_id, usersinfo_FK_usersinfoKategorier_id, usersinfo_FK_usersinfoSprog_id, usersGender_id, usersGender_name, usersinfoLandsdel_id, usersinfoLandsdel_name, usersinfoEtnicitet_id, usersinfoEtnicitet_name, usersinfoTatoveringer_id, usersinfoTatoveringer_name, usersinfoSprog_id, usersinfoSprog_name, usersinfoKategorier_id, usersinfoKategorier_name FROM users INNER JOIN users_info ON users.users_id = users_info.usersinfo_FK_users_id INNER JOIN users_gender ON users.users_FK_usersGender_id = users_gender.usersGender_id INNER JOIN users_info_landsdel ON users_info.usersinfo_FK_usersinfoLandsdel_id = users_info_landsdel.usersinfoLandsdel_id INNER JOIN users_info_etnicitet ON users_info.usersinfo_FK_usersinfoEtnicitet_id = users_info_etnicitet.usersinfoEtnicitet_id INNER JOIN users_info_tatoveringer ON users_info.usersinfo_FK_usersinfoTatoveringer_id = users_info_tatoveringer.usersinfoTatoveringer_id INNER JOIN users_info_sprog ON users_info.usersinfo_FK_usersinfoSprog_id = users_info_sprog.usersinfoSprog_id INNER JOIN users_info_kategorier ON users_info.usersinfo_FK_usersinfoKategorier_id = users_info_kategorier.usersinfoKategorier_id "); // Search patterns - needs editing! from old-original to my version so it fits! include_once("index.search_patterns_setup.php"); // fortsætter herunder $query .= " GROUP BY users_id, usersinfo_FK_users_id"; $result = mysqli_query($dblink, $query) or die(mysqli_error($dblink)); // hvis der ikke er EN række i udtrækket, vises en fejlbesked (??? på search eller ???) //$searchCount=mysqli_num_rows($result); // Behøver jeg denne del (???) // OG START PÅ "<?PHP ?\>" - HTML KOMMER HER IFØLGE TIDLIGERE KODE! (tror jeg skipper den del!) if( mysqli_num_rows($result) > 0 ) { while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { echo '<p>her er jeg!</p>'; // indsæt søge resultater her! } } else { $row = '<p>Der var desværre ingen resultater på din søgning. Prøv igen.</p>'; echo '<h3>'.$row.'</h3>'; die(); } } else { //include_once("functions.pagination.class.php"); // include pagination include_once("index.no_search_show_cards_profiles.php"); } ?> </div> <script> $('.JQUERY_ACTION_expand_search').on('click', function () { $(this).parent().parent().parent().next().next().show(1000); }); $('.JQUERY_ACTION_minimize_search').on('click', function () { $(this).parent().parent().parent().parent().hide(1000); }); </script> functions.pagination.class.php <?php class pagination { /* Properties array @var array @access private */ private $_properties = array(); /* Default configurations @var array @access public */ public $_defaults = array( 'page' => 1, 'perPage' => 10 ); /* Constructor @param array $array Array of results to be paginated @param int $curPage The current page interger that should used @param int $perPage The amount of items that should be show per page @return void @access public */ public function __construct($array, $curPage = null, $perPage = null) { $this->array = $array; $this->curPage = ($curPage == null ? $this->defaults['page'] : $curPage); $this->perPage = ($perPage == null ? $this->defaults['perPage'] : $perPage); } /* Global setter Utilises the properties array @param string $name The name of the property to set @param string $value The value that the property is assigned @return void @access public */ public function __set($name, $value) { $this->_properties[$name] = $value; } /* Global getter Takes a param from the properties array if it exists @param string $name The name of the property to get @return mixed Either the property from the internal properties array or false if isn't set @access public */ public function __get($name) { if (array_key_exists($name, $this->_properties)) { return $this->_properties[$name]; } return false; } /* Set the show first and last configuration This will enable the "<< first" and "last >>" style links @param boolean $showFirstAndLast True to show, false to hide. @return void @access public */ public function setShowFirstAndLast($showFirstAndLast) { $this->_showFirstAndLast = $showFirstAndLast; } /* Set the main seperator character By default this will implode an empty string @param string $mainSeperator The seperator between the page numbers @return void @access public */ public function setMainSeperator($mainSeperator) { $this->mainSeperator = $mainSeperator; } /* Get the result portion from the provided array @return array Reduced array with correct calculated offset @access public */ public function getResults() { // Assign the page variable if (empty($this->curPage) !== false) { $this->page = $this->curPage; // using the get method } else { $this->page = 1; // if we don't have a page number then assume we are on the first page } // Take the length of the array $this->length = count($this->array); // Get the number of pages $this->pages = ceil($this->length / $this->perPage); // Calculate the starting point $this->start = ceil(($this->page - 1) * $this->perPage); // return the portion of results return array_slice($this->array, $this->start, $this->perPage); } /* Get the html links for the generated page offset @param array $params A list of parameters (probably get/post) to pass around with each request @return mixed Return description (if any)... @access public */ public function getLinks($params = array()) { // Initiate the links array $plinks = array(); $links = array(); $slinks = array(); // Concatenate the get variables to add to the page numbering string $queryUrl = ''; if (!empty($params) === true ) { unset($params['page']); $queryUrl = '&amp;'.http_build_query($params); } // If we have more then one pages if (($this->pages) > 1) { // Assign the 'previous page' link into the array if we are not on the first page if ($this->page != 1) { if ($this->_showFirstAndLast) { $plinks[] = ' <a href="?page=1'.$queryUrl.'">&laquo;&laquo; First </a> '; } $plinks[] = ' <a href="?page='.($this->page - 1).$queryUrl.'">&laquo; Prev</a> '; } // Assign all the page numbers & links to the array for ($j = 1; $j < ($this->pages + 1); $j++) { if ($this->page == $j) { $links[] = ' <a class="selected">'.$j.'</a> '; // If we are on the same page as the current item } else { $links[] = ' <a href="?page='.$j.$queryUrl.'">'.$j.'</a> '; // add the link to the array } } // Assign the 'next page' if we are not on the last page if ($this->page < $this->pages) { $slinks[] = ' <a href="?page='.($this->page + 1).$queryUrl.'"> Next &raquo; </a> '; if ($this->_showFirstAndLast) { $slinks[] = ' <a href="?page='.($this->pages).$queryUrl.'"> Last &raquo;&raquo; </a> '; } } // Push the array into a string using any some glue return implode(' ', $plinks).implode($this->mainSeperator, $links).implode(' ', $slinks); } return; } } functions.php <?php // clause CHECK AND function // function clauseCHECK_AND () { global $clause; if( isset($clause) ) { $clause = " AND "; //echo "CLAUSE ER WHERE:"; } else { $clause = " WHERE "; } } // clause CHECK OR function // function clauseCHECK_OR () { global $clause; if( isset($clause) ) { $clause = " OR "; //echo "CLAUSE ER WHERE:"; } else { $clause = " WHERE "; } } ?> index.no_search_show_cards_profiles.php <div class="container"> <div class="card-columns"> <?php $query_100 = "SELECT * FROM users ORDER BY users_id DESC"; $result_100 = mysqli_query($dblink, $query_100) or die(mysqli_error($dblink)); if( mysqli_num_rows($result_100) > 0 ) { if( mysqli_num_rows($result_100) > 0 ) { while( $row_100 = mysqli_fetch_array($result_100) ) { $user_id = $row_100['users_id']; $user_fornavn = $row_100['users_fornavn']; $dateOfBirth = $row_100['users_birthday_date']; // output: Y-m-d (Year-Month-Day) $today = date("Y-m-d"); // current date today $diff = date_diff(date_create($dateOfBirth), date_create($today)); // difference between the two dates ?> <div class="card"> <a href="#" title="Profil"> <img class="card-img-top img-responsive img-rounded" src="https://dummyimage.com/250x330/000/fff.jpg" alt="Billede"> </a> <div class="card-body"> <h5 class="card-title"><b><?php echo $user_fornavn.',&nbsp;'.$diff->format('%y'); ?></b></h5> <p class="card-text">#<?php echo $user_id; ?></p> </div><!-- //.card-body --> </div><!-- //.card --> <?php } } } else { echo 'Intet at vise lige nu.'; } ?> </div> </div> index.search_patterns_setup.php <?php /////////////////////////// ALDER /////////////////////////// // ORIGINAL /* if( $minAlder > 0 ) { $time = new DateTime('now'); $newtime = $time->modify('-'.$minAlder.' year')->format('Y-m-d'); //echo $newtime; echo clauseCHECK(); $query .= $clause." user_dob <= '$newtime' "; //$clause .= " OR ";//Change to OR after 1st WHERE } if( $maxAlder > 0 ) { echo clauseCHECK(); $time = new DateTime('now'); $newtime = $time->modify('-'.$maxAlder.' year')->format('Y-m-d'); //echo $newtime; $query .= $clause." user_dob >= '$newtime' "; //$clause .= " OR ";//Change to OR after 1st WHERE } */ // MY VERSION if( $MinAlder > 0 ) { //echo clauseCHECK_AND(); echo "<p>".clauseCHECK_AND()."</p>"; // dob = Date Of Birth $time = new DateTime('now'); $newtime = $time->modify('-'.$MinAlder.' year')->format('Y-m-d'); $query .= $clause." users_birthday_date <= '$newtime' "; } if( $MaxAlder > 0 ) { //echo clauseCHECK_AND(); echo "<p>".clauseCHECK_AND()."</p>"; // dob = Date Of Birth $time = new DateTime('now'); $newtime = $time->modify('-'.$MaxAlder.' year')->format('Y-m-d'); $query .= $clause." users_birthday_date >= '$newtime' "; } /////////////////////////// KØN /////////////////////////// // ORIGINAL /* if( !empty($reg_koen) ) { echo clauseCHECK(); $query .= $clause." user_koen = '$reg_koen' "; //$clause .= " OR ";//Change to OR after 1st WHERE } */ // MY VERSION if( !empty($Kon) ) { //echo clauseCHECK_AND(); echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause." usersGender_id = '$Kon' "; } /////////////////////////// LANDSDEL /////////////////////////// // ORIGINAL /* if( !empty($reg_Landsdel) ) { echo clauseCHECK(); $query .= $clause." user_landsdel = '$reg_Landsdel' "; //$clause .= " OR ";//Change to OR after 1st WHERE } */ // MY VERSION if( !empty($Landsdel) ) { //echo clauseCHECK_AND(); echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause." usersinfoLandsdel_id = '$Landsdel' "; } /////////////////////////// ETNICITET /////////////////////////// // ORIGINAL /* if( !empty($reg_etnic) ) { echo clauseCHECK(); $query .= $clause." user_etnicitet = '$reg_etnic' "; //$clause .= " OR ";//Change to OR after 1st WHERE } */ // MY VERSION if( !empty($Etnicitet) ) { //echo clauseCHECK_AND(); echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause." usersinfoEtnicitet_id = '$Etnicitet' "; } /////////////////////////// TATOVERINGER /////////////////////////// // ORIGINAL /* if( !empty($_POST['check_listTat']) ) { // Loop to store and display values of individual checked checkbox. foreach($_POST['check_listTat'] as $c) { if( !empty($c) ) { echo clauseCHECKor(); $qur = "userPers_fk_tat_id"; $query .= $clause."".$qur." LIKE '%{$c}%'"; //$clause = " OR ";//Change to OR after 1st WHERE } } } */ // MY VERSION if( !empty($Tatoveringer) ) { // når jeg skifter til checkboxes, bruger jeg clauseCHECK_OR()! Som den bruges i de originale! Tjek for eksempler! //echo clauseCHECK_AND(); echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause." usersinfoTatoveringer_id = '$Tatoveringer' "; } /////////////////////////// SPROG /////////////////////////// // ORIGINAL /* if( !empty($_POST['check_listSprog']) ) { // Loop to store and display values of individual checked checkbox. foreach($_POST['check_listSprog'] as $c) { if( !empty($c) ) { echo clauseCHECKor(); $qur = "userPers_fk_sprog_id"; $query .= $clause."".$qur." LIKE '%{$c}%'"; $clause = " OR "; //Change to OR after 1st WHERE } } //echo $query;//Remove after testing } */ // MY VERSION if( !empty($Sprog) ) { // når jeg skifter til checkboxes, bruger jeg clauseCHECK_OR()! Som den bruges i de originale! Tjek for eksempler! //echo clauseCHECK_AND(); echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause." usersinfoSprog_id = '$Sprog' "; } /////////////////////////// KATEGORIER /////////////////////////// // ORIGINAL /* if( !empty($_POST['check_listKat']) ) { // Loop to store and display values of individual checked checkbox. // Loop to store and display values of individual checked checkbox. foreach($_POST['check_listKat'] as $c) { if( !empty($c) ) { echo clauseCHECKor(); $qur = "userPers_fk_kat_id"; $query .= $clause."".$qur." LIKE '%{$c}%'"; $clause = " OR ";//Change to OR after 1st WHERE } } } */ // MY VERSION if( !empty($Kategorier) ) { // når jeg skifter til checkboxes, bruger jeg clauseCHECK_OR()! Som den bruges i de originale! Tjek for eksempler! //echo clauseCHECK_AND(); echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause." usersinfoKategorier_id = '$Kategorier' "; } /////////////////////////// VÆGT /////////////////////////// // ORIGINAL /* if( $reg_vaegt_min>0 && $reg_vaegt_max<1 ) { $reg_vaegt_max="999"; } if( $reg_vaegt_max>0 && $reg_vaegt_min<1 ) { $reg_vaegt_min="1"; } if( $reg_vaegt_min>0 || $reg_vaegt_min>0 ) { echo clauseCHECK(); //echo "<br><hr><br>HER er vægt.<br><br>"; $query .= $clause."user_vaegt BETWEEN $reg_vaegt_min AND $reg_vaegt_max "; $clause = " OR "; } */ // MY VERSION if( $MinVaegt>0 && $MaxVaegt<1 ) { $reg_vaegt_max="999"; } if( $MaxVaegt>0 && $MinVaegt<1 ) { $reg_vaegt_min="1"; } if( $MinVaegt>0 || $MinVaegt>0 ) { // når jeg skifter til checkboxes, bruger jeg clauseCHECK_OR()! Som den bruges i de originale! Tjek for eksempler! //echo clauseCHECK_AND(); echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause."userinfo_vaegt_kg BETWEEN $MinVaegt AND $MaxVaegt "; $clause = " OR "; } /////////////////////////// HØJDE /////////////////////////// // ORIGINAL /* if( $reg_hoejde_min>0 && $reg_hoejde_max<1 ) { $reg_hoejde_max="999"; } if( $reg_hoejde_max>0 && $reg_hoejde_min<1 ) { $reg_hoejde_min="1"; } if( $reg_hoejde_min>0 || $reg_hoejde_min>0 ) { echo clauseCHECK(); //echo "<br><hr><br>HER er vægt.<br><br>"; $query .= $clause."user_hoejde BETWEEN $reg_hoejde_min AND $reg_hoejde_max "; $clause = " OR "; } */ // MY VERSION if( $MinHojde>0 && $MaxHojde<1 ) { $reg_hoejde_max="999"; } if( $MaxHojde>0 && $MinHojde<1 ) { $reg_hoejde_min="1"; } if( $MinHojde>0 || $MinHojde>0 ) { // når jeg skifter til checkboxes, bruger jeg clauseCHECK_OR()! Som den bruges i de originale! Tjek for eksempler! //echo clauseCHECK_AND(); echo "<p>".clauseCHECK_AND()."</p>"; $query .= $clause."usersinfo_hojde_cm BETWEEN $MinHojde AND $MaxHojde "; $clause = " OR "; } /////////////////////////// KEYWORDS /////////////////////////// // ORIGINAL /* //if keyword set, goes here if( !$keyword=="" ) { echo clauseCHECK();//Initial clause $c=" user_unikID LIKE '%$keyword%' OR user_fornavn LIKE '%$keyword%' OR user_efternavn LIKE '%$keyword%' OR user_faerdigheder LIKE '%$keyword%' OR user_etnicitet LIKE '%$keyword%' OR user_haarfarve LIKE '%$keyword%' OR user_haartype LIKE '%$keyword%' OR user_ojenfarve LIKE '%$keyword%' "; $query .= $clause." $c"; } */ // MY VERSION //if keyword set, goes here if( !$SearchKeywords=="" ) { //echo clauseCHECK_AND(); // Initial clause echo "<p>".clauseCHECK_AND()."</p>"; // Initial clause // unikID = old wwww-files :: ROOT/call/reg_sessioncall.php :: line ~290+ (cirka) // search query /* $c = " user_unikID LIKE '%$SearchKeywords%' OR users_fornavn LIKE '%$SearchKeywords%' OR users_mellemnavn LIKE '%$SearchKeywords%' OR users_efternavn LIKE '%$SearchKeywords%' OR users_faerdigheder LIKE '%$SearchKeywords%' OR user_etnicitet LIKE '%$SearchKeywords%' OR user_haarfarve LIKE '%$SearchKeywords%' OR user_haartype LIKE '%$SearchKeywords%' OR user_ojenfarve LIKE '%$SearchKeywords%' "; */ $c = " user_unikID LIKE '%$SearchKeywords%' OR users_fornavn LIKE '%$SearchKeywords%' OR users_mellemnavn LIKE '%$SearchKeywords%' OR users_efternavn LIKE '%$SearchKeywords%' "; $query .= $clause." $c"; } ?> ----------------------------------------------------------------- Okay, as you might have guessed, the code is a little long. (yay). Okay, so i have "tried" to clean up the past coding the best i could, BUT, here is where i get lost a bit. In the main query on PAGE_searchprofiles.php - am i supposed to make a lot of inner joins? I did that one myself, but wonna make sure BECAUSE! I have a LOT of tables and rows in the DB. I have a main table, users, where basic info is like firstname, etc. Then i have another called users_info, having a lot of integers with 1ns and zeros... those numbers are supposed to go to another table, for each table with Foreign Keys (FK), containing names, etc of forms and so on. I thought it would be better this way for the select at the time, and it was, but also worse for the search query because i have no idea if i am doing that part correct. Also with the file (index.search_patterns_setup.php) - not sure if i do the if/else's correct, since i just reused the old coders parameters and just changed the variables and queries to my database and variable names so they would look perfectly, and they do, only not sure if it's working or not :/ Mostly because whenever i make a search, nothing comes out, no errors either, just no rows. Not sure if i pinpoint the whole thing at different ways with id's etc with inner joins at the main query and the parameters if/else's statements. This is my current DB (query a little bit, but if you can check it out, go for it, just remember, it is in Danish some of it and some in English... combined the 2 languages for some text hehe): -- phpMyAdmin SQL Dump -- version 4.7.0 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: Mar 10, 2018 at 10:35 AM -- Server version: 5.7.18 -- PHP Version: 7.1.5 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `u1d4zzx` -- -- -------------------------------------------------------- -- -- Table structure for table `carousel1` -- CREATE TABLE `carousel1` ( `carousel1_id` int(11) NOT NULL, `carousel1_img_url` text NOT NULL, `carousel1_title` text NOT NULL, `carousel1_description` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `carousel1` -- INSERT INTO `carousel1` (`carousel1_id`, `carousel1_img_url`, `carousel1_title`, `carousel1_description`) VALUES (1, '1.PNG', 'No Title 1', 'No Description 1'), (2, '2.jpg', 'No Title 2', 'No Description 2'), (3, '3.jpg', 'No Title 3', 'No Description 3'), (4, '4.jpeg', 'No Title 4', 'No Description 4'); -- -------------------------------------------------------- -- -- Table structure for table `page_work1_videos` -- CREATE TABLE `page_work1_videos` ( `pw1videos_id` int(11) NOT NULL, `pw1videos_link` text NOT NULL, `pw1videos_director` text NOT NULL, `pw1videos_title` text NOT NULL, `pw1videos_text` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `page_work1_videos` -- INSERT INTO `page_work1_videos` (`pw1videos_id`, `pw1videos_link`, `pw1videos_director`, `pw1videos_title`, `pw1videos_text`) VALUES (6, 'DxiOVmuZyw4', 'Simon Bonde', 'Tuborg Classic', 'All Cast'), (7, 'BDhC7DU0yYE', ' ', 'Hi-Fi Klubben', 'Extras'), (8, 'nN1GLigSw40', 'Jannik Vestmar', 'Krifa', 'All Cast'), (9, 'wBC1WWO9AUc', 'Stevan Treshow', 'Oddset', 'All Cast'), (10, 'FH5cw-n00T8', 'Stevan Treshow', 'Oddset', 'All Cast'), (11, 'L7D1G8vgkEQ', 'Stevan Treshow', 'Oddset', 'All Cast'), (12, '_kASjW_aPbQ', 'Nadia Marquard', 'Emelie Sandé Wonder', 'Cast & Extras'), (14, '0rbA2qBDn8A', ' ', 'Ikano Bank', 'Cast '), (15, 'NYndyqp1gDU', ' ', 'Just Eat', 'All Cast'), (16, 't9diF_GKImA', ' ', 'Just Eat', 'All Cast'), (17, 'zvK8WL43kdY', 'Jonas Elmer', 'Betsafe', 'Cast '), (18, '0bPWGoTRFc0', 'Michael Langhoff', 'Øresundsbroen', 'Extras'), (19, 'MBcU7VCh_MM', 'Michael Langhoff', 'Øresundsbroen', 'Extras'), (20, '_m_KUK6QFS0', 'Michael Langhoff', 'Øresundsbroen', 'Extras'), (21, 'p7QrsVAEwIU', 'Michael Langhoff', 'Øresundsbroen', 'Extras'), (23, 'hmdlCmLrD8A', 'Simon Bonde & Michael Spooner', 'Ladbrokes', 'Cast & Extras'), (29, 'TjHSXd0CcNI', 'Fredrik Callinggard', 'Ofir', 'All Cast'), (30, 'CfAyPqhbeCM', 'Mats Stenberg', 'Casino.dk', 'Ekstra'), (31, 'Aml0d-e6czg', 'Michael Langhoff', 'DayDose', 'Extras'), (32, '5AdMpkKrlDE', '', 'Unibet ', 'Extras'), (33, 'jY-PZ4tMwXU', '', 'Unibet', 'Extras'), (38, '7Cd3UbueGzM', 'Fredrik Callinggard', 'Ofir', 'All Cast'), (42, 'R3JqzsNuer8', 'Gaute Hesthagen ', 'Telenor', 'All Cast'), (46, 'mmHpWlTZEk4', 'Gaute Hesthagen ', 'Telenor', 'All Cast'), (47, 'W3p0yzLc_js', 'Gaute Hesthagen ', 'Telenor', 'All Cast'), (49, '8IIGUBV-jqo', ' ', 'Mobilepay', 'All Cast'), (50, 'MQ_uMGxRvH8', '', 'Bygma', 'Extras'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `users_id` int(11) NOT NULL, `users_ActiveState` int(11) NOT NULL DEFAULT '0', `users_fornavn` varchar(255) NOT NULL, `users_mellemnavn` varchar(255) NOT NULL, `users_efternavn` varchar(255) NOT NULL, `users_email` text NOT NULL, `users_password` text NOT NULL, `users_FK_usersGender_id` int(11) NOT NULL DEFAULT '0', `users_city` varchar(255) NOT NULL, `users_zipcode` int(11) NOT NULL, `users_birthday_date` date DEFAULT NULL, `users_address` text NOT NULL, `users_tlf_telefon` int(11) NOT NULL DEFAULT '0', `users_tlf_mobil` int(11) NOT NULL DEFAULT '0', `users_FK_usersSubscription_id` int(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users` -- INSERT INTO `users` (`users_id`, `users_ActiveState`, `users_fornavn`, `users_mellemnavn`, `users_efternavn`, `users_email`, `users_password`, `users_FK_usersGender_id`, `users_city`, `users_zipcode`, `users_birthday_date`, `users_address`, `users_tlf_telefon`, `users_tlf_mobil`, `users_FK_usersSubscription_id`) VALUES (2, 1, 'd', 'd', 'd', 'd@yahoo.co.uk', '4c65f054573c27e35eefcdd5d6b31091516827fa', 2, 'FREDERIKSBERG C', 1851, '1992-11-08', 'Nyvej 16, 2TV', 44444444, 44444444, 3), (3, 0, 'dwjioj', 'odj', 'woidjo', 'derp@yahoo.dk', '4c65f054573c27e35eefcdd5d6b31091516827fa', 2, 'd C', 1851, '1992-11-08', 'diwjdo, 2TV', 44444444, 44444444, 2), (4, 0, 'Danie', ' ', 'Pedersen', 'd@yahoo.com', '4c65f054573c27e35eefcdd5d6b31091516827fa', 2, 'd C', 1851, '1992-11-08', ' ', 44444444, 44444444, 1), (5, 0, 'Uglen', ' ', 'Elsker', 'demo1@yahoo.dk', '4c65f054573c27e35eefcdd5d6b31091516827fa', 1, 'd C', 6666, '1992-11-08', ' ', 44444444, 44444444, 1), (6, 0, 'Ugleerne', ' ', 'Elskerne', 'demo2@yahoo.dk', '4c65f054573c27e35eefcdd5d6b31091516827fa', 1, 'd C', 6666, '1992-11-08', ' ', 44444444, 44444444, 1), (7, 0, 'derpy', ' ', 'derp', 'demo3@yahoo.dk', '4c65f054573c27e35eefcdd5d6b31091516827fa', 1, 'd C', 2000, '1992-11-08', ' ', 44444444, 51444379, 3), (8, 0, 'wdwe', '', 'dwad', 'demo4@yahoo.dk', '4c65f054573c27e35eefcdd5d6b31091516827fa', 1, 'd C', 5151, '2018-12-31', '', 51444379, 44444444, 1), (9, 0, 'wdwe', '', 'dwad', 'demo5@yahoo.dk', '4c65f054573c27e35eefcdd5d6b31091516827fa', 1, 'd C', 5151, '2018-12-31', '', 44444444, 51444379, 1), (10, 0, 'Karsten', '', 'Larsen', 'demo7@yahoo.dk', '4c65f054573c27e35eefcdd5d6b31091516827fa', 2, 'd C', 1851, '1992-11-08', '', 51444379, 44444444, 1); -- -------------------------------------------------------- -- -- Table structure for table `users_files` -- CREATE TABLE `users_files` ( `usersFiles_id` int(11) NOT NULL, `usersFiles_FK_users_id` int(11) NOT NULL DEFAULT '0', `usersFiles_avatar_1` text NOT NULL, `usersFiles_image_1` text NOT NULL, `usersFiles_image_2` text NOT NULL, `usersFiles_image_3` text NOT NULL, `usersFiles_image_4` text NOT NULL, `usersFiles_image_5` text NOT NULL, `usersFiles_image_6` text NOT NULL, `usersFiles_image_7` text NOT NULL, `usersFiles_image_8` text NOT NULL, `usersFiles_image_9` text NOT NULL, `usersFiles_image_10` text NOT NULL, `usersFiles_video_1` text NOT NULL, `usersFiles_video_2` text NOT NULL, `usersFiles_video_3` text NOT NULL, `usersFiles_video_4` text NOT NULL, `usersFiles_video_5` text NOT NULL, `usersFiles_video_6` text NOT NULL, `usersFiles_video_7` text NOT NULL, `usersFiles_video_8` text NOT NULL, `usersFiles_video_9` text NOT NULL, `usersFiles_video_10` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_files` -- INSERT INTO `users_files` (`usersFiles_id`, `usersFiles_FK_users_id`, `usersFiles_avatar_1`, `usersFiles_image_1`, `usersFiles_image_2`, `usersFiles_image_3`, `usersFiles_image_4`, `usersFiles_image_5`, `usersFiles_image_6`, `usersFiles_image_7`, `usersFiles_image_8`, `usersFiles_image_9`, `usersFiles_image_10`, `usersFiles_video_1`, `usersFiles_video_2`, `usersFiles_video_3`, `usersFiles_video_4`, `usersFiles_video_5`, `usersFiles_video_6`, `usersFiles_video_7`, `usersFiles_video_8`, `usersFiles_video_9`, `usersFiles_video_10`) VALUES (1, 2, '9e711fd22a826bf711a2f748692cf781.jpg', '', '', '', '', '', '', '', '', '', '16b72540e572da3f3ab5753e6034ab2d--rubber-catsuit-fetish-fashion.jpg', '', '', '', '', '', '', '', 'C3322_B_1.jpg', '', ''), (2, 10, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); -- -------------------------------------------------------- -- -- Table structure for table `users_gender` -- CREATE TABLE `users_gender` ( `usersGender_id` int(11) NOT NULL, `usersGender_name` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_gender` -- INSERT INTO `users_gender` (`usersGender_id`, `usersGender_name`) VALUES (1, 'Andet'), (2, 'Mand'), (3, 'Kvinde'); -- -------------------------------------------------------- -- -- Table structure for table `users_info` -- CREATE TABLE `users_info` ( `usersinfo_id` int(11) NOT NULL, `usersinfo_FK_users_id` int(11) NOT NULL DEFAULT '0', `usersinfo_hojde_cm` int(11) NOT NULL DEFAULT '0', `usersinfo_vaegt_kg` int(11) NOT NULL DEFAULT '0', `usersinfo_FK_usersinfoHairColor_id` int(11) NOT NULL DEFAULT '0', `usersinfo_FK_usersinfoEyeColor_id` int(11) NOT NULL DEFAULT '0', `usersinfo_FK_usersinfoBukseBredde_id` int(11) NOT NULL DEFAULT '0', `usersinfo_FK_usersinfoBukseLaengde_id` int(11) NOT NULL DEFAULT '0', `usersinfo_FK_usersinfoBluseStorrelse_id` int(11) NOT NULL DEFAULT '0', `usersinfo_FK_usersinfoSkoStorrelse_id` int(11) NOT NULL DEFAULT '0', `usersinfo_ErfaringKvalifikationer` text NOT NULL, `usersinfo_beskaeftigelse` text NOT NULL, `usersinfo_profilesearch_viewable` int(11) NOT NULL DEFAULT '0', `usersinfo_FK_usersinfoTatoveringer_id` varchar(255) NOT NULL, `usersinfo_FK_usersinfoKategorier_id` varchar(255) NOT NULL, `usersinfo_FK_usersinfoSprog_id` varchar(255) NOT NULL, `usersinfo_FK_usersinfoLandsdel_id` int(11) NOT NULL DEFAULT '0', `usersinfo_FK_usersinfoEtnicitet_id` int(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_info` -- INSERT INTO `users_info` (`usersinfo_id`, `usersinfo_FK_users_id`, `usersinfo_hojde_cm`, `usersinfo_vaegt_kg`, `usersinfo_FK_usersinfoHairColor_id`, `usersinfo_FK_usersinfoEyeColor_id`, `usersinfo_FK_usersinfoBukseBredde_id`, `usersinfo_FK_usersinfoBukseLaengde_id`, `usersinfo_FK_usersinfoBluseStorrelse_id`, `usersinfo_FK_usersinfoSkoStorrelse_id`, `usersinfo_ErfaringKvalifikationer`, `usersinfo_beskaeftigelse`, `usersinfo_profilesearch_viewable`, `usersinfo_FK_usersinfoTatoveringer_id`, `usersinfo_FK_usersinfoKategorier_id`, `usersinfo_FK_usersinfoSprog_id`, `usersinfo_FK_usersinfoLandsdel_id`, `usersinfo_FK_usersinfoEtnicitet_id`) VALUES (1, 2, 176, 130, 4, 1, 14, 21, 6, 29, ' Info tekst mangler. ', ' Info tekst mangler. ', 0, '', '', '', 0, 0); -- -------------------------------------------------------- -- -- Table structure for table `users_info_bluse_storrelse` -- CREATE TABLE `users_info_bluse_storrelse` ( `usersinfoBluseStorrelse_id` int(11) NOT NULL, `usersinfoBluseStorrelse_storrelse` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_info_bluse_storrelse` -- INSERT INTO `users_info_bluse_storrelse` (`usersinfoBluseStorrelse_id`, `usersinfoBluseStorrelse_storrelse`) VALUES (1, 'X-Small'), (2, 'Small'), (3, 'Medium'), (4, 'Large'), (5, 'X-Large'), (6, 'XX-Large'), (7, 'XXX-Large'); -- -------------------------------------------------------- -- -- Table structure for table `users_info_bukse_bredde` -- CREATE TABLE `users_info_bukse_bredde` ( `usersinfoBukseBredde_id` int(11) NOT NULL, `usersinfoBukseBredde_bredde` int(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_info_bukse_bredde` -- INSERT INTO `users_info_bukse_bredde` (`usersinfoBukseBredde_id`, `usersinfoBukseBredde_bredde`) VALUES (1, 24), (2, 25), (3, 26), (4, 27), (5, 28), (6, 29), (7, 30), (8, 31), (9, 32), (10, 33), (11, 34), (12, 35), (13, 36), (14, 37), (15, 38), (16, 39), (17, 40), (18, 41), (19, 42), (20, 43), (21, 44), (22, 45); -- -------------------------------------------------------- -- -- Table structure for table `users_info_bukse_laengde` -- CREATE TABLE `users_info_bukse_laengde` ( `usersinfoBukseLaengde_id` int(11) NOT NULL, `usersinfoBukseLaengde_laengde` int(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_info_bukse_laengde` -- INSERT INTO `users_info_bukse_laengde` (`usersinfoBukseLaengde_id`, `usersinfoBukseLaengde_laengde`) VALUES (1, 24), (2, 25), (3, 26), (4, 27), (5, 28), (6, 29), (7, 30), (8, 31), (9, 32), (10, 33), (11, 34), (12, 35), (13, 36), (14, 37), (15, 38), (16, 39), (17, 40), (18, 41), (19, 42), (20, 43), (21, 44), (22, 45), (23, 46), (24, 47), (25, 48); -- -------------------------------------------------------- -- -- Table structure for table `users_info_etnicitet` -- CREATE TABLE `users_info_etnicitet` ( `usersinfoEtnicitet_id` int(11) NOT NULL, `usersinfoEtnicitet_name` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `users_info_eye_color` -- CREATE TABLE `users_info_eye_color` ( `usersinfoEyeColor_id` int(11) NOT NULL, `usersinfoEyeColor_name` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_info_eye_color` -- INSERT INTO `users_info_eye_color` (`usersinfoEyeColor_id`, `usersinfoEyeColor_name`) VALUES (1, 'Blå'), (2, 'Grønne'), (3, 'Brune'), (4, 'Grå'); -- -------------------------------------------------------- -- -- Table structure for table `users_info_hair_color` -- CREATE TABLE `users_info_hair_color` ( `usersinfoHairColor_id` int(11) NOT NULL, `usersinfoHairColor_color` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_info_hair_color` -- INSERT INTO `users_info_hair_color` (`usersinfoHairColor_id`, `usersinfoHairColor_color`) VALUES (1, 'Hvidt'), (2, 'Platinblond'), (3, 'Lysblond'), (4, 'Mellemblond'), (5, 'Mørkeblond'), (6, 'Rødblond'), (7, 'Rød'), (8, 'Lysebrunt'), (9, 'Brunt'), (10, 'Mørkebrunt'), (11, 'Sort'), (12, 'Gråt'), (13, 'Grå stænk'), (14, 'Anden'); -- -------------------------------------------------------- -- -- Table structure for table `users_info_kategorier` -- CREATE TABLE `users_info_kategorier` ( `usersinfoKategorier_id` int(11) NOT NULL, `usersinfoKategorier_name` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_info_kategorier` -- INSERT INTO `users_info_kategorier` (`usersinfoKategorier_id`, `usersinfoKategorier_name`) VALUES (1, 'Uddannet skuespiller'), (2, 'Autodidakt skuespiller'), (3, 'Ingen erfaring (indenfor film, reklamer, TV)'), (4, 'Statist'), (5, 'Sanger'), (6, 'Danser'), (7, 'Tvilling'), (8, 'Mor til børn'), (9, 'Far til børn'); -- -------------------------------------------------------- -- -- Table structure for table `users_info_landsdel` -- CREATE TABLE `users_info_landsdel` ( `usersinfoLandsdel_id` int(11) NOT NULL, `usersinfoLandsdel_name` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_info_landsdel` -- INSERT INTO `users_info_landsdel` (`usersinfoLandsdel_id`, `usersinfoLandsdel_name`) VALUES (1, 'Sjælland'), (2, 'Jylland'), (3, 'Odense'), (4, 'Bornholm'); -- -------------------------------------------------------- -- -- Table structure for table `users_info_sko_storrelse` -- CREATE TABLE `users_info_sko_storrelse` ( `usersinfoSkoStorrelse_id` int(11) NOT NULL, `usersinfoSkoStorrelse_storrelse` int(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_info_sko_storrelse` -- INSERT INTO `users_info_sko_storrelse` (`usersinfoSkoStorrelse_id`, `usersinfoSkoStorrelse_storrelse`) VALUES (1, 17), (2, 18), (3, 19), (4, 20), (5, 21), (6, 22), (7, 23), (8, 24), (9, 25), (10, 26), (11, 27), (12, 28), (13, 29), (14, 30), (15, 31), (16, 32), (17, 33), (18, 34), (19, 35), (20, 36), (21, 37), (22, 38), (23, 39), (24, 40), (25, 41), (26, 42), (27, 43), (28, 44), (29, 45), (30, 46), (31, 47), (32, 48), (33, 49), (34, 50); -- -------------------------------------------------------- -- -- Table structure for table `users_info_sprog` -- CREATE TABLE `users_info_sprog` ( `usersinfoSprog_id` int(11) NOT NULL, `usersinfoSprog_name` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_info_sprog` -- INSERT INTO `users_info_sprog` (`usersinfoSprog_id`, `usersinfoSprog_name`) VALUES (1, 'Dansk'), (2, 'Engelsk (US)'), (3, 'Engelsk (UK)'), (4, 'Norsk'), (5, 'Svensk'), (6, 'Tysk'), (7, 'Fransk'); -- -------------------------------------------------------- -- -- Table structure for table `users_info_tatoveringer` -- CREATE TABLE `users_info_tatoveringer` ( `usersinfoTatoveringer_id` int(11) NOT NULL, `usersinfoTatoveringer_name` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `users_subscription` -- CREATE TABLE `users_subscription` ( `usersSubscription_id` int(11) NOT NULL, `usersSubscription_name` varchar(255) NOT NULL, `usersSubscription_months` int(11) NOT NULL DEFAULT '0', `usersSubscription_price` int(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users_subscription` -- INSERT INTO `users_subscription` (`usersSubscription_id`, `usersSubscription_name`, `usersSubscription_months`, `usersSubscription_price`) VALUES (1, '1 MDR 35,-', 1, 35), (2, '6 MDR 198,-', 6, 198), (3, '12 MDR 349,-', 12, 349); -- -- Indexes for dumped tables -- -- -- Indexes for table `carousel1` -- ALTER TABLE `carousel1` ADD PRIMARY KEY (`carousel1_id`); -- -- Indexes for table `page_work1_videos` -- ALTER TABLE `page_work1_videos` ADD PRIMARY KEY (`pw1videos_id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`users_id`); -- -- Indexes for table `users_files` -- ALTER TABLE `users_files` ADD PRIMARY KEY (`usersFiles_id`); -- -- Indexes for table `users_gender` -- ALTER TABLE `users_gender` ADD PRIMARY KEY (`usersGender_id`); -- -- Indexes for table `users_info` -- ALTER TABLE `users_info` ADD PRIMARY KEY (`usersinfo_id`); -- -- Indexes for table `users_info_bluse_storrelse` -- ALTER TABLE `users_info_bluse_storrelse` ADD PRIMARY KEY (`usersinfoBluseStorrelse_id`); -- -- Indexes for table `users_info_bukse_bredde` -- ALTER TABLE `users_info_bukse_bredde` ADD PRIMARY KEY (`usersinfoBukseBredde_id`); -- -- Indexes for table `users_info_bukse_laengde` -- ALTER TABLE `users_info_bukse_laengde` ADD PRIMARY KEY (`usersinfoBukseLaengde_id`); -- -- Indexes for table `users_info_etnicitet` -- ALTER TABLE `users_info_etnicitet` ADD PRIMARY KEY (`usersinfoEtnicitet_id`); -- -- Indexes for table `users_info_eye_color` -- ALTER TABLE `users_info_eye_color` ADD PRIMARY KEY (`usersinfoEyeColor_id`); -- -- Indexes for table `users_info_hair_color` -- ALTER TABLE `users_info_hair_color` ADD PRIMARY KEY (`usersinfoHairColor_id`); -- -- Indexes for table `users_info_kategorier` -- ALTER TABLE `users_info_kategorier` ADD PRIMARY KEY (`usersinfoKategorier_id`); -- -- Indexes for table `users_info_landsdel` -- ALTER TABLE `users_info_landsdel` ADD PRIMARY KEY (`usersinfoLandsdel_id`); -- -- Indexes for table `users_info_sko_storrelse` -- ALTER TABLE `users_info_sko_storrelse` ADD PRIMARY KEY (`usersinfoSkoStorrelse_id`); -- -- Indexes for table `users_info_sprog` -- ALTER TABLE `users_info_sprog` ADD PRIMARY KEY (`usersinfoSprog_id`); -- -- Indexes for table `users_info_tatoveringer` -- ALTER TABLE `users_info_tatoveringer` ADD PRIMARY KEY (`usersinfoTatoveringer_id`); -- -- Indexes for table `users_subscription` -- ALTER TABLE `users_subscription` ADD PRIMARY KEY (`usersSubscription_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `carousel1` -- ALTER TABLE `carousel1` MODIFY `carousel1_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `page_work1_videos` -- ALTER TABLE `page_work1_videos` MODIFY `pw1videos_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `users_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `users_files` -- ALTER TABLE `users_files` MODIFY `usersFiles_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `users_gender` -- ALTER TABLE `users_gender` MODIFY `usersGender_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `users_info` -- ALTER TABLE `users_info` MODIFY `usersinfo_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `users_info_bluse_storrelse` -- ALTER TABLE `users_info_bluse_storrelse` MODIFY `usersinfoBluseStorrelse_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `users_info_bukse_bredde` -- ALTER TABLE `users_info_bukse_bredde` MODIFY `usersinfoBukseBredde_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23; -- -- AUTO_INCREMENT for table `users_info_bukse_laengde` -- ALTER TABLE `users_info_bukse_laengde` MODIFY `usersinfoBukseLaengde_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26; -- -- AUTO_INCREMENT for table `users_info_etnicitet` -- ALTER TABLE `users_info_etnicitet` MODIFY `usersinfoEtnicitet_id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `users_info_eye_color` -- ALTER TABLE `users_info_eye_color` MODIFY `usersinfoEyeColor_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `users_info_hair_color` -- ALTER TABLE `users_info_hair_color` MODIFY `usersinfoHairColor_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT for table `users_info_kategorier` -- ALTER TABLE `users_info_kategorier` MODIFY `usersinfoKategorier_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT for table `users_info_landsdel` -- ALTER TABLE `users_info_landsdel` MODIFY `usersinfoLandsdel_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `users_info_sko_storrelse` -- ALTER TABLE `users_info_sko_storrelse` MODIFY `usersinfoSkoStorrelse_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35; -- -- AUTO_INCREMENT for table `users_info_sprog` -- ALTER TABLE `users_info_sprog` MODIFY `usersinfoSprog_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `users_info_tatoveringer` -- ALTER TABLE `users_info_tatoveringer` MODIFY `usersinfoTatoveringer_id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `users_subscription` -- ALTER TABLE `users_subscription` MODIFY `usersSubscription_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; please note with this SQL, i have removed some names pre-made But that is my SQL never the less. Hoping you can help. And it is to my believes that it is with the queries my problems are, mainly, unsure about the if/else's statements, they look good to my eye, it is mostly the SQL i am not the best at making when it comes to searchers. Hope you can help, as always, thanks, and sorry if i left any info out. Please ask if you need more information! Thanks again!
  6. Hi – I’m having a lot of trouble with a where clause with a date in my sql query. It seems I have tried everything and read many articles & blogs, but I can’t get it working. I understand the data type is very important to match up and the format also. Anyway I’ll tell you what I’ve got and see if anyone can help me. I’m joining 3 tables in my query – everything works fine and I get the results I want UNTIL I add the where clause. Unless there is something I need to change because of the where clause, I shouldn’t need advice on that. Tables Fields Kiosks – kioskID, workDate, locationID, workerID, bills, coins - workDate is type Date Locations - locationID, storeName, branchName, locationAbbrev Workers - workerID, firstName, lastName, phoneNum $sql = "SELECT Kiosks.kioskID, Kiosks.workDate, Locations.locationAbbrev, CONCAT(Workers.firstName, ' ', Workers.lastName) AS workerName, Kiosks.bills + Kiosks.coins AS amount FROM Locations INNER JOIN Kiosks ON Locations.locationID = Kiosks.locationID INNER JOIN Workers ON Kiosks.workerID = Workers.workerID”; This part works fine and I get a long list showing the Date, Location, Worker, and Amount using PHP. BUT,(everybody’s got a big BUTT) when I tack on the Where clause – kapoof!! When I try different formats I get either 0 results or unable to process messages. Here are a couple of things I’ve tried – hopefully someone can spot the error in my ways. Thanks $sql = "SELECT Kiosks.kioskID, Kiosks.workDate, Locations.locationAbbrev, CONCAT(Workers.firstName, ' ', Workers.lastName) AS workerName, Kiosks.bills + Kiosks.coins AS amount FROM Locations INNER JOIN Kiosks ON Locations.locationID = Kiosks.locationID INNER JOIN Workers ON Kiosks.workerID = Workers.workerID WHERE Kiosks.workDate = '2017-12-05'"; Also tried without quotes like = 2017-12-05 $sql = "SELECT Kiosks.kioskID, Kiosks.workDate, Locations.locationAbbrev, CONCAT(Workers.firstName, ' ', Workers.lastName) AS workerName, Kiosks.bills + Kiosks.coins AS amount FROM Locations INNER JOIN Kiosks ON Locations.locationID = Kiosks.locationID INNER JOIN Workers ON Kiosks.workerID = Workers.workerID WHERE year(Kiosks.workDate) = 2017 AND month(Kiosks.workDate) = 12 AND day(Kiosks.workDate) = 5";
  7. insert (XML DML)

    Hello, I have datalist with three elements: <root type="object"> <DataList type="array"> <item type="object"> <DtoVersion type="number">1</DtoVersion> <RowGroup type="string">8e795a55-b670-43c7-8963-776dcf7b5bf3</RowGroup> <RowItem type="array"> <item type="object"> <Value type="string">first</Value> </item> </RowItem> </item> <item type="object"> <DtoVersion type="number">1</DtoVersion> <RowGroup type="string">dcba8598-8ff5-46bf-a6ba-fe2291856229</RowGroup> <RowItem type="array"> <item type="object"> <Value type="string">second</Value> </item> </RowItem> </item> <item type="object"> <DtoVersion type="number">1</DtoVersion> <RowGroup type="string">93d7327e-f088-402b-a9ec-65a4c6791aff</RowGroup> <RowItem type="array"> <item type="object"> <Value type="string">fourth</Value> </item> </RowItem> </item> </DataList> </root> How can I modifies the contents of an XML document, so that insert <item type="object"> <DtoVersion type="number">1</DtoVersion> <RowGroup type="string">dcba8598-8ff5-46bf-a6ba-fe2291856229</RowGroup> <RowItem type="array"> <item type="object"> <Value type="string">third</Value> </item> </RowItem> </item> BEFORE the last element? update tblData SET XmlData.modify('insert <item type="object"> <DtoVersion type="number">1</DtoVersion> <RowGroup type="string">dcba8598-8ff5-46bf-a6ba-fe2291856229</RowGroup> <RowItem type="array"> <item type="object"> <Value type="string">third</Value> </item> </RowItem> </item> into (//DataList)[1]') insert the last element in the list.
  8. I'm learning php & sql. I can do the programming and logic, but how to put it all together is where I get confused. I have copied, from the w3 tutorial, the php form validation complete, and it worked fine. I have also used the php/sql database tutorial to copy the 'insert into' code and it works fine with a Db I set up on the local host. Now I would like to save the info in the form to a database table, but I'm not sure where to insert the code to connect to the database. I tried just adding the code at the bottom of the 'Form Complete' code but it didn't seem to take - no error codes but didn't get saved to the table. If I should keep it as a separate file, how and where do I call that file with the parameters I want to insert into the database? Is there anything on the w3 site that deals with this 'real life' situation. The tutorials are very good, but (everybody's got a big butt) the examples all use literals and they don't relate to a problem like I've explained here. I mean, why else would you have somebody fill in a form except to save the info in a table for future reference?? Any help going forward would be greatly appreciated. I didn't post the code here to save space, so if you're not sure what code I'm talking about, it's at w3schools and under PHP tutorial goto PHP forms 'Form Complete' and just below that in the SQL section is the code for Inserting data into a mySQL database. If I need to, I will post it. Thanx, Gil
  9. I am new to web development, so be patient please I am working with a tab navigation system. It happens to be bootstrap, but this question is not specific to bootstrap. There are four tabs; for the sake of simplicity we will call them tabs "A", "B", "C", and "D." I have a single SQL table and one of the columns --we will call it "Letter"-- identifies each row with one of the four letters. When a user clicks on "A" tab, they should see all the rows where "Letter" = "A". The same for tabs "B", "C", and "D." Right now I am running four separate queries, one for each tab. This seems ridiculous. There must be a way to grab all the data from the table with one query, sort the rows based on their "Letter" into four separate multi dimensional arrays, and then loop through the appropriate array to display the data for a particular "Letter" when a user selects that tab. I cannot figure out how to do this. Any suggestions would be most helpful. Thanks.
  10. Need help with a loop in SQL

    Hi, can anyone help me to understand where to put the "while" function in the code so i can display more than one row from the table please. This is the code i use: <?php $data_sheet = false; $datasheet_query = $db->Execute("SELECT TECHLINK_ID, TECHLINK_INCODE, TECHLINK_URLID, TECHLINK_products_id, TECH_URL, TECH_TITLE FROM FTECHLINK LEFT JOIN FTECHSHEET_URL ON TECH_ID = TECHLINK_URLID WHERE TECHLINK_products_id = ".(int)$_GET['products_id'].""); if (!$datasheet_query->EOF){ $data_sheet = true; $pdf_title = $datasheet_query->fields['TECH_TITLE']; $pdf_file = $datasheet_query->fields['TECH_URL']; $pdf_path = "acrobat/".$pdf_file; $image_name = str_ireplace('.pdf','.jpg',$pdf_file); $image_path = "acrobat/".$image_name; $tech_image = '<div class="download_image_container"><a href="' . $pdf_path . '"target="_blank">' . zen_image($image_path, $products_name, "173", "245", 'class="box_image_pdf"') . '</a></div>'; $tech_title = '<div class="download_title_container"><a class="document_title"href="' . $pdf_path . '"target="_blank">' . $pdf_title . '</a></div>'; } ?> <?php if ($data_sheet == true) { ?> <div id="datasheet" class="tab-pane"> <div class="product-tab"> <?php echo $tech_image; echo $tech_title; ?> </div> </div> <?php } ?> and the table looks like the image i attached, i know that the SQL query is working but i can't seem to display all the rows. Much appreciated for the help. Kind regards
  11. Small Group Projects

    I think it would be great to have small group projects .We could build login system; with air tight state of the art security, photo gallary's, audio gallery's. I think it would be a great tool for learning web development . Just a thought.
  12. Feedback on database design

    Hello, I'm a newbie developer and I'm just wondering if these forums would be an appropriate place to post the designs for a database I'm working on? I'm working on a site that people can use to keep track of their game collection. It's the first database I've designed entirely by myself and I'm looking for a place to post it so I can get some feedback on it. I see there's a thread for posting finished sites, is there a similar thread for databases? Thanks, Jay
  13. Converting .ASP to PHP HELP!!

    I have been given a .asp file that needs converting into PHP, the only issue i am having is with the mass update fields. <%@ Language=VBScript %> <% if Request.QueryString("Home") = Request.QueryString("Away") Then %> <% Response.Redirect("same.asp") %> <%End If%> <% if Request.QueryString("HomeGoal") > Request.QueryString("AwayGoal") Then%> <% Home = Request.QueryString("Home") away = Request.QuerySTring("Away") Goal = Request.QueryString("HomeGoal") GoalIn = Request.QueryString("AwayGoal") Set objConn = Server.CreateObject("ADODB.Connection") ConnStr = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=databse;UID=username;PWD=password!;" objconn.Open(ConnStr) objConn.Execute "UPDATE teams SET Victories = Victories + 1 WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Points = Points + 3 WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Played = Played + 1 WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Made = Made + '" & Goal & "' WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Let = Let + '" & GoalIn & "' WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Defeats = Defeats + 1 WHERE Team='" & Away & "'" objConn.Execute "UPDATE teams SET Played = Played + 1 WHERE Team='" & Away & "'" objConn.Execute "UPDATE teams SET Made = Made + '" & GoalIn & "' WHERE Team='" & Away & "'" objConn.Execute "UPDATE teams SET Let = Let + '" & Goal & "' WHERE Team='" & Away & "'" objConn.Close Set objConn= Nothing %> <%End if%> <% if Request.QueryString("HomeGoal") < Request.QueryString("AwayGoal") Then%> <% Home = Request.QueryString("Home") Away = Request.QuerySTring("Away") Goal = Request.QueryString("HomeGoal") GoalIn = Request.QueryString("AwayGoal") Set objConn = Server.CreateObject("ADODB.Connection") ConnStr = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=databse;UID=username;PWD=password!;" objconn.Open(ConnStr) objConn.Execute "UPDATE teams SET Defeats = Defeats + 1 WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Played = Played + 1 WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Made = Made + '" & Goal & "' WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Let = Let + '" & GoalIn & "' WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Victories = Victories + 1 WHERE Team='" & Away & "'" objConn.Execute "UPDATE teams SET Points = Points + 3 WHERE Team='" & Away & "'" objConn.Execute "UPDATE teams SET Played = Played + 1 WHERE Team='" & Away & "'" objConn.Execute "UPDATE teams SET Made = Made + '" & GoalIn & "' WHERE Team='" & Away & "'" objConn.Execute "UPDATE teams SET Let = Let + '" & Goal & "' WHERE Team='" & Away & "'" objConn.Close Set objConn= Nothing %> <%End if%> <% if Request.QueryString("HomeGoal") = Request.QueryString("AwayGoal") Then%> <% Home = Request.QueryString("Home") Away = Request.QueryString("Away") Goal = Request.QueryString("HomeGoal") GoalIn = Request.QueryString("AwayGoal") Set objConn = Server.CreateObject("ADODB.Connection") ConnStr = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;databse=fifa2;UID=username;PWD=password!;" objconn.Open(ConnStr) objConn.Execute "UPDATE teams SET Draws = Draws + 1 WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Points = Points + 1 WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Played = Played + 1 WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Made = Made + '" & Goal & "' WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Let = Let + '" & GoalIn & "' WHERE Team='" & Home & "'" objConn.Execute "UPDATE teams SET Draws = Draws + 1 WHERE Team='" & Away & "'" objConn.Execute "UPDATE teams SET Points = Points + 1 WHERE Team='" & Away & "'" objConn.Execute "UPDATE teams SET Played = Played + 1 WHERE Team='" & Away & "'" objConn.Execute "UPDATE teams SET Made = Made + '" & GoalIn & "' WHERE Team='" & Away & "'" objConn.Execute "UPDATE teams SET Let = Let + '" & Goal & "' WHERE Team='" & Away & "'" objConn.Close Set objConn= Nothing %> <%End if%> <% Home = Request.QueryString("Home") %> <% Away = Request.QueryString("Away") %> <% HomeGoal = Request.QueryString("HomeGoal") %> <% AwayGoal = Request.QueryString("AwayGoal") %> <head> <title>Game: <%=Home%> against <%=Away%> - Result updated...</title> <H3>Result submitted</H3><HR> <CENTER><B><%=Home%> - <%=HomeGoal%> - <%=AwayGoal%> - <%=Away%></CENTER><BR> <HR> <% if HomeGoal = AwayGoal Then %> <CENTER>The game ended as a draw!</CENTER> <%End If%> <% if HomeGoal > AwayGoal Then %> <CENTER><%=Home%> won against <%=Away%> !</CENTER> <%End If%> <% if HomeGoal < AwayGoal Then %> <CENTER><%=Away%> won against <%=Home%> !</CENTER> <%End If%> </b> <input type="button" value="Back" OnClick="top.location='results.asp'"> result_process.asp
  14. Hey guys, I have a problem. I want to write a record in my db when it does not already exists. For this, i have been looking on the web and found multiple solutions on Stackoverflow. The one I use is proved working, by the stack user however I get my die response :(. I use the following query (mysql/php): $query= "IF NOT EXISTS (SELECT * FROM tasksmade WHERE teamnumber='$teamnumber' AND tasknumber='$tasknumber' AND date='$date') INSERT INTO tasksmade (teamnumber, tasknumber, taskfinished, date) VALUES ('$teamnumber', '$tasknumber', '$taskfinished', '$date')"; $result= mysql_query($query,$mysql) or die("The query result has failed on the db!"); Hope someone can help! Thanks!
  15. Fixing my code?!?

    Hi guys, PROBLEM SOLVED (You Can lock this post)
  16. The root problem is an ASPX (ASP.NET) web page program, part of an important business program presently in development and connected to an sql server database (.mdf) file, is presently unable to do two procedures: rs=Server.CreateObject("ADODB.Recordset") and rs.Open (sql1,conn). Both operations return rs.State = False. The reason is not clearly understood. The system is Windows XP SP3. The only error observed in the MSSQL ERRORLOG is: The SQL Server Network Interface library could not register the Service Principal Name (SPN) for the SQL Server service. Error: 0x54b, state: 3. Failure to register an SPN may cause integrated authentication to fall back to NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies. When researched on Internet this first url was found: Reference(1): https://blogs.technet.microsoft.com/mdegre/2009/11/08/the-sql-network-interface-library-was-unable-to-register-spn/ Where it says: If you run SQL Server under the LocalSystem account, the SPN is automatically registered as SQL registering with the machine account that has the right to create an SPN default. So Kerberos interacts successfully with the server running SQL Server. The settings currently in use are SQLEXPRESS (2008R2) service, on Manual, with Local System startup account logon. This startup account is believed to have enough permissions to register the SPN, but that may be for an sql expert to decide. The SQL Server is started manually using the System Tray Icon, when needed. So upon further thought, the inadequate permission argument for causing the failed Recordset object creation does not seem to make complete sense. Since the Local System account being used for the sql server startup account should already have enough permission? On the other hand, the SQL ERRORLOG continues to say it could not register the SPN? (So Internet research was continued.) Then on Internet this second url was found: Reference(2): https://blogs.msdn.microsoft.com/dataaccesstechnologies/2010/01/06/how-to-grant-readserviceprincipalname-and-writeserviceprincipalname-rights-to-sql-server-service-start-up-account-without-using-adsdiedit-tool/ Comment: Ironically (considering the url article title) the decision was to use the ADSI Edit tool to assign greater permissions. Where it says: Instead of setting SPNs manually, you may want to give ReadServicePrincipalName and WriteServicePrincipalName rights to SQL Server service start-up account so that it can register and de-register SQL Server SPNs on its own whenever the SQL Server service is started and stopped. As the above articles describe, these rights can be granted from ADSIEDIT tool. Comment: The intended use of ADSI Edit tool seemed close to succeeding and might have succeeded but all attempts to connect ADSI Edit to the running SQL Server local instance have only been unsuccessful. ADSI Edit seems unable to see the running local sql server. Not enough was known about ADSI Edit to fix that. This is a standalone laptop without a domain and without a LAN. (But again there is the local sql server instance to connect to.) Then two SQL stored procedures sp_ActiveDirectory_SCP and sp_ActiveDirectory_Obj fail while attempting to register the SQL Server instance and the database (.mdf) file into the Active Directory database saying instead the system does not have Active Directory installed (but of course it does, at least partially). Then on Internet this third url was found: Reference(3): https://technet.microsoft.com/en-us/library/cc773354(v=ws.10).aspx Where it says: Adsiedit.msc automatically attempts to load the current domain to which the user is logged on. If the computer is installed in a workgroup or otherwise not logged on to a domain, the message "The specified domain does not exist" displays repeatedly. To resolve this issue, you may want to open an MMC, add the ADSI Edit snap-in, make connections as appropriate, and then save the console file. The ADSI Edit snap-in was succesfully added to MMC. But ADSI Edit still seems unable to make the connection in this situation. And the console file would not save. There are two command line tools (from win supp tools 2003) which can also set these R/W rights. One being setspn.exe and the other dsacls.exe. But they both also seem to read and store the permissions information in the Active Directory database (NTDS.dit) file. So Iwould not expect them to work either for similar reasons. It seems I am trying to get Active Directory working in a windows workgroup consisting of only one machine. Is that, by definition, impossible, since a workgroup needs to have a minimum of two machines? Reference(4): https://mssqlwiki.com/2013/12/09/sql-server-connectivity-kerberos-authentication-and-sql-server-spn-service-principal-name-for-sql-server/ The reference(4) does not change my situation because it still requires an Active Directory database which again requires a domain or workgroup (LAN) neither of which are present in my case. But reference(4) is still beneficial because it excels at providing such a detailed Active Directory configuration example. My last thought is that in the absence of a domain or workgroup (LAN), there are still present in my case the SQL Server instance and the localhost server (provided by MS Expression Development Server). So I came to wonder if it was possible for ADSI Edit to connect to those two servers somehow? (Attempts so far have been unsuccessful.) I cannot imagine how my situation is so unusual. Is mine the only machine running ms sql server in a standalone configuration? I would expect there to be (many) others. Thank you for your time. Please advise.
  17. Hi all, I'm trying to create a query which selects fields from 2 tables. I have a table 'stock' to store cars for sale and a table called 'custstock' which has the customer username and the vehID. How do I show all the cars that relate the that user who is logged in? My current query that doesn't work; $username = "-1"; if(isset($_SESSION['username'])){ $username = $_SESSION['username']; } // executeable query $sql = ("SELECT * FROM [stock] JOIN custstock ON [stock].custstockvehID = custstock.vehID WHERE username = '$username'"); Thanks, Jack
  18. Hi all, I'm trying to execute a query which uses the value from my session which is set when the user logs in. When I try to view the query, it displays nothing. SQL statement // get value of session $username = $_SESSION['username']; // executeable query $sql = ("SELECT * FROM custstock WHERE username = '$username'"); // query $row = mysqli_query($custdb, $sql) or die(mysqli_error($custdb)); The code for my table; <table width="100%" border="1" cellpadding="1" cellspacing="1" class="carInfo"> <tr> <th>ID</th> <th>Vehicle ID</th> <?php while($custveh = mysqli_fetch_assoc($row)){ echo "<tr>"; echo "<td>".$custveh['id']."</td>"; echo "<td>".$custveh['vehID']."</td>"; echo "</tr>"; } ?> </table> Any suggestions would be great, thanks! Jack
  19. SQL count help

    Hi, I have an issue and hope someone can point me in the right direction. I have a table called production Table production Id Job Company Status — —— ——— ——— 123 001 Test 1 Active 123 002 Test 1 Active 123 003 Test 1 Active 123 004 Test 1 Complete 123 005 Test 1 Active 123 006 Test 1 Complete 456 001 Test 2 Complete 456 002 Test 2 Complete 456 003 Test 2 Active 456 004 Test 2 Complete 456 005 Test 2 Active 456 006 Test 2 Complete 789 001 Test 3 Complete 789 002 Test 3 Active 789 003 Test 3 Active 789 004 Test 3 Active 789 005 Test 3 Active 789 006 Test 3 Active I'm trying to run a query that returns the following Company Active Complete Test 1 4 2 Test 2 2 4 Test 3 5 1 So its DISTINCT Id and counting the different status and return as above Any help would be great as I have been trying most of the day but without success Cheers Chris
  20. relational algebra

    hi, sorry, i have a question to do...but i know how to write in sql query ....however the answer need to write on relational algebra in query is like : SELECT * FROM operation where r='broken' group by pc having count(pc) >1 ; π id,pc,result ( σ r = 'broken' (operation)) like group by and having clasue...i no idea ... i searched on internet still @@ .... isnt the answer like that, i using split/step by step method to do rel 1 = σ r = 'broken' (operation) rel 2 = σ count(pc)>1 γ pc,count(pc) (rel 1)) rel 3 = π id,pc,result (rel 2 ) thanks
  21. Hello W3Schools Forum! This website keeps getting better. Used to I hardly ever visited it. Now it's one of my primary go-to destination points for programming information. I really do appreciate the information. I have got a question about the DISTINCT. http://www.w3schools.com/sql/sql_distinct.asp I cannot get the two column format to work. SELECT DISTINCT column_name, column_name // Can't get this one to work. FROM table_name; I can get the query to work with one column. SELECT DISTINCT column_name // It works fine using just one column. FROM table_name; It's worth noting. I have got a GoDaddy shared hosting. GoDaddy technical support says the hosting is on one of the older machines. The highest version of PHP is PHP 5.4 on the server. It's probably got an older version of MySQL, also. That could be the problem. I have been with GoDaddy since 2003. I am starting to look around for other hosting providers.
  22. Hi i am new for the PHP, i had the experienced before to do a login system page but what i want it is HTML and PHP file to separate i dont want PHP with HTML together to 1 file , cause professional people will more likely to use 2 file rather than 1 file easy to maintain and edit how to use the external PHP file coding without re-design whole page cause normally what i tested before was link or turn to other new page and result will come out but the design was totally gone so have any ways and suggestion to do that ... in the end, im sorry i not well in english and my knowledge of PHP still quite new , thanks you so much
  23. HI i trying to create a website of forum textarea editor are necessary too for recommendation which editor are best for textarea such as summernote, wysihtml5 .... and how is work to store the data/value/text with styling effect in mysql database ? Thanks all of you
  24. HI i trying to create a website of forum textarea editor are necessary too for recommendation which editor are best for textarea such as summernote, wysihtml5 .... and how is work to store the data/value/text in mysql database ? Thanks all of you
  25. textarea editor

    HI i trying to create a website of forum textarea editor are necessary too for recommendation which editor are best for textarea such as summernote, wysihtml5 .... and how is work to store the data/value/text in mysql database ? Thanks all of you
×