I know how to display the data from a mySQL table, but how can I edit it via a webpage? Instead of going into phpMyAdmin you can edit it on a webpage. Is this possible?

I know how to display the data from a mySQL table, but how can I edit it via a webpage? Instead of going into phpMyAdmin you can edit it on a webpage. Is this possible?
i dnt think you can.. buh am not sure.. ><"
Just make a script so you can select from a drop down which you want to edit then it inserts the values into input boxes or text areas and on submit you make a mysql_query to update the ID
Making PHP Scripts for Paypal can code loads of things =)
*I'll make it show you. You pay i send
PM me =)
something like that, (more or less)PHP Code:$column = "Hi";
$update = mysql_query("UPDATE dbname SET `columnname` = '$column');
edit=
so if you have a page "edit.html'
with
<form action="update.php" method="POST">
<input tye="text" name="column1" value="Hi" /><br />
<input type="submit" name="update" value="Update the db" />
</form>
Then your update.php would be something like
or somethingPHP Code:
if($_POST["update"]){ //if update button is clicked
$column = $_POST["column1"]; //the field 'column1's stuff you entered
$update = mysql_query("UPDATE dbname SET `columnname` = '$column'); //update
echo("Db updated!");
}else{
echo("you did not hit the submit button!");
}
Last edited by [Oli]; 11-12-2007 at 10:45 AM.
^^ easier?PHP Code:
if($_POST["update"]){ //if update button is clicked
$column = $_POST["column1"]; //the field 'column1's stuff you entered
$update = mysql_query("UPDATE dbname SET `columnname` = '$column'"); //update
echo("Db updated");
} else {
echo(" <form method=\"POST\">
<input tye=\"text\" name=\"column1\" value=\"Hi\" /><br />
<input type=\"submit\" name=\"update\" value=\"Update the db\" />
</form>");
}
Last edited by DeejayMachoo$; 11-12-2007 at 11:42 AM.
Obviously :p^^ easier?PHP Code:
if($_POST["update"]){ //if update button is clicked
$column = $_POST["column1"]; //the field 'column1's stuff you entered
$update = mysql_query("UPDATE dbname SET `columnname` = '$column'"); //update
echo("Db updated");
} else {
echo(" <form method=\"POST\">
<input tye=\"text\" name=\"column1\" value=\"Hi\" /><br />
<input type=\"submit\" name=\"update\" value=\"Update the db\" />
</form>");
}
Just thought he might not know php that well (& not know you have to backslash the "s in the form so I thought id do it with an html page)
I want an edit option/link beside each comment, then if you click the link you'll be able to edit whatever commetn was there. Is that possible?
So say I have ten comments, and the edit link beside each comment. Lets say I click the edit link beside comment #4, ai'll be taken to a form where I can edit comment #4.
Last edited by adamFTW; 11-12-2007 at 01:17 PM.
Yes it's possible (I have it on TemplateNation's auction comments/bids)I want an edit option/link beside each comment, then if you click the link you'll be able to edit whatever commetn was there. Is that possible?
So say I have ten comments, and the edit link beside each comment. Lets say I click the edit link beside comment #4, ai'll be taken to a form where I can edit comment #4.
But to be honest.
Make sure you know php first, becouse if you don't you'll get stuck ;l
Yea..
On the edit comment button, make it link to comment.php?id=*comment id*
In comment.php
PHP Code:<?php
function clean($str)
{
$str = strip_tags(addslashes(stripslashes(htmlspecialchars($str))));
$str = mysql_real_escape_string($str);
}
$comment = clean($_POST[comment]);
$id = clean($_GET[id]);
if(isset($comment) || !empty($comment))
{
mysql_query("update comments set comment = '$comment' where id = '$id'");
echo("This comment has been edited successfully!");
echo('<meta http-equiv="refresh" content="2;url=index.html" />');
}
else
{
?>
<form action="comment.php" method="post">
<label for="comment">Edit Comment:</label>
<textarea name="comment" cols="40" rows="6"><?php
$get_current = mysql_fetch_array(mysql_query("select comment from comments where id = '$id'"));
echo("$get_current[comment]");
?>
</textarea>
<br /><br />
<input type="submit" value="Edit Comment!" />
</form>
<?php } ?>![]()
Last edited by MrCraig; 11-12-2007 at 02:00 PM.
Coming and going...
Highers are getting the better of me
Want to hide these adverts? Register an account for free!