![]() |
Problem With Function
Hello All,
I'm wanting to see if anyone here can help me out. I'm building a small cms for a client that basically takes the google pagerank, technorati and alexa ranking and places them in a database. I then pull them from the db and display them. I'm having troubles updating the database. I keep getting the error "Unknown column 'www.michaelfroseth.com' in 'where clause'" (MichaelFrosethdotCom is one of 3 url's currently in the database, but it is the first one so i'm assuming that's why it's displaying that specific url). Here is my PHP code for the function I am using: PHP Code:
|
have you tried just placing the information within backticks (I know I know, mysql specific SQL and such).
|
Quote:
Thank! |
Alright, got it to work everyone. Had to change "WHERE url=$prURL" to "WHERE id=$row[id]"
That worked and updated successfully. Thanks everyone! |
Backticks are ` (Press the button to the left of 1). You should use them for escaping table & column names.
i.e. Code:
INSERT INTO `atable`(`name`,`content`)....Code:
INSERT INTO `atable`(`name`,`content`) VALUES('The title value', 'The content')Code:
INSERT INTO `atable`(`name`,`content`) VALUES('The title value', 'I'm the king of England')Code:
m the kind of England')To escape a string, use the mysql_real_escape function. It will automatically go through the string and escape (place a backslash in front of) any characters which could confuse MYSQL. The backslash will tell mysql to ignore the following character. The backslashes which are used to escape characters such as ' will not be stored in the table. |
| All times are GMT. The time now is 12:13 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0