473,626 Members | 3,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Editing and Updating Text

I'm trying to create a text editing and updating capability to help
someone who wants to maintain content on a web page without having to
know any HTML or use a web authoring tool and FTP'ng the contents.
I've already created a screen whereby the person can create new
content with a PHP program that inserts into a MySQL table. But, I'm
having a little trouble in creating the edit/update functionality.
Can somebody help me out? Thanks.

I created an edit screen called "teach_edit.php ". Based upon some
search parameters on another HTML screen, it retrieves the appropriate
text from the database. It seems to allow on screen editing.
However, when I hit the Submit button, nothing happens. It's supposed
to call another program called "teach_update.p hp". Here's the code
for it.

<HTML>
<HEAD>
<TITLE>Teachi ng Edit Program</TITLE>
</HEAD>
<BODY>
<?php
@ $db = mysql_connect(' localhost', '<db name>', '<password>');
if (!$db)
{
echo "Error: Could not connect to database. Please try again
later.";
exit;
}
mysql_select_db ("<db>");
$query = "select * from albert where ".$searchty pe." like
'%".$searchterm ."%'";

$result = mysql_query($qu ery);
while ($row = mysql_fetch_arr ay($result)) {
$title = $row['title'];
$teaching = $row['teaching'];
$teaching = wordwrap($teach ing, 60, "\n", 1);
$teachnum = $row['teachnum'];
}
if ($result)
{

echo '<textarea name="teachnum" rows="1" cols="4"
wrap="off">';
echo htmlspecialchar s($teachnum)."\ n";
echo '</textarea>';
echo '<textarea name="title" rows="1" cols="60" wrap="off">';
echo htmlspecialchar s($title)."\n";
echo '</textarea>';
echo '<textarea name="teaching" rows="20" cols="80"
wrap="on">';
echo htmlspecialchar s($teaching)."\ n";
echo '</textarea>';

}

?>

<input type=submit value="Update" name="teach_upd ate.php">
</form>
</BODY>
</HTML>

The "teach_update.p hp" looks like this.

<HTML>
<HEAD>
<TITLE>Teachi ng Update Program</TITLE>
</HEAD>
<BODY>
<?php
@ $db = mysql_connect(' localhost', '<database>', '<password>');
if (!$db)
{
echo "Error: Could not connect to database. Please try again
later.";
exit;
}
mysql_select_db ("<db>");
$query = "update albert set title =". $title . " and teaching = ".
$teaching . " where teachnum =" . $teachnum ;
$result = mysql_query($qu ery) or die("Could not update!");

if ($result)
{
echo mysql_affected_ rows()." text item updated into
database.";
}
?>
</BODY>
</HTML>
Jul 17 '05 #1
0 1781

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1050
by: Dennis Marks | last post by:
There are times that I am using another person's computer who has no knowledge of updating HTML and does not even know if he has the necessary programs to do the FTP. I may see a minor problem with my site and would like to change it on the fly. What I would like to know are the answers to the following questions. 1. Is there any way to display unformated HTML within a web page without using the browsers source facility?
3
3818
by: Islamegy | last post by:
When i press btn_save all changed rows in my grid get saved except the last editing row... I want my btn_Save to end editing in the datagrid.. so if user didn't press "enter" after editing last cell of the current row, I could force this row to be saved in the datasource. help plz
1
1272
by: Jeff Petter | last post by:
I can't seem to get the update piece working properly while doing in-place editing. I don't receive any errors, but the update doesn't take place. From the examples I've used as "go bys" it looks pretty straight forward. I've included my update code below. If anyone has any insight into my problem, I would certainly appreciate it. Thanks, Jeff private void DataGrid1_UpdateCommand(object source,...
0
927
by: Patrick.O.Ige | last post by:
I have a XML file which is formed ! And its used with a treeView menu control. But the thing is that the TREEVIEW hasn't got a constant hieracrchy structure! which is difficult to Edit,insert or update! Whats the best way to provide such functionality for a XML that isn't well structured! My xml looks like this:- <?xml version="1.0" encoding="utf-8"?> <TREENODES> <TreeNode Text="Contract">
5
1972
by: Ian Bicking | last post by:
I got a puzzler for y'all. I want to allow the editing of functions in-place. I won't go into the reason (it's for HTConsole -- http://blog.ianbicking.org/introducing-htconsole.html), except that I really want to edit it all in-process and in-memory. So I want the identity of the function to remain the same, even as I edit the body and hopefully the signature too. Well, the reason is that I want to edit any function object, without...
0
2134
by: skydiver_morgan | last post by:
I need some quick help with constructing a MYSQL query to help solve a small problem that I have. I havea table in my database where I need to search for text withing a field and delete it. The text that I need to find is not the only text in the field, it is in the field with other text. I am able to single out the records that need updating by using the statement: SELECT * FROM `events` WHERE `EVT_name` LIKE '%Jazz Stage: %';
0
2006
by: Frnak McKenney | last post by:
Can I use a bound ComboBox for both browsing and editing? I'm working on a small, standalone database application using Visual C#.NET 2003 and an Access data file. In order to keep the number of different screens down to a minimum, I'm trying to use the same Windows Forms for both browsing and for updating. This works fine for TextBoxes, but I'm running into problems with my DropDownLists (ComboBoxes).
1
1006
by: siddu | last post by:
While i am Updating MyDataGrid Data it is not Updating and Even it is not Displaying any Error.. Sub MyDataGrid_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles MyDataGrid.UpdateCommand Dim conn As SqlConnection Dim MyCommand As SqlCommand Dim strConn As String = "Data source=B4-2F-128-HTB2\SQLSVR; user id=sa; password=; Database=New_Cart" Dim...
0
1052
by: lazycoder207 | last post by:
hi i have a webbrowser control and textbox control in a form ..when application is starting up, webbrowser loads a page on my drive..that page links to a css style sheet..which has p { background-image: url("parapic.png"); background-repeat: no-repeat } now what i want is whenever a user types text in textbox and hits enter.. it shud be appended to that page in a para and updated in webbrowser control... how can i do it without opening...
0
8196
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2625
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.