sjlink39
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: 403 Error When Passing ParametersYes, and global $wpdb is called in searchform.
Forum: Developing with WordPress
In reply to: 403 Error When Passing ParametersIt is being run at the top of winery-results. Query Monitor plugin shows that both of the Select routines are being run with empty variables. I can change it to hardcoding the variables and the Piedmont(NC) region displays nicely.
Forum: Developing with WordPress
In reply to: 403 Error When Passing ParametersPHP 7.4, but it runs through until the last one. Apparently not picking up any of the parameters. Even at the end, it gets $regionst as empty.
<?php $winename = $_GET['winename']; $cityst = isset( $_GET['cityst'] ) ?? '-select-'; $regionst = $_GET['regionst']; if($winename <> '') { $winerys = $wpdb->get_results("SELECT * FROM Wineries WHERE Name LIKE '%".$winename."%' ORDER By Name"); } if($cityst <> '-select-') { $citypos = strlen($cityst)-5; $st = substr($cityst,$citypos,2); $city = substr($cityst,0,$citypos-3); /*$city = 'Wilson'; $st = 'NC'; */ $winerys = $wpdb->get_results("SELECT * FROM Wineries WHERE City = '".$city."' AND State = '".$st."' ORDER By Name"); } if($regionst <> '-select-') { /*$citypos = strlen($regionst)-3; $st = substr($regionst,$citypos,2); $region = substr($regionst,0,$citypos-1);*/ $region = $regionst; $st = 'NC'; $winerys = $wpdb->get_results("SELECT * FROM Wineries WHERE Region = '".$region."' AND State = '".$st."' ORDER By Name"); }'- This reply was modified 5 years, 8 months ago by bcworkz. Reason: code fixed
Forum: Developing with WordPress
In reply to: 403 Error When Passing ParametersI tried your isset example and it didn’t retrieve the query variables. Then I tried the code below and it still doesn’t retrieve the variables. Then I took out the query_vars add filter and it still didn’t help.
$winename = $_GET['winename']; $cityst = $_GET['cityst']; $regionst = $_GET['regionst'];Maybe I set up the isset wrong –
$cityst = isset( $_GET['cityst'] ) ?? '-select-';Help!
Forum: Developing with WordPress
In reply to: 403 Error When Passing ParametersI have added
function wwp_custom_query_vars_filter($vars) { $vars[] = 'winename'; $vars[] = 'cityst'; $vars[] = 'regionst'; $vars[] = 'Search'; return $vars; } add_filter( 'query_vars', 'wwp_custom_query_vars_filter' );to functions.php
Forum: Developing with WordPress
In reply to: 403 Error When Passing ParametersI have the code
$winename = get_query_var( 'winename', '' ); $cityst = get_query_var( 'cityst', '-select-' ); $regionst = get_query_var( 'regionst', '-select-' ); if($winename <> '') { $winerys = $wpdb->get_results("SELECT * FROM Wineries WHERE Name LIKE '%".$winename."%' ORDER By Name"); }yet it is like get_query_var is not working since it never sets $winerys
I installed the Query Monitor plugin and it indicates that $winerys is unknown