Please Help – Trouble with new plugin – List Group Info
-
Hi. I’m not very good with PHP but I’m learning so can someone point me in the right direction with this? I’ve been trying to get this working for weeks now.
I have users that enter their zip code and then select a pre-determined type of business from a drop down option box during registration. This info is recorded to the wp_usermeta table in the database.
Then when a zip code is entered in an input on a page and if there is any data in the database, that business info will be displayed. The plugin is working for this.
What I am trying to get at is this – if no info has been recorded in the database for a selected business type option within the entered zip code, then it will display (along with the other businesses in the database) a line that reads something like “Claim this Spot”
So after you enter a zip code it would display something like:
Hardware????????? Smith Hardware
Flowers????????? Johnson Flowers
Construction??????Claim this Spot (This links to a registration page)The code I have so far is:
function list_business_info_register_shortcodes() { add_shortcode('list-business-info', 'list_business_info_function'); } add_action( 'init', 'list_business_info_register_shortcodes'); function list_business_info_function() { if (isset($_POST['zip'])) $zip = $_POST['zip']; $businfo = ''; $result = mysql_query("SELECT user_id FROM wp_usermeta WHERE meta_key='rpr_9-digit_zip_code' AND meta_value=$zip"); while ($row = mysql_fetch_array($result)) { $userid = $row['user_id']; $bustype = mysql_query("SELECT meta_value FROM wp_usermeta WHERE meta_key='rpr_business_type' AND user_id=$userid"); while ($businesstype = mysql_fetch_array($bustype)) { $businesstypevalue = $businesstype['meta_value']; $businfo .='<tr><td>'; $businfo .= $businesstypevalue; $businfo .='</td><td>'; $businfo .='Name of Business'; $businfo .='</td></tr>'; } } return $businfo; }
I’ll put in the code for “Name of Business” later.
Thank you for your help. Any direction would be appreciated.
- The topic ‘Please Help – Trouble with new plugin – List Group Info’ is closed to new replies.