Jump to content

Search the Community

Showing results for tags 'sql query'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. php 5.5.42 Database name: forums Table name: phpbb_users Row name: user_id What SQL query can I run in phpMyAdmin to update the user_id in every row, adding 8447002 to each user_id?
  2. For some reason we can't seem to get our select box in our search from to query from the database and generate results. Here is the snipit of code. We have tested and tried to just duplicate the code for the case radio button because when we tried radio button instead of select box it worked perfectly . All of the data for both the selectbox and radio button are housed in the same database. Can anyone please help us. Here is what we have that created the selectbox to begin with: function gmw_fl_fields_dropdown($gmw, $id, $class) { $total_fields = ( isset($gmw['profile_fields']) ) ? $gmw['profile_fields'] : array(); if( isset($gmw['profile_fields_date']) ) array_unshift($total_fields, $gmw['profile_fields_date']); echo '<div id="'.$id.'" class="'.$class.'">'; foreach ( $total_fields as $field_id ) { $field_data = new BP_XProfile_Field ($field_id); $fieldName = explode(' ', $field_data->name); $fieldName = preg_replace("/[^A-Za-z0-9]/","",$fieldName[0]); $get_field = (isset($_GET[$fieldName . '_' . $field_id])) ? $_GET[$fieldName . '_' . $field_id] : ''; $get_field_to = (isset($_GET[$fieldName . '_' . $field_id. '_to'])) ? $_GET[$fieldName . '_' . $field_id. '_to'] : ''; $children = $field_data->get_children (); switch ($field_data->type) { case 'datebox': echo '<div class="editfield field_'.$field_id.' datebox">'; echo '<span class="label">Age Range (min - max)</span>'; echo '<input size="3" type="text" name="'. $fieldName . '_' . $field_id.'" value="' . $get_field . '" placeholder="Min" style="width:10%" />'; echo ' - '; echo '<input size="3" type="text" name="'. $fieldName . '_' . $field_id . '_to" value="' . $get_field_to . '" placeholder="Max" style="width:10%" />'; echo '</div>'; break; case 'multiselectbox': case 'selectbox': case 'selectbox': echo '<div class="field_'.$field_id.'selectbox">'; echo '<span class="label">' . $field_data->name. '</span>'; $tt = array(); if($get_field) { $tt = $get_field; } echo '<select>'; foreach ($children as $child) { $child->name = trim ($child->name); $selected = (in_array ($child->name, $tt ) )? "selected='selected'": ""; echo '<option ' .$selected . ' type="selectbox" name="'. $fieldName . '_' . $field_id. '[]" value="'.$child->name.'">'.$child->name.'</option>'; //echo '<option value="'$selected . $child->name'"> . 'echo $child->name'</option>'; //echo '<input ' .$selected . ' type="selectbox" name="'. $fieldName . '_' . $field_id. '[]" value="'.$child->name.'" />'.$child->name.'</select>'; } echo '</select>'; echo '</div>'; break; And here is the query code: Agan the radio button worked perfectly and we did try to duplicate that code for the select box and it didn't work. We are thinking that we are missing something related to an array or a $_GET action... function gmw_fl_query_fields($gmw) { global $bp, $wpdb; $total_fields = false; $total_fields = ( isset( $gmw['profile_fields'] ) ) ? $gmw['profile_fields'] : array(); if( isset( $gmw['profile_fields_date'] ) && !empty( $gmw['profile_fields_date'] ) ) array_unshift( $total_fields, $gmw['profile_fields_date'] ); if ( !isset($total_fields) || empty($total_fields) ) return; $empty_fields = array(); $userids = false; foreach ($total_fields as $field_id) { $field_data = new BP_XProfile_Field ($field_id); $fieldName = explode(' ', $field_data->name); $fieldName = preg_replace("/[^A-Za-z0-9]/","",$fieldName[0]); $children = $field_data->get_children (); $value = ( isset($_GET[$fieldName . '_'. $field_id]) ) ? $_GET[$fieldName . '_'. $field_id] : ''; $to = ( isset($_GET[$fieldName . '_' . $field_id. '_to']) ) ? $_GET[$fieldName . '_' . $field_id. '_to'] : ''; if ($value) array_push($empty_fields, $value); if( $value || $to ) { switch ($field_data->type) { case 'selectbox': $category = $_GET ['$value']; $sql = "SELECT user_id from {$bp->profile->table_name_data}"; $sql .= " WHERE field_id = $field_id "; $sql .= ' AND ('. implode (' OR ', $category). ')'; break; case 'multiselectbox': case 'checkbox': case 'radio': $sql = "SELECT user_id from {$bp->profile->table_name_data}"; $sql .= " WHERE field_id = $field_id "; $like = array(); foreach ($value as $curvalue) $like[] = "value = '$curvalue' OR value LIKE '%\"$curvalue\"%' "; $sql .= ' AND ('. implode (' OR ', $like). ')'; break;
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.