hello,
I wonder if it is possible to edit info from mysql.
I know how to update info... But if I want to edit it, i have to call it, then show in editor or something elseidk how i can do this...
Thanks... (btw, if you need more info, ask)
hello,
I wonder if it is possible to edit info from mysql.
I know how to update info... But if I want to edit it, i have to call it, then show in editor or something elseidk how i can do this...
Thanks... (btw, if you need more info, ask)
Sure you do. You know how to call the info and update the info. Basically, just call the info, assign it to a variable, place it into a textarea with a submit button at the bottom of the page and you know what to do after that.
First page:
and then in submitdata.php:Code:<?php include 'dbinfo.php'; $topic = "select summary, date from tablename where ID = 4"; $topic_res = mysql_query($verify_topic, $conn) or die(mysql_error()); $add_info = mysql_fetch_array($get_addresses_res)) { $ID = $add_info['ID']; $date = $add_info['date']; $summary = $add_info['summary']; }?><form action="/submitdata.php" method="post" name="editform"> <textarea name="summary" cols=75 rows=25><?php print htmlentities($summary) ; ?></textarea> <p><input type="submit" name="newbutton" value="Submit Review">
You have all of the info you need to do this from earlier questions you asked, but sometimes putting it all together is not always immediately understood. You should take a little more time to put what you know together before giving up and seeking help.PHP Code:<?php
include '../include/dbstuff.php';
$newbutton=$_POST['newbutton'];
$ID = $_POST['ID'];
$date = $_POST['date'];
$summary = $_POST['summary'];
$query = "UPDATE tablename SET ID='$ID',date='$date',summary='$summary',image='$image' WHERE ID='$ID'";
$result = mysql_query($query) or die ("Couldn't execute query.");
?>
PS Make sure you use cookies or sessions so that only the people you allow to use the page can do so. Also process your data to keep malicious (bad) data from being submitted.
Last edited by james438; 11-26-2009 at 12:21 AM.
To choose the lesser of two evils is still to choose evil. My personal site
Thanks... Hope this will work.![]()
It works, but one thing left...
I get text, but it is shown like this:
I entered some spaces to show code for lithuanian letters.PHP Code:J 63;s 71; 3;kelti darbai atliekami per 6-24h.<br>Ta 69;iau 3;vykus ir netik 79;toms priežastims, gali užsit&# 281;sti ir ilgiau.<br>B 63;kite kantr&# 363;s :D
As you can see I use Lithuanian language
and all br's are seen... how I can get nice output?
Thanks.
I need more information. When you are gather the information and you want it to be shown without the line breaks (br) are you submitting the the content with line breaks or are they appearing out of nowhere?
What I do with my content editing programs is I submit the data to the database with newlines as opposed to line breaks then when the content is retrieved the code looks nice. It looks like
as opposed to this which uses linebreaks:Code:This is some text. more text. A few more lines.
If I want to echo or print the data from my database for general viewing as opposed to viewing it in a textarea like this program does I retrieve the content and reformat it and then display the formatted text. It looks something likeCode:This is some text.<br>more text.<br><br>A few more lines.I also like to useCode:$content=str_replace("\r\n","<br>",$content);because when browsers display data they tend to condense two or more consecutive spaces. This will display them again.Code:$content=str_replace(" "," ",$content);
To choose the lesser of two evils is still to choose evil. My personal site
Bookmarks