PHP List based on Form Selection: MDB2 Error: syntax error -
I am creating a table that lists the country's details based on a form selection ... But I will continue this error: Here's my code: defined in your line It seems that you mean Since only a few lines are being defined, it is possible is B only by typing directly into the SQL statement that it, rather than a variable, but maybe after plans for the variable ... MDB2 error: syntax error . How can I fix this kind of error?
& lt ;? Php $ db = & amp; MDB2 :: connect ($ DSN); If (PAR :: Year ($ DB) is) {Dead ($ db-> getMessage ()); } $ Table_name = "Country"; $ Db- & gt; SetFetchMode (MDB2_FETCHMODE_ASSOC); $ Country_id = mysql_real_escape_string ($ _GET ["country_id"]); / * We have to check whether the place_id is integer if we do not have to return an error if (Preg_match ('/ ^ [A-Za-z] + $ /', $ country_id)) 'echo' Lt; H3 class = "center" & gt; Please enter a valid country code. & Lt; / H3 & gt; '; Look & lt; P align = "center" & gt; & Lt; A href = "country.htm" & gt; Input & lt; / A & gt; & Lt; / P & gt; '; Go out; }; Collect values from the form sent with the / / method method = $ gdp = mysql_real_escape_string ($ _GET ["gdp"]); $ Population = mysql_real_escape_string ($ _GET ["population"]); $ Country_name = mysql_real_escape_string ($ _GET ["country_name"]); $ Gold = mysql_real_escape_string ($ _GET ["gold"]); $ Bronze = mysql_real_escape_string ($ _GET ["bronze"]); $ Silver = mysql_real_escape_string ($ _GET ["silver"]); $ Total = mysql_real_escape_string ($ _GET ["total"]); $ Sql = "SELECT * FROM $ Country WHERE country_id = '$ country_id'"; $ Res = & amp; $ Db- & gt; Query ($ SQL); If (PAR :: year is $) (die ($ res-> getMessage ());}? & Gt;
"SELECT * FROM $ country WHERE country_id = '$ country_id'" , variable
$ country defined So, it will be presented as an example
"SELECT * FROM WHERE country_id = '1'" , hence the SQL error
$ Table_name is , where value
is 'country' .
Comments
Post a Comment