view records form database in text area, seleck.....
Posted: Fri Dec 19, 2008 3:12 am
hallo there,
i am trying to implement an admin page ro my sql db.
the easy task was the insert records which i have done it and it works fine.
Now i want to have a text area to show some of the records. later i want the end-user to be able to select from text area any record ena erase it.
i thouhgt of some code put nothinf seems to work. here what i wrote:
<?php
//Include database connection details
require_once('config.php');
//Array to store validation errors
$errmsg_arr = array();
//Validation error flag
$errflag = false;
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
mysql_query("set character set 'greek'",$link);
mysql_query("SET NAMES 'greek'",$link);
$get = mysql_query("SELECT * FROM members where class=1") or die("Mmm pie:" . mysql_error());
while ($row = mysql_fetch_row($get)) {
echo "<h4>Stuff you stored:</h4>\n";
echo '<form action="update.php" method="post">';
for ($number = 1; $number < 7; $number++)
{
echo '<textarea>' .$row[$number]. '</textarea>';
}
echo '<input type="submit" name="update" value="Update" /></form>';
}
?>
the text area shows the correct data. how do i impllement the delete function? any ideas? i want the end user to select from textarea and delete every record he wish
i am trying to implement an admin page ro my sql db.
the easy task was the insert records which i have done it and it works fine.
Now i want to have a text area to show some of the records. later i want the end-user to be able to select from text area any record ena erase it.
i thouhgt of some code put nothinf seems to work. here what i wrote:
<?php
//Include database connection details
require_once('config.php');
//Array to store validation errors
$errmsg_arr = array();
//Validation error flag
$errflag = false;
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
mysql_query("set character set 'greek'",$link);
mysql_query("SET NAMES 'greek'",$link);
$get = mysql_query("SELECT * FROM members where class=1") or die("Mmm pie:" . mysql_error());
while ($row = mysql_fetch_row($get)) {
echo "<h4>Stuff you stored:</h4>\n";
echo '<form action="update.php" method="post">';
for ($number = 1; $number < 7; $number++)
{
echo '<textarea>' .$row[$number]. '</textarea>';
}
echo '<input type="submit" name="update" value="Update" /></form>';
}
?>
the text area shows the correct data. how do i impllement the delete function? any ideas? i want the end user to select from textarea and delete every record he wish