Php Mysql Update Where Clause Sql

You can use the SQL UPDATE command with or without the WHERE CLAUSE into the PHP function – mysql_query(). This function will execute the SQL command in a similar way it is executed at the mysql> prompt. PHP string variable in WHERE clause MySQL. Ask Question. Up vote 9 down vote favorite. I am having a problem with this simple sql query. Browse other questions tagged php mysql sql select or ask your own question. 5 years, 5 months ago. 48,412 times. HTML CSS JAVASCRIPT SQL PHP BOOTSTRAP HOW TO JQUERY W3.CSS PYTHON XML MORE. The SQL UPDATE Statement. The UPDATE statement is used to modify the existing records in a table. The following SQL statement will update the contactname to 'Juan' for all records where country is 'Mexico'.

Active6 years, 5 months ago

I am having a problem with this simple sql query:

When I use the string directly in the WHERE clause like this

I get a result. When I use the variable instead, I get no data! I am a novice and I can't figure out what am I doing wrong. Any help would be appreciated. Thank you!

Akis Wma AsimakopoulosAkis Wma Asimakopoulos

1 Answer

you getting no date because you have extra space betwee the quotes,

Hp compaq dc7800 convertible minitower drivers for windows 7 ultimate. Download the latest driver, firmware, and software for your HP Compaq dc7800 Convertible Minitower PC.This is HP's official website to download drivers free of cost for your HP Computing and Printing products for Windows and Mac operating system.

which will then be parsed into

remove it and it will work Download a database php.

As a sidenote, the query is vulnerable with SQL Injection if the value(s) of the variables came from the outside. Please take a look at the article below to learn how to prevent from it. By using PreparedStatements you can get rid of using single quotes around values.

Mysql Where Clause Date

Community

Php Mysql Update With Variable

John WooJohn Woo
214k49 gold badges408 silver badges432 bronze badges

Php Mysql Update Where Clause Sql Update

Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Php Mysql Update Record

Not the answer you're looking for? Browse other questions tagged phpmysqlsqlselect or ask your own question.