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 Complete Forum Thread with Replies
Related Forum Messages:
Importing A Large Database
I have a back of mysite in sql. And it appears that line 4114 is currupt or something. Query: CREATE TABLE dstore ( uid varchar(255), name text, value text, enteredtime timestamp(14), id int(11) NOT NULL auto_increment, PRIMARY KEY (id), KEY nameidx (name) ); MySQL: BLOB column 'name' used in key specification without a key length I'm using bigdump to import it. is there any other script that will do this where I can make it skip that line? I can't open in it and remove the line do to the database is far to large for that.
View Replies !
Importing Csv File To Database
i am getting some errors importing csv file into my database. what happens is, all the data from my csv file is just being inserted into 1 row instead of going to its respective rows. attached is a copy of my csv file. hope you could help me with this i am using mysql 4.1.12.
View Replies !
Error When Importing Form Data Into Database
Here is the code I am using for the import I keep getting this error and am not sure what is causing it. 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 '','subdiv',ƈ',Ƈ.5',Ƈ.5','Unfinished','Yes','Yes',Ɖ/4 - 1 Ac near as I can tell this chunk of posted data starts at '$subdiv','$NumberOfBedrooms' etc.
View Replies !
Importing Txt File Into DB,and Importing An Extra Variable For Each Row....
I want to allow the user to select a CSV file to upload details into my Db, along with a seprate variable, which is a session variable called $vendorid, this is set when they login. So far I have the following, how can I insert the $vendorid in each row, along with the data from the text file? The Db has 11 columns, but the text file has 10, I want to set the 11th column to $vendorID for each row in the text file. Code:
View Replies !
CSV Importing To MySQL
Well I had the last script working perfectly. Except sometimes we rearrange the CSV "headers" so a field may be in one place on one file and another place on another file, yet they are the same thing. I've tired about 30 different scripts and none of them work at all. For example: Csv file looks like: work order,client name,start date,end date 7283728,"name,client",02/07/07,04/02/07 that is just the test file I've made up. I found out, the hard way, you cannot have spaces in your database fields. So what I am trying to do is take that first line, replace all spaces with an _. That away database fields can be like work_order and in the CSV file also. I tried using Code:
View Replies !
Importing Xml To Mysql
i am using this piece of code to import an xml file to mysql. $feed[$key] = $info; is causing the script to only return the last element of the xml file. I would like to return all elements but cant find a way to do so, <?php include 'library/config.php' include 'library/opendb.php' $file = "my-xml.xml"; $feed = array(); $key = ""; $info = ""; function startElement($xml_parser, $attrs ) { global $feed; } function endElement($xml_parser, $name) { global $feed, $info; $key = $name; $feed[$key] = $info; $info = ""; } function charData($xml_parser, $data ) { global $info; $info .= $data; } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "charData" ); $fp = fopen($file, "r"); while ($data = fread($fp, 8192)) !xml_parse($xml_parser, $data, feof($fp)); xml_parser_free($xml_parser); $sql= "INSERT INTO section ( "; $j=0; $i=count($feed); foreach( $feed as $assoc_index => $value ) { $j++; $sql.= strtolower($assoc_index); if($i>$j) $sql.= " , "; if($i<=$j) {$sql.= " ) VALUES ('";} } $h=0; foreach( $feed as $assoc_index => $value ) { $h++; $sql.= utf8_decode(trim(addslashes($value))); if($i-1>$h) $sql.= "', '"; if($i<=$h) $sql.= "','');"; } $query=trim($sql); echo $value; if (mysql_query($sql)){ echo "success in table creation."; } else { echo "no table created."; } echo mysql_error(); echo $sql; ?>
View Replies !
Importing CSV File Into MySQL
Im currently trying to import a CSV file into a MySQL database using myPHPAdmin 2.6.2, using the "Insert data from a text file into the table". However when I do this, all the values in each of the cell has a large amount of spaces included. I have tried all the different configurations of importing the CSV data, but without success.
View Replies !
Importing Data Into Mysql
I have an excel sheet that I'm using to add product data to. And for the product descriptions, in a single cell of excel, I'm using bullets and return characters, so the data is somewhat formatted. From excel, I export as a tab delimited text file, and I then import this file into mysql using the following loadfile command: PHP Code: load data infile './products.txt' into table products fields terminated by ' ' optionally enclosed by '"' lines terminated by ' ' When the file is imported, the newline (returns) are ignored. Actually, the are read as spaces. Because at the end of one line, where it should have gone to the next line, there is now a space, and then the bullet of the next line, and everything is just "stuck" together. Any clues on where this mishap is happening? Is there something I need to add to the import to tell mysql that there are newline characters in the file, and that those should be kept? And if so, what would that newline character be?
View Replies !
Importing To MySQL With Fgetcsv()
I have been using a PHP4 script to import a .csv feed that is too big for Excel now. I used to download and clean it up. The problem is that it has duplicate rows which need to be eliminated so that the database will only contain unique SKUs. Is there a query to use or a php function that will eliminate the duplicates and keep the script from stopping when it hits the first duplicate?
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 !
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 Replies !
Importing Text File Into MySQL DB
I'm writing a script to import a text file with fields delimited by ~ into a MySQL DB. I'm trying to import everything into an array first, so that one array row = one record row. Here is some dummy data, with the 񟐚' record having a couple of new lines where a new paragraph is. Note the other records have NULL in the same field: PHP Code:
View Replies !
Importing Data To MySql From Web Page
I'm using Drupal(a CMS), along with MySQL and PHP to import data into a database. I'm trying to import a bunch of sentences on one page into the database, but each in their own row. For example: News ----- Brand new site New employee hired New work acquired Basically, I need to know how to pull those into the database as one row each, instead of pulling all three elements into the database in the same row. They're all stored in a $content tag, b/c I wrote the page in PHP. So, any ideas on how to make it, so I can insert the $content into the database, but at a line break, I need to insert a new row?
View Replies !
MySQL Question - Importing .csv File
This doesnt really have anything to do with PHP itself, but does anyone know how (or if) I can import data from an excel sheet into my database? I can export it to that format so presume I can import? Im using PHPAdmin.
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 !
Importing To Mysql Without LOAD DATA LOCAL
I've just gone through the learning curve of realizing most virtual hosts have "LOAD DATA LOCAL" disabled :( I have a two meg delimited ascii file I need to import on a regular basis (26 fields) Anyone have a nice import routine using fopen they are willing to share before I attempt to hack one out myself? I can't seem to find such an animal out there (though some are close). Such a shame, from what I have read, load data is much faster...
View Replies !
Importing A Flat Pipe Delimited File Into A MySQL Data Table
I have done this in perl but eeew I don't want to use perl anymore. I want to be able to take a flat file that looks like this: mbriones@...|Marian|Briones bobsmith@...|Bob|Smith janedoe@...|Jane|Doe (etc) The table has more than 3 fields, so I'd want to process the flat file and then do an INSERT into mailinglist SET field=$value for each line. Does someone have a nice way for me to do this? The flat file will be uploaded to the server via a form (copy) and then be processed.
View Replies !
HTML In A Database
I've been using BLOBs to store the HTML coding in the database - and I can easily pull them back and spit them right into the PHP driven page to have all the bolds and italics and picture links and so on. but is there a better way to put them in the database.
View Replies !
Inserting HTML Into A Database?
I'm trying to upload HTML into my database. I'm using: $description=addslashes($_POST['description']); However, when i use HTML inside the content that i'm uploading, the code gets all messed up, when viewing the code inside the textarea? I'm trying to build an EDIT section, But the code i want to edit is not user friendly? Code:
View Replies !
Storing HTML In Database
I want to be able to store HTML input from a text field, and I wanted to encode it when it went in, so that it didn't break the PHP as it was assigning it to the variable. so I used URLEncode and URLdecode, but thenin text, "you'll" ends up as "you�ll", which is not what I want. Is there something else I could use? I've looked at a few functions in the man pages, but I don't think they're what I need.
View Replies !
HTML Form To Database
Is it easy to create an HTML form that connects to a database through a data handling form. I have php 4.4 on my server and wrote all my scripts in 5.0 language and they dont run so i just wanna use an HTML form to submit to a database and to retrieve info from it.
View Replies !
How Do I Write This Html From A Database?
I have a small database "Database.txt", each line of which looks something like: rv001,Some More Cities,112.00,OK,*1R: Paris*2_4R: London*4_6R: New York*8R: Moscow*10R: Rome*, I use a bit of php code to find an entry like the one above "rv001", and print an element of it out, like so: Code:
View Replies !
Database As Html Page
At both these sites. is there a way to make an .html page for each row of a database,and then to have a directory created automaticall for the date it's in. i thought i saw this done converting to html pages in a forum once. is this clear?
View Replies !
How To Get Html Tags From A Database ?
I have a database where people themself put a profilname into. I have just had a user who called his profil HisName<something> When this was written in my profil name list it only said HisName. Probably because the browser thought that <something> was html coding. So how can I get a name like that from the database without any mistakes by the browser. Is there some special way I should get the data from the database, or ?? I looked in MyPhpAdmin and here his name was HisName<something> so it is put in the database OK, it's when I get the name in the browser it can't get it right.
View Replies !
Html Email Into A Database
I can't seem to find the exact answer when I do a search for this topic. Let me take a shot here to see if anyone knows what I am seeking. I want to use imap_open() to parse a POP email box. I can connect to the server just fine and download the mail. What I want to do is, I want to download the entire email message instead of just the parts of the email.
View Replies !
HTML Tags In Database
I'm using WYSIWYG editor to add some contents into database. When i add the contents in the database they are displayed the same way as when i write them in the editor, however i want them to be displayed with html tags. e.g i don't want them saved in the db as 'text' but as '<p>text</p>'. $text = htmlspecialchars($text) before adding contents into the db should be working.
View Replies !
Importing CSS
I have a PHP script that displays a small calendar/diary block. It is called by an include() statement within the code of the target page on which we want the calendar displayed. Both the calendar script and the target pages use different CSS files (with unique rule classes). The target pages are based on a common template which loads the main CSS file. We want to avoid having special templates/pages to load the calendar script CSS. Question 1: How can I load CSS definitions in the PHP script without having to modify the header section os the target page? Secondly, the calendar is displayed in different styles on different pages by setting a variable before the include() call. Each of the four styles uses a different CSS file. Question 2: How can I load different CSS layouts depending upon the value of a PHP variable?
View Replies !
HTML Table Fetched From A Database
I want to generate a HTML table based on names fetched from a database. The tricky part is that I want to generate the table so that the names is written on both the top row and the left collumn. Should look something like this ---------------------------------------------- | ||NAME 1 | NAME 2| NAME3| |NAME 1| | | | ---------------------------------------------- |NAME2| | | | ---------------------------------------------- |NAME3| | | | ---------------------------------------------- Hope that anybody has a idea how to solve this.
View Replies !
Secure Way To Store HTML In The Database?
to my understanding it is very unsafe to allow users to submit HTML from a form to the database. What if I allowed the user to use HTML, but when they submitted it I would change all the >'s and <'s into backets [ and ]. So the user would type out: <img src="image.jpg"> and it would be inserted into the database like this: [img src="image.jpg"] Would this be a secure way of doing it? Or is there a better way?
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 !
Publish JPEG Or HTML From A Database
I have a jpeg file and a HTML page that are stored in two separate blob fields of a databses, namely interbase, what is the best method of pulling each of these items out so that they can be displayed in a web browser.
View Replies !
Needs Guidance On Database And Html Integration
I have looked through forums and tutorials and with the advice there I have managed to manipulate my MYSQL database. I have created HTML forms to add data and select data with PHP to handle the file processes. However I have not been able to find an example of how to do this in a single HTML, or PHP, file. At the moment what happens is that data, or a search request, is entered, the user presses the validate button, the variables are processed by the PHP file and that is it, single time, ie no loop back for more data entry. Code:
View Replies !
Importing Data
I have this file cvs that's roughly 2.5 meg. Right now, it uses a function like this to import the data into the table. PHP Code:
View Replies !
Importing Pages
I've written a content management system that I'm now selling to my customers. It's very nice when we have a blank canvas of a site, but a pain in the arse when there is already a site in place. What I'm in the process of *trying* to put together is a script that would do the following: A simple form where you put the address of the site with the static pages The script then spiders through the site, takes everything between <body> and </body> and chucks the rest away It would then take out all class definitions and all embedded styles like font tags etc but leaves tables, <p> <H?> etc This would leave a very plain page of HTML that would be inserted into a database. CSS would control the fonts etc. I'm aware that there would need to be some tidying up if there was any javascript or anything and also some basic formatting. What I want to know is 1. Has it been done and, if so, where might I find something like this 2. Might it have any commercial value to other developers? Regarding 2, I'm thinking how much time something like this might save me if I have to convert anything more than a few pages of static HTML into something that I can put in a database.
View Replies !
|