MySQL help [EDITED] Display code?
Hello, I'm having a bit of bother with the edit_data function on my CMS here it is :
function update_data($table, $id, $data1, $data2)
{
$link = connectdb();
$sql = "UPDATE {$table} SET title='{$data1}', text='{$data2}' WHERE ID='{$id}'";
$result = mysql_query($sql, $link);
if ($result)
$result = "added";
else
$result = mysql_error();
disconnect($link);
return $result;
}```
Now this returns added, but its not....
Im unsure about the ' marks around the ID field, since its a number, but apperently if i change this theres an error at line 1??!
(this function is like the 5th function down on functions.php btw)
Have i missed something retarted? :(
SORTED
Problem 2.
I want to add the ability to type code into my articles.....
At the minute, my input checker fails any non num/char....
But how would i get it to safley save and echo anything? i got an idear...
the replace function, replaces any occurance of x, with y, both can be arrays...
I havnt got it workin yet, but my question really is if i changed every char to code, for example:
">" to ">"
for every possible char?
Would this work, or is there even a simpler way?
You only need the brackets around variables in a double-quoted string if those variables are arrays. Remove those. If ID is numeric, then remove the single quotes around the value; you don't need single quotes for numeric MySQL types. Check the case of "ID" in your query; field names are case-sensitive.
markuphtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentitieshtmlentities