Error Updating Html Text In A Mysql Database
I have a field in my database which needs to contain html code (for formatting of text, lists, and links). I can successfully add the data and view it on a webpage, but I cannot figure out how to edit it.
I have read about magicquotes, htmlspecialchars, addslashes, etc, and I have tried various combinations of these without any luck.
My code currently looks like this:
$id = $_POST['id'];
$myhtml = $_POST['myhtml'];
if (!get_magic_quotes_gpc()) {
$myhtml = addslashes($myhtml);
}
$query = ("UPDATE products SET myhtml="$myhtml" where id="$id"");
$result = mysql_query($query);
And the error is: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'myhtml="
Can anyone help?! or advise where I might be going wrong?
View Complete Forum Thread with Replies
Related Forum Messages:
Updating Database, Error! Unknown
I am sending several variables from flash to this PHP script, and the php is recieving all the variables, but when it tries to modify and entry everything messes up. It essentially 'empties' the supposed to be modifed table entry (the only thing left is the name), and creates a new entry with the updated information. Code:
View Replies !
Updating A Mysql Database
It turns out that there are two folders on my schools webserver we can upload to. One is php enabled, one is not. I was simply putting my php scripts in the wrong place.) For a school project, I'm making something on an online movie database. Its got a "client" side where the users can browse the movies in the database, then it has an admin page where whoever has access can add movies, update them, delete them, etc. Code:
View Replies !
Updating A Record In A Mysql Database
I am sorry if this is a simple oversight, but I have been struggling for many hours over something which seems dead simple. I need to update a record in a table with more info. I am using the code below which soen't give me any errors but nothing happens. include("link.inc"); $db=connect_db(); $db_name=db_name(); mysql_select_db($db_name,$db); $sql="UPDATE data SET age='age',live='live',whatdo='whatdo',drinkalcohol='drinkalcohol',takedrugs='takedrugs',firstdrug='f irstdrug',seconddrug='seconddrug',medicine='medicine',alcohol='alcohol' WHERE id='$id'"; $result=mysql_query($sql,$db);
View Replies !
Script Not Updating Mysql Database
I have recently posted about a broader issue but now I have fixed part of the big issue. I am still having some trouble understanding why my script is not updating my database. If anyone can help I really do appreciate it. I filled in the Id and username variables with text for debugging purposes. The 'id' field in my database is set to auto increment and the 'username' is pulled from the user's login name. Code:
View Replies !
Retrieving MySQL Database Data & Updating On The Same Form...
I have managed to perform the following: 1. Adding Data to a MySQL Database. 2. Retrieving/Viewing Data from MySQL Database. I currently need to be able to perform the following: 1. While I view Data coming from the MySQL Database, I can currently edit the data on the same "view" form. Then I want to be able to save the changed data back to the Database. The problem is that when finished editing the data, the "update" button does NOT work... I want to be able to put/save the altered data back to the MySQL Database. And the button I have created does NOT work... Here is the code I use to enter NEW data to the MySQL Database: Code:
View Replies !
Convert Text From Database For HTML
I'm pulling text from a database (MySQL) and I'm using the nl2br () function to convert the line breaks DESCRIPTION="<?php echo nl2br($row_rsttheJobResults['description']); ?>" This creates the following example "A new line will be created soon < 'br' > and here it is." However the website that receives this cannot accept the characters < and > So I want to convert this "< br >" into this "<p>" Could anybody help me add to the nl2br () function to convert the < br > tags? * the spaces between the < and br are there because they won't show in the message otherwise
View Replies !
HTML In Mysql Text Field
I am build a news portal website run on php and mysql. I have a description field where i might need to place html tags such as links to websites and i might need to place php in there aswell. The field is a TEXT field. Will i have any problems such as inserting special characters "<,/:;"'[{" and so on. If so how do i bypass this problem.
View Replies !
Submitting Text For Use In A Mysql Database
This question has been bugging me for month. I have a website where people can enter stuff into a mysql database. Some of this information will already be shown in some textareas and input boxes, the user may change it and then hit submit. All the values are then passed to a mysql database, overriding the existing values (after the old ones have been backed-up). All of this works marvellous, apart from characters like &, ' and ". To make it even worse, some of the original text already contains &039; and other numeric character codes. Any values from the database are displayed by retrieving them from the DB [simplified of course] mysql_quer(...) $row = ... $Vold1 = $row[x]; $Vold2 = $row[y]; etc... <INPUT VALUE=$Vold NAME="x"> <TEXTAREA>$Vold</TEXTAREA NAME="y"> Any values that are submitted are processed as follows: $V1 = trim(stripslashes(htmlentities(trim($_POST["x"]))))) $V1 = trim(stripslashes(htmlentities(trim($_POST["y"]))))) then $V is inserted into the table using a mysql query.
View Replies !
Formatting Text With Mysql Database
help with formatting some text received from a database query. I am only selecting a single row per query so the formatting will only be performed on a single row. The rows I need to format upon display to the user are currently in text like so: word1 word2 word3 word4 (note there are only spaces between each word). I just want to insert a character between each word when displayed. A dash, for example. I want it to look like this: word1 - word2 - word3 - word4 etc. Its too late to do it b4 I put it in the database, so I have to do it now.
View Replies !
Text Display From My MySQL Database
There is also an id field that's an INI auto_increment. When I select the rows and try to display them, it appears as nothing. There are no error messages, but it just displays as nothing instead of the message in the MySQL database? What's wrong? PHP Code: <?php include "db_connect.php"; $id = $_GET['id']; $sql = 'SELECT note FROM `notes` LIMIT 0, 30 WHERE id=$id' $result = mysql_query($sql); echo "Notes:<br><br>$result"; echo "ID #: $id"; ?>
View Replies !
Text Search In MySQL Database
I am wiriting a PHP program that allows users to search item in the MySQL database. The items may have Chinese in their name or desciption. A form is created to allow users to input the search string and then it is transfer to another script to search the MySQL database by GET. I find that some strings can be found but some are not. Is it related to the property of Chinese characters.
View Replies !
Error When Inserting A ' Into Mysql Text Field
I'm using the below code to insert some text fields from a form into a database. I've noticed that if we type something using a ' (i.e we're all going out for the day) in the text field then we get a insert error back from mysql saying it can't insert into the text field. I kind of think I know what the problrem is but need someone in the know to clear it up for me ....
View Replies !
Importing Html To Mysql Database
I'm preparing to convert my "old" non-dynamic html website to php and mysql. I finally found a mediumly fast way to turn the html pages into raw data, but it has html codes within the content that I want to stay within the database. For example, I have DIV and CLASS codes with quote marks (div id="fred" - p class="red") that I want to stay. I've read through the mysql documentation and understand that I can set the fields-terminated-by, fields-enclosed-by and lines-terminated by with characters, but I can't find which characters are allowed. I also am not sure about doubling the quotes in order to keep them ("") or adding slashes ("), or what. I did a test run with phpmyadmin to add a simple four field test text file to a table I set up with phpmyadmin. I tried changing from the default field separators of ";" to "^" and record ends of "#". Nothing. Code:
View Replies !
Error In Displaying MySql Table In Html
i'm using this code to display a MySql table into my web pages, but sometimes the result come out with a slash before all apostrophes, like this text example: <td>at 'The House of Love'</td> these appearing slashes are also making unreadable all hyperlinks in the html output. here's the code i'm using to display MySql table, please do you find any bug that may cause this slash problem? Code:
View Replies !
Displaying Block Of Text From MySQL Database
I would like to create a details.php page that displays all my products. I understand how to get the title, price, description etc from mySQL. But my problem is how do I get a list of data? For example say I want to display the features of a product in point form (list). What is the best way to do this? How do most common websites do this? Code:
View Replies !
Uploading Info From A Text File Into A MySQL Database
what would the PHP and SQL code be to say basically: make a new row and put this in the field, what comes after each comma goes in a new field, and each new line should be a new row. I have a huge text file that i don't have a way to upload directly into a MySQL database because my webhost isn't allowing it for some reason.
View Replies !
Save Real HTML Tags Into My Mysql Database.
I want to save real HTML tags into my mysql database. I use $p = htmlentities($content); to convert the strange characters to real html. Then from another page i echo the content from the database and i see real html tags which is what i want.But in the database its still saved as:
View Replies !
Using A Php Html Form With Data Which Is Loaded From A Mysql Database.
I am using a php html form with data which is loaded from a mysql database. Three of the fields are textareas. The data loads into these fields fine, except that the loaded text starts at what appears to be 2 or 3 tab characters to the left. See illustration: +---------<this is a textarea object>---------+ | This is about the way that| |the text loads from the database field. | | | | | +---------------------------------------------+ It's almost as if there's a textarea "align" property which is set to "center" by default unless otherwise explicitly stated. Is there some setting in the wrap property that will fix this, or should I be looking elsewhere?
View Replies !
Use A Simple Form Into Html Verified Against A Mysql Database
I'm setting up an account login: should I use a simple form (user name and password) "embeded" into html verified against a mysql database or should I use the challenge/response scheme (also verified against a mysql database? Basically, is there any benefit to using challenge/response over merely submitting user name and password (like a search engine)?
View Replies !
Mysql Store Images On Database From Html Form Again.
i am trying to upload images to a database from an html form. This script is not connecting to the database and i do not know why. when i hit submit i get: This file has the following Database ID: 0 it acts like something happened but no information is goinig to the database. am i missing a binding or something? Code:
View Replies !
PHP:Unable To Post Variables From Html Form To Mysql Database
Plz dont treat this as another newbie query , i did my homework but still getting nowhere :( :( :( Trying to learn PHP on Fedora core 1 (PHP 4.3,MySQL,HTTPD).Unable to post data from html form to php file(connecting to mysql database and inserting into a table) . This seemingly simple problem is making me go mad !!! I googled extensively and already tried the following I enabled " register_globals = On " .... in /etc/php.ini and also took used _$POST syntax. wot could be the problem .... is it the case that /etc/php.ini file is not being read .... how do i know whether this is the default location for php.ini? Where can i find the PHPRC environment variable (the variable responsible for the php.ini default location) Is the problem something else .....? Following is the code ... form.html --------- <HTML> <HEAD> <TITLE> email entry form </TITLE> </HEAD> <BODY> <P>plz fil the form </P> <FORM METHOD="POST" ACTON="form-handler.php"> NAME: <BR> <INPUT TYPE=TEXT NAME="givename" SIZE=25> <BR> AGE: <br> <INPUT TYPE=TEXT NAME="givenaddress" SIZE=25> <BR> <INPUT TYPE=SUBMIT> </FORM> </BODY> </HTML> form-handler.php ----------------- <HTML> <HEAD> <TITLE> EMAIL FORM HANDLER </TITLE> </HEAD> <BODY> <? mysql_connect("localhost","root") or die("Failure on db connection"); mysql_select_db("mydb");
View Replies !
Updating An Html
I've got a page, actually a friend does, that he'd like to update with his schedule for the week. THis is a simple html page, and he'd like to do this via a php script. Ideally one would load the page, see a current week schedule if any, or nothing if there is none, and be able to add events. This should be as simple as possible and not require a database for this is simple text entry. I've fofilled part of this, i can open the index file, and write information to it, but i'm not sure how to lock the file so simultaneous writes can not occur and i do not know how o place the information in a specific area.
View Replies !
Php - Update Mysql Database - Syntax Error
When i try and update the database table i get this error. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc='My name is ***** and I'm a 17-yr. old junior. I play electric ba' at line 1 what i am doing is having the user fill in a large text area and saving it to a database. So i think the problem could possibly be that they are using ' and " in textarea to mess it up? Code:
View Replies !
T_String Error - How To Connect To A MySQL Database
I'm attempting to follow Dreamweaver MX's tutorial on how to connect to a MySQL database. Everything was going good (got the testing server set up, etc.), until I tried to preview a page in the browser. I got the following error: Parse error: parse error, unexpected T_STRING in c:inetpubwwwrootTestSite1comments-add.php on line 1 Line 1 reads: <?xml version="1.0" encoding="iso-8859-1"?> What is wrong with this? I don't see anything missing. I'm receiving the same error on another page, for the same line of code (but on line 24, rather than 1).
View Replies !
Updating A Text Area
I'm writing a sort of mini chatroom. The problem I've run into is that I can't figure out a way of updateing the HTML textarea I am using to display the messages in the chatroom. I want it to update about every 10 seconds or so. Is there any way of doing this in PHP? I'm willing to try JavaScript too, but I've only just started learning that?
View Replies !
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. 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.php". Here's the code for it. <HTML> <HEAD> <TITLE>Teaching 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 ".$searchtype." like '%".$searchterm."%'"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $title = $row['title']; $teaching = $row['teaching']; $teaching = wordwrap($teaching, 60, " ", 1); $teachnum = $row['teachnum']; } if ($result) {
View Replies !
Updating A Text File
I am currently building a PHP app, and some of the configuration is stored in a 'config.php' file which is created during the install. After install I would like for the users to update these values separately. for example: line 5 of config.php is: $language = 'english'; and this may need updating from the admin screen (using results from a drop down list of languages), without touching the rest of the file. Is there any way to locate and update a single line of the config file in my php script?
View Replies !
Updating Text On A Page
I am designing a site with which my client wants to be able to update the text on each page of the site e.g. each week they will want to change the "About Us" text, they also have food menus which they want to update. I realise this would be done using php... does anyone have any examples of something like this?
View Replies !
Updating Text In Form Submission
I am using a text area form submission to add imformation to a html webpage, and I would like to be able to edit that text in the php form at a later date after submission. Does anyone know how to get the origonal text back into the form text area for editting and resubmission?
View Replies !
Updating Text File With Textarea Input
i am creating an admin page for a person to update a page of their website through a web browser. the problem that i am having is the formatting of the inputted data into the textarea box. when it is displayed, all the returns and breaks are removed and the data is all in one line. i have been experimenting with nl2br() but i am not sure where to put it.
View Replies !
Updating Multiple Rows With One .html Page
I am trying to create a form to update multiple entries in a mysql databse. This code below is rough, but it is working to the point wher it pulls the data, displays it in the text areas (but it does not go past the first white space in displaying, that needs to be fixed), and then I can alter the text fields, check a box, and hit submit, and it will update the fields, but the new value is size=20. I also can't update more than one record at a time, which defeats the purpose. Code:
View Replies !
Updating A Database
This script searches a folder and if it finds a .gif file it stores the url of that file in the database. This part works. Now if it finds no .gif in the folder, but a stored url in the database I want it to delete that information form the database. This part doesn't work. Can someone please help me out? The problem starts after the ELSE statement. Code:
View Replies !
Not Updating The Database
I have this script, which I am trying to have automatically update the database. Right now it seems only to update 1 record, instead of looping through and calculating all, then updating them all in the database. Code:
View Replies !
Updating Database
I am trying to achieve is user enters their password and selects a length value from the drop down list. Then clicks submit and the lenght value is updated against their password (which is a unique id in the database). The page refreshes but nothing is updated in the database. PHP Code: <?php require_once ('mysql_connect.php'); if (isset ($_POST['submit'])) { $query = "UPDATE table SET length='{$_POST['length']}' WHERE id={$_POST['id']}"; $r = mysql_query ($query); $link='page.php' echo "<script language="javascript">window.location.href = '$link'</script>"; } else { print '<form action="page.php" method="POST"> password:<br /> <input type="text" name="id" value="" /><br /> length:<br />.....
View Replies !
Updating Database Using Oracle
This is somewhat a complex issue for me to handle. Any help is greatly appreciated. I am using PHP, with an ORACLE connection. A database filled with user name, error message, and annotation field is queried and displayed in a table. Each Row of the table contains a check box. The annotation value appears in a text box, so that the user can modify its value. If they change this value via the text box, and the associated rows check box is selected, then it is to update the database for the new user entered annotation. I am unsure how to verify, if they select 3 check boxes, modify the corresponding rows annotation field, how to update this in the database? I am pretty confused on this issue. So how can i verify which box is checked, to obtain the user entered value for that row that is checked, then update the database with the newly entered text box value.
View Replies !
Updating A Image In A Database
I have a database that I plan to store some images in..and yes I've read that a number advise agaist this and with that all aside..the reason I'm doing it is it helps save what little space I have by using a free mysql server for the time being. Anyways..the problem is this..I can't seem to get the update to work. I have PHP 4.3.2, Apache 2.0.46 and MySql 4.0.13. Code:
View Replies !
Dynamically Updating Database
I have drop-down menus created on a previous page, created dynamically so the number of them varies. When the form is submitted I need a script that will automatically add 1 to the value in the playerTries column in the players table, for every drop-down menu. I've tried the code below but don't fully understand what's happening, and why it's not working. Code:
View Replies !
Updating Current Database Row
I've been developing in classic ASP for 5 years and have decided to try my hand at PHP. So far I've been very impressed with the simplicity of the syntax and efficiency of the system overall. The only issue I've had so far is how I can update the current row recieved from a database connection (I'm using IIS and SQL 2005 for now until I migrate my apps). In ASP, I could do the following: oRS = DBConnection("SELECT * FROM People where PersonLogin='"&request("Login")&"'") To get values from a resultset: FirstName = oRS("FirstName") To update that same resultset inline: oRS("LastUpdated") = now() oRS.Update Using the above code, I could query the server to validate the login, if successful I could update their row in the DB using the same resultset and only one DB connection. In my sample PHP app, I have a simple user login, when they log in successfully, I want to update their row in the database and specifically update a column named "MemberLastLogin" with the current date. Do I have to make two separate DB connections, 1 to test the login and 2 to update their row? Or can I do this with a single connection.
View Replies !
Updating Database By Form
When a user clicks on their account page it should show all their account details...it already does it...but when they click the edit button i want the data to be put into a form format so that the user can update the details then click save...any ideas how to do it? is it better to have an edit page aswell or is there a way that i can make the page turn into a form?
View Replies !
Updating Content Via A Database
i have a website that i am designing in a group for a uni project,we are really behind and need some help with some coding as i dont have vast experience with php. I have got a admin section of the website which the company needs to update/change content etc. The problem is i need to update content via a color picker,which allows them to choose background color,font color,links color etc. The data input needs to be sent to the database where the changes will be made,then the public can see these changes when they visit the site. Can someone please help me with the coding to link to the database and anything else related or missing that i might need.
View Replies !
|