Hi, I had worked before with wordpress, but mostly designing sites, little or no coding done so far. Currently I'm working in a site that requires to save and update data using a form, so it means to retrieve data from the MySQL database, put it in the form textboxes an other controls for the user can modify the content and save the changes. I'm new at PHP and has been looking around and found how to use the wpdb class, so now I know howto retrieve the data and show it:
<?php
global $wpdb;
$id = 2;
$result = $wpdb->get_results( "SELECT * FROM 4ps_people WHERE id=" . $id);
echo $result[0]->name;
?>
However, I need to put the content of $result in a textbox of a form. I tried adding:
<form>
Name: <input type="text" value="<?php echo $result[0]->name; ?>"/> </br>
</form>
But the textbox came out empty.
I'll greatly appreciate any help you can give me. Thanks.