hey
i want to insert values in a table in a database and somehow end up inserting values in a table which i dont know where is (its really confusing)
this is my code to insert values
PHP Code:
function about_me_insert($aname,$location,$occupation,$username)
{
$conn=db_connect();
$result=$conn->query("update users set user_aname='".$aname."', user_location='".$location."', user_occupation='".$occupation."' where username='".$username."' ");
if(!$result)
{
echo "couldnt do it, sorry!!";
}
if ($result->num_rows>0) {
throw new Exception('Duplicate Details.');
}
else{
echo "Details saved with following parameters",$aname,$location,$occupation;}
}
and this is the output of the
Code:
select * from table
query
Code:
mysql> select * from users;
+---------+----------+------------------------------------------+---------------------+-----------+----------------+--------------------+------------+-----------------------+-------------+---------------+--------------+-----------------+------------+
| user_id | username | user_pass | user_email | user_bday | user_lastvisit | user_login_attemps | user_posts | user_allow_viewonline | user_avatar | user_location | user_newpass | user_occupation | user_aname |
+---------+----------+------------------------------------------+---------------------+-----------+----------------+--------------------+------------+-----------------------+-------------+---------------+--------------+-----------------+------------+
| 5 | sid | b1b3773a05c0ed0176787a4f1574ff0075f7521e | abcde@yahoo.co.in | NULL | NULL | NULL | 0 | NULL | NULL | home | NULL | NULL | NULL |
+---------+----------+------------------------------------------+---------------------+-----------+----------------+--------------------+------------+-----------------------+-------------+---------------+--------------+-----------------+------------+
1 row in set (0.00 sec)
it says it inserts value in the tables, but it actually does something else, cause the output of that is empty
and that 'home' in user_location is inserted by me through mysql itself
Bookmarks