Hi
i have set up a blog based on wordpress. I want to add user specific data which is read-only for the users. So i created two fields : user_survey and user_survey_complete in wp_users tables
Now I want the users to be able to view the data under these colums but only for their own accounts . I don’t know how to use session function so I created a page which asks for the user_id and user_pass and returns the data under field user_survey and user_survey_complete
Instead of returning the data in user_survey and user_survey_complete , it just returns the heading user_survey and user_survey_complete
the code which asks for data is :
[CODE]
Username | |
Password | |
The code which I used to display the data
[CODE]MySQL Table Viewer
<?php $db_host = 'localhost'; $db_user = 'userid'; $db_pwd = 'password'; $database = 'wordpress_management'; $table = 'wp_users'; $user_id = trim(mysql_real_escape_string($_POST["user_id"])); $user_pass = trim(mysql_real_escape_string($_POST["user_pass"])); if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); // sending query $result = mysql_query("SELECT user_survey_link, user_survey_compelete FROM {$table} WHERE {$user_id}=user_login AND {$user_pass}=user_pass "); if (!$result) { die("Query to show fields from table failed"); } $fields_num = mysql_num_fields($result); echo "Table: {$table}
"; echo "{$field->name} | "; } echo "
$cell | "; echo "