"how to use a $result variable with table object in sql query using mysqli" Code Answer

2

i think from your winery table you are fetching other table name???

if so you need to fetch row from the $result and then get appropriate column from winery table (i.e. column with other table name).

btw best option would be joining two tables.

one more point where i think you are making mistake is

$sql = "select * from".$result."where wine_type='".$_get['wine_type']."'";

should be

$sql = "select * from ".$result." where wine_type='".$_get['wine_type']."'";

space between from & double quote and between double quote and where

to get winery_id from winary_name you can write your html form like

<select name="winary_id">
    <option value="winary id here">winary name here</option> // you can generate your dynamic options like this which will return id instead of name
</select>
By attish on August 17 2022

Answers related to “how to use a $result variable with table object in sql query using mysqli”

Only authorized users can answer the Search term. Please sign in first, or register a free account.