php - Wordpress database error only while loading page for 1st time

admin2025-06-05  3

I have this error when i open the page...but once i select the city from dropdown list,the error doesn't exist. Error is like this:

WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1]

SELECT * FROM wp_city_details WHERE id=

I have city dropdown list like this:

<select class="form-control" name="city" id="city"  onchange="this.form.submit();">


    <option value="0 ----"></option>

                    <?php
                                $i = 1;
                                $cities = all_cities();
                                foreach ($cities as $city){
                                    $value = $i . " " . $city;
                    ?>
                                    <option 
                    <?php
                                    if (isset($_POST["city"])){
                                        if ($_POST["city"] == $value){
                                            ?> selected="true" <?php
                                        };
                                    }
                    ?>
                                    value="<?php echo $value; ?>"><?php echo $city;?></option>
                    <?php
                                    $i++;
                                }
                    ?>
                        </select>
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749088122a316261.html

最新回复(0)