![]() |
mysql update statement
hello, for some reason the update statement doesnt work for me. here is what my code looks like
thanks Code:
|
What is the error?
You should immidiatly add the error and all kinds of information what you can give us :) |
Quote:
|
For starters, don't put {'s around the values in the query, that probably is creating an error.
|
Quote:
Code:
echo "abcd some $var->some_property['abcd']->some_other_property and some more text"; |
i've updated the code and found out that it was something to do with the sql i was using at the where clause.
here is the new code Code:
<?phpCode:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'where id=''' at line 16 |
Remove the last comma, the last field doesn't need one :)
And you dont get the ID because the form reloads the page (sort of) and doesn't send the ID with it. |
Quote:
|
With the form you've made, include the ID in the URL. So the action tag will be action="<?php echo $_SERVER['PHP_SELF'] . '&id= '. $id; ?>".
But first you want to check the ID is save for HTML input via the GET variable: if(!is_numeric($_GET['id']) OR empty($_GET['id'])) { die('no valid id'); } That is a very simple (but ugly) way to do it :) |
well i would have included the ID as a walue of a hidden input field in the form.
And used the POST method to send it. |
Quote:
|
what if i have a table on the first page that displays rows of data from the database and each row has a unique id. if if were to use hidden textbox fields how do i insert the hidden fields value to be the value that was selected as a link to have that pass over to the next page?
example: <a href="page.php?id=1">dynamic link1</a> <a href="page.php?id=2">dynamic link1</a> <a href="page.php?id=3">dynamic link1</a> etc. so if these links were to dynamically be created based on the ammouint of rows in the database, how do i set the hidden textboxes value to the item selected? thanks |
i got it lol, what i did was once i got on the edit page i threw a hidden textbox into the html that grabs the urls id variable and displays its output then i got php to grab the numerical id value from the hidden textbox and process the page. thanks to eyedenify and xenon.
|
| All times are GMT. The time now is 10:53 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0