Re: HTML in MySQL?
Hey Douglass, Curious about using Smarty (taking the Crash Course and bookmarked a couple of other tut's)... One of the advantages of using a DB to store the HTML Sites was the opportunity to give the user an automated Zip file of their site if they wanted to download it and create their own site (domain) with it at any time... can this be done with Smarty? Like I said - I've used Smarty before - but only through a program called Jamroom - and it's basically using their Variables for their program - and it was limited. So, my main concern is - if the User wanted to download their site and have their own copy to upload to another domain - would it be possible to do this? Sorry, my mind is tired along with my eyes... I guess I'm still not 100% sure how Smarty works! Thanks, Clint On 9/12/05, clint lenard [EMAIL PROTECTED] wrote: Douglass, thanks for the tips! As far as Mambo or Xoops - I wanted to create something a little different - but I WAS thinking of using Smarty before-hand... I just wasn't sure how I could really use it? I'm familiar with Smarty as far as I've played around with it a little... but I guess I wasn't sure how I could use it in this situation... are you saying that I should have Smarty hold the design - and use MySQL to populate the Virtual Sites with the Content stored in the DB? It sounds like a great Idea and would probably be much more Resource friendly! This is why I asked for more info and gave more info - hoping NOT to get someone to code anything - but to give me Ideas on what would work the best. :) Thanks alot for the info Douglass! I'm going to search the web for more Tutorials on Smarty - hopefully I find something related to this! It'd probably make my life much easier if what I think you're saying is what you're actually saying lol On 9/12/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: clint lenard wrote: Hi guys, I'm fairly new to MySQL and I've searched for about a week looking for an answer to this... I'm trying to design a Database that would hold HTML sites in the DB itself and use PHP to call for the HTML file - which would be populated with Content from another table in MySQL. I was told I could put HTML into MySQL... so my main question would be: is this possible?, is this a BAD thing? but most of all... would this be resource intensive? Thanks for any answers! I hope I'm using this list correctly - I did search Google and I've been reading an MySQL Manual for over a week now trying to get it down 110%! Thanks, Clint If you would like, you may check out these related technologies that do what you are talking about already: www.mamboserver.com http://www.mamboserver.com www.xoops.com http://www.xoops.com Also, if you use templates, it makes it easy to just keep the relevant parts of the page, and then display them inside of a predefined template. That way, you can change the template whenever you want, and all your pages will change. If you store the part of the HTML that formats the text (color, style etc) in the DB, this isn't possible. smarty.php.net http://smarty.php.net wasn't sure if you could use any of these, but, here's the info. -- http://www.douglassdavis.com
Re: HTML in MySQL?
can anyone help me with this question? On 9/12/05, clint lenard [EMAIL PROTECTED] wrote: Hey Douglass, Curious about using Smarty (taking the Crash Course and bookmarked a couple of other tut's)... One of the advantages of using a DB to store the HTML Sites was the opportunity to give the user an automated Zip file of their site if they wanted to download it and create their own site (domain) with it at any time... can this be done with Smarty? Like I said - I've used Smarty before - but only through a program called Jamroom - and it's basically using their Variables for their program - and it was limited. So, my main concern is - if the User wanted to download their site and have their own copy to upload to another domain - would it be possible to do this? Sorry, my mind is tired along with my eyes... I guess I'm still not 100% sure how Smarty works! Thanks, Clint On 9/12/05, clint lenard [EMAIL PROTECTED] wrote: Douglass, thanks for the tips! As far as Mambo or Xoops - I wanted to create something a little different - but I WAS thinking of using Smarty before-hand... I just wasn't sure how I could really use it? I'm familiar with Smarty as far as I've played around with it a little... but I guess I wasn't sure how I could use it in this situation... are you saying that I should have Smarty hold the design - and use MySQL to populate the Virtual Sites with the Content stored in the DB? It sounds like a great Idea and would probably be much more Resource friendly! This is why I asked for more info and gave more info - hoping NOT to get someone to code anything - but to give me Ideas on what would work the best. :) Thanks alot for the info Douglass! I'm going to search the web for more Tutorials on Smarty - hopefully I find something related to this! It'd probably make my life much easier if what I think you're saying is what you're actually saying lol On 9/12/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: clint lenard wrote: Hi guys, I'm fairly new to MySQL and I've searched for about a week looking for an answer to this... I'm trying to design a Database that would hold HTML sites in the DB itself and use PHP to call for the HTML file - which would be populated with Content from another table in MySQL. I was told I could put HTML into MySQL... so my main question would be: is this possible?, is this a BAD thing? but most of all... would this be resource intensive? Thanks for any answers! I hope I'm using this list correctly - I did search Google and I've been reading an MySQL Manual for over a week now trying to get it down 110%! Thanks, Clint If you would like, you may check out these related technologies that do what you are talking about already: www.mamboserver.com http://www.mamboserver.com www.xoops.com http://www.xoops.com Also, if you use templates, it makes it easy to just keep the relevant parts of the page, and then display them inside of a predefined template. That way, you can change the template whenever you want, and all your pages will change. If you store the part of the HTML that formats the text (color, style etc) in the DB, this isn't possible. smarty.php.net http://smarty.php.net wasn't sure if you could use any of these, but, here's the info. -- http://www.douglassdavis.com
Re: HTML in MySQL?
clint lenard wrote: can anyone help me with this question? (about using Smarty) No doubt -- but that anyone would likely be on a Smarty-specific (or at least PHP-oriented) mailing list, eh? :-) -- Hassan Schroeder - [EMAIL PROTECTED] Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com dream. code. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
Hello! But once you have done that, you can never recover the origional text. Try it on this email if you doubt it. Why? Why not to use regular expressions? Use addslashes($htmlCode) and execute query normally. $slashedHtmlCode = addslashes($htmlCode); The problem is not in the executing of a query. After the execution of the script: ?php $string = \n\n\n\n 1; echo addslashes($string); ? we will get: 1 and no empty lines. If you want to output the same data, that was written using a textarea field of a form, you should use the br tag. -- Good Luck! Vladimir Please, avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
Vladimir B. Tsarkov wrote: After the execution of the script: ?php $string = \n\n\n\n 1; echo addslashes($string); ? we will get: 1 and no empty lines. If you want to output the same data, that was written using a textarea field of a form, you should use the br tag. In one word: kiss. Converting the data before inserting it in the database, and converting it back after reading from the database, is more work and more error-prone, compared to not doing this conversion. You can easily do the conversion when you output the data, _if_ the output format is html, _and_ you actually want hard linefeeds in your html output. Many web pages have a variable width... there is a reason for why whitespace usually is not significant in html. The problem you describe above is not related to mysql, and you could probably solve it another way. You should take a look at the html pre element. -- Roger -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: HTML in MySQL?
$input = This is br the \n input;# value from user $saved = This is br the br input; # value in database $recovered = This is \n the \n input; # retrieved from db, != $input -Original Message- From: Vladimir B. Tsarkov [mailto:[EMAIL PROTECTED] Sent: Sun 9/11/2005 2:15 PM To: mysql@lists.mysql.com Cc: mysql@lists.mysql.com Subject: Re: HTML in MySQL? Hello! But once you have done that, you can never recover the origional text. Try it on this email if you doubt it. Why? Why not to use regular expressions? Use addslashes($htmlCode) and execute query normally. $slashedHtmlCode = addslashes($htmlCode); The problem is not in the executing of a query. After the execution of the script: ?php $string = \n\n\n\n 1; echo addslashes($string); ? we will get: 1 and no empty lines. If you want to output the same data, that was written using a textarea field of a form, you should use the br tag. -- Good Luck! Vladimir Please, avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
John Trammell wrote: $input = This is br the \n input;# value from user $saved = This is br the br input; # value in database $recovered = This is \n the \n input; # retrieved from db, != $input Please don't top-post. That is the perfect argument for not applying nl2br() before saving the information in the database. It should be done *when outputting* instead. ?php $in = mysql_real_escape_string(This is br the \n input); mysql_query(INSERT INTO my_table (my_field) VALUES ('$in')); $array =mysql_fetch_assoc(mysql_query(SELECT my_field FROM my_table)); print(nl2br($array['my_field'])); ? works exactly as intended. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
Jasper Bryant-Greene wrote: John Trammell wrote: $input = This is br the \n input;# value from user $saved = This is br the br input; # value in database $recovered = This is \n the \n input; # retrieved from db, != $input Please don't top-post. That is the perfect argument for not applying nl2br() before saving the information in the database. It should be done *when outputting* instead. ?php $in = mysql_real_escape_string(This is br the \n input); mysql_query(INSERT INTO my_table (my_field) VALUES ('$in')); $array =mysql_fetch_assoc(mysql_query(SELECT my_field FROM my_table)); print(nl2br($array['my_field'])); ? works exactly as intended. Oh, and I should mention you probably want to htmlspecialchars() that data too, if you actually want to see the br and if you want to protect from XSS attacks etc. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
Wow, thanks for all of the Information guys! I've learned alot and now I've actually been doing more brain storming... I've been reading all of these emails over and over - and they're helping me understand more! What I'm trying to do is save User Sites in MySQL and use PHP to pull them out through the Database using a Virtual Directory (if that's what it could be called?) like: http://mysite,com/bob-in-germany or just http://mysite,com/bobingermany/ There may be a ton of these sites as time moves on and I'm just trying to make sure I learn as much as I can before I get a major problem on my hands... I know it may be resource intensive - but it just seems to be easier to delete unused sites through a DB rather than a File System I may not have full control over? Anyways, Thanks again guys! This is helping alot! anymore feedback would be great! - Clint P.S. - Sorry Jasper for sending it to you and not the list... I'm new to GMail :( On 9/11/05, Jasper Bryant-Greene [EMAIL PROTECTED] wrote: Jasper Bryant-Greene wrote: John Trammell wrote: $input = This is br the \n input; # value from user $saved = This is br the br input; # value in database $recovered = This is \n the \n input; # retrieved from db, != $input Please don't top-post. That is the perfect argument for not applying nl2br() before saving the information in the database. It should be done *when outputting* instead. ?php $in = mysql_real_escape_string(This is br the \n input); mysql_query(INSERT INTO my_table (my_field) VALUES ('$in')); $array =mysql_fetch_assoc(mysql_query(SELECT my_field FROM my_table)); print(nl2br($array['my_field'])); ? works exactly as intended. Oh, and I should mention you probably want to htmlspecialchars() that data too, if you actually want to see the br and if you want to protect from XSS attacks etc. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
clint lenard wrote: Hi guys, I'm fairly new to MySQL and I've searched for about a week looking for an answer to this... I'm trying to design a Database that would hold HTML sites in the DB itself and use PHP to call for the HTML file - which would be populated with Content from another table in MySQL. I was told I could put HTML into MySQL... so my main question would be: is this possible?, is this a BAD thing? but most of all... would this be resource intensive? Thanks for any answers! I hope I'm using this list correctly - I did search Google and I've been reading an MySQL Manual for over a week now trying to get it down 110%! Thanks, Clint If you would like, you may check out these related technologies that do what you are talking about already: www.mamboserver.com www.xoops.com Also, if you use templates, it makes it easy to just keep the relevant parts of the page, and then display them inside of a predefined template. That way, you can change the template whenever you want, and all your pages will change. If you store the part of the HTML that formats the text (color, style etc) in the DB, this isn't possible. smarty.php.net wasn't sure if you could use any of these, but, here's the info. -- http://www.douglassdavis.com
Re: HTML in MySQL?
Douglass, thanks for the tips! As far as Mambo or Xoops - I wanted to create something a little different - but I WAS thinking of using Smarty before-hand... I just wasn't sure how I could really use it? I'm familiar with Smarty as far as I've played around with it a little... but I guess I wasn't sure how I could use it in this situation... are you saying that I should have Smarty hold the design - and use MySQL to populate the Virtual Sites with the Content stored in the DB? It sounds like a great Idea and would probably be much more Resource friendly! This is why I asked for more info and gave more info - hoping NOT to get someone to code anything - but to give me Ideas on what would work the best. :) Thanks alot for the info Douglass! I'm going to search the web for more Tutorials on Smarty - hopefully I find something related to this! It'd probably make my life much easier if what I think you're saying is what you're actually saying lol On 9/12/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: clint lenard wrote: Hi guys, I'm fairly new to MySQL and I've searched for about a week looking for an answer to this... I'm trying to design a Database that would hold HTML sites in the DB itself and use PHP to call for the HTML file - which would be populated with Content from another table in MySQL. I was told I could put HTML into MySQL... so my main question would be: is this possible?, is this a BAD thing? but most of all... would this be resource intensive? Thanks for any answers! I hope I'm using this list correctly - I did search Google and I've been reading an MySQL Manual for over a week now trying to get it down 110%! Thanks, Clint If you would like, you may check out these related technologies that do what you are talking about already: www.mamboserver.com http://www.mamboserver.com www.xoops.com http://www.xoops.com Also, if you use templates, it makes it easy to just keep the relevant parts of the page, and then display them inside of a predefined template. That way, you can change the template whenever you want, and all your pages will change. If you store the part of the HTML that formats the text (color, style etc) in the DB, this isn't possible. smarty.php.net http://smarty.php.net wasn't sure if you could use any of these, but, here's the info. -- http://www.douglassdavis.com
Re: HTML in MySQL?
clint lenard wrote: Hi guys, I'm fairly new to MySQL and I've searched for about a week looking for an answer to this... I'm trying to design a Database that would hold HTML sites in the DB itself and use PHP to call for the HTML file - which would be populated with Content from another table in MySQL. I was told I could put HTML into MySQL... so my main question would be: is this possible?, is this a BAD thing? but most of all... would this be resource intensive? Of course -- HTML is just a string like any other. Just use a TEXT field of the appropriate size for the size of your HTML pages, and then store the HTML as a string in that field. Then retrieve it and output the string with PHP. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ If you find my advice useful, please consider donating to a poor student! You can choose whatever amount you think my advice was worth to you. http://tinyurl.com/7oa5s -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
Thanks Jasper for the info! This may sound stupid - but I just want to be sure... do I need to strip the slashes and special characters out and add them when they're called... or..? I'm just trying to get a clear picture of exactly what needs to be done with this particular job... thanks! On 9/9/05, Jasper Bryant-Greene [EMAIL PROTECTED] wrote: clint lenard wrote: Hi guys, I'm fairly new to MySQL and I've searched for about a week looking for an answer to this... I'm trying to design a Database that would hold HTML sites in the DB itself and use PHP to call for the HTML file - which would be populated with Content from another table in MySQL. I was told I could put HTML into MySQL... so my main question would be: is this possible?, is this a BAD thing? but most of all... would this be resource intensive? Of course -- HTML is just a string like any other. Just use a TEXT field of the appropriate size for the size of your HTML pages, and then store the HTML as a string in that field. Then retrieve it and output the string with PHP. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ If you find my advice useful, please consider donating to a poor student! You can choose whatever amount you think my advice was worth to you. http://tinyurl.com/7oa5s -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
RE: HTML in MySQL?
Hi Clint, Another possibility is to actually run the mysql client with a --html option and let mysql do the work for you eg : prompt $ echo SELECT some_stuff FROM table | mysql -u xyz -pxxx --html This generates a block of html for a table with the data encapsulated within, then it is just a matter of capturing the output and putting it in the html stream. You can also generate xml the same way. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: clint lenard [mailto:[EMAIL PROTECTED] Sent: Friday, 9 September 2005 3:31 PM To: mysql@lists.mysql.com Subject: HTML in MySQL? Hi guys, I'm fairly new to MySQL and I've searched for about a week looking for an answer to this... I'm trying to design a Database that would hold HTML sites in the DB itself and use PHP to call for the HTML file - which would be populated with Content from another table in MySQL. I was told I could put HTML into MySQL... so my main question would be: is this possible?, is this a BAD thing? but most of all... would this be resource intensive? Thanks for any answers! I hope I'm using this list correctly - I did search Google and I've been reading an MySQL Manual for over a week now trying to get it down 110%! Thanks, Clint -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
David and Jasper - thank you both! I will play around with this more now that you have explained my biggest questions! Thanks guys, Clint :-) On 9/9/05, Jasper Bryant-Greene [EMAIL PROTECTED] wrote: clint lenard wrote: Thanks Jasper for the info! This may sound stupid - but I just want to be sure... do I need to strip the slashes and special characters out and add them when they're called... or..? I'm just trying to get a clear picture of exactly what needs to be done with this particular job... If you're using PHP, you need to run mysql_real_escape_string() on any string data that is going into MySQL. This will handle escaping and special characters for you, and there is no need to unescape it when retrieving it from the DB. See http://www.php.net/mysql_real_escape_string HTH -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ If you find my advice useful, please consider donating to a poor student! You can choose whatever amount you think my advice was worth to you. http://tinyurl.com/7oa5s -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
clint lenard wrote: Thanks Jasper for the info! This may sound stupid - but I just want to be sure... do I need to strip the slashes and special characters out and add them when they're called... or..? I'm just trying to get a clear picture of exactly what needs to be done with this particular job... If you're using PHP, you need to run mysql_real_escape_string() on any string data that is going into MySQL. This will handle escaping and special characters for you, and there is no need to unescape it when retrieving it from the DB. See http://www.php.net/mysql_real_escape_string HTH -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ If you find my advice useful, please consider donating to a poor student! You can choose whatever amount you think my advice was worth to you. http://tinyurl.com/7oa5s -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
Hello, Clint! I'm trying to design a Database that would hold HTML sites in the DB itself and use PHP to call for the HTML file - which would be populated with Content from another table in MySQL. I was told I could put HTML into MySQL... so my main question would be: is this possible?, is this a BAD thing? but most of all... would this be resource intensive? If you use textarea field of a form, it produces null characters (\n) in the end of every string. I recommed to replace them with br tags before writing into the database. It'll help to avoid output problems. Use preg_replace(); for it. -- Good Luck! Vladimir Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: HTML in MySQL?
If you use textarea field of a form, it produces null characters (\n) in the end of every string. I recommed to replace them with br tags before writing into the database. It'll help to avoid output problems. Use preg_replace(); for it. Be careful here Vladimir, the (\n) are not 'null' characters; but newline characters. And i would highly recommend *not* replacing them with br tags as you write them into the database. This is asking for trouble on so many levels. The database will cope with carriage returns and newlines just like any other character, so will have no problems. HTML is just string; treat it as such and don't give it anymore credit than that and you'll be fine. -- Alan Williamson, Technology Evangelist SpikeSource Inc. Daily OS News @ http://compiledby.spikesource.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: HTML in MySQL?
Amen. Translating user input into HTML is great until you need to read the data *out*, and someone decides the output should be formatted as RTF or PDF or text. Best to store it as you got it, IMO. -Original Message- From: Alan Williamson [mailto:[EMAIL PROTECTED] Sent: Friday, September 09, 2005 10:11 AM To: mysql@lists.mysql.com Subject: RE: HTML in MySQL? If you use textarea field of a form, it produces null characters (\n) in the end of every string. I recommed to replace them with br tags before writing into the database. It'll help to avoid output problems. Use preg_replace(); for it. Be careful here Vladimir, the (\n) are not 'null' characters; but newline characters. And i would highly recommend *not* replacing them with br tags as you write them into the database. This is asking for trouble on so many levels. The database will cope with carriage returns and newlines just like any other character, so will have no problems. HTML is just string; treat it as such and don't give it anymore credit than that and you'll be fine. -- Alan Williamson, Technology Evangelist SpikeSource Inc. Daily OS News @ http://compiledby.spikesource.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
Hello! Be careful here Vladimir, the (\n) are not 'null' characters; but newline characters. Agree, I was wrong. And i would highly recommend *not* replacing them with br tags as you write them into the database. This is asking for trouble on so many levels. The database will cope with carriage returns and newlines just like any other character, so will have no problems. HTML is just string; treat it as such and don't give it anymore credit than that and you'll be fine. If you need to output a HTML string (not in a textarea field), you'll need to replace \n with br. That is why, I think that it is better to replace it before saving (You will not need to replace \n during the output process. It will save you some lines of code, and add productivity.). Of course, you need to be sure that your program will make HTML output more often, than any other type of output. -- Удачи! Владимир Please, avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
Vladimir B. Tsarkov wrote: Hello! Be careful here Vladimir, the (\n) are not 'null' characters; but newline characters. Agree, I was wrong. And i would highly recommend *not* replacing them with br tags as you write them into the database. This is asking for trouble on so many levels. The database will cope with carriage returns and newlines just like any other character, so will have no problems. HTML is just string; treat it as such and don't give it anymore credit than that and you'll be fine. If you need to output a HTML string (not in a textarea field), you'll need to replace \n with br. That is why, I think that it is better to replace it before saving (You will not need to replace \n during the output process. It will save you some lines of code, and add productivity.). Of course, you need to be sure that your program will make HTML output more often, than any other type of output. But once you have done that, you can never recover the origional text. Try it on this email if you doubt it. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL?
Use addslashes($htmlCode) and execute query normally. ?php $slashedHtmlCode = addslashes($htmlCode); ? []´s Tomita On 9/9/05, Vladimir B. Tsarkov [EMAIL PROTECTED] wrote: Hello! Be careful here Vladimir, the (\n) are not 'null' characters; but newline characters. Agree, I was wrong. And i would highly recommend *not* replacing them with br tags as you write them into the database. This is asking for trouble on so many levels. The database will cope with carriage returns and newlines just like any other character, so will have no problems. HTML is just string; treat it as such and don't give it anymore credit than that and you'll be fine. If you need to output a HTML string (not in a textarea field), you'll need to replace \n with br. That is why, I think that it is better to replace it before saving (You will not need to replace \n during the output process. It will save you some lines of code, and add productivity.). Of course, you need to be sure that your program will make HTML output more often, than any other type of output. -- Удачи! Владимир Please, avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL Tables
David Blomstrom wrote: Some time ago, I posted a question about using HTML in MySQL tables. Someone suggested this is a bad strategy, asking what I would do if I later decided to change the italicized words to bold, for example. I'm just trying to figure out what the options are, as well as determining the best option. One way or another, I would like to tag certain key words and phrases. This is getting a *bit* away from DB and into IA, but... If Cowboy State has a semantic meaning, like nickname, you might want to think about either having a field for it or, if it's part of a text segment that doesn't lend itself to that, use a semantic tag for it, like `nicknameCowboy State/nickname, (reinforced ...` and then, for display purposes, transform that XML using XSLT into your appropriate output. I'm assuming that once you do that, you can probably manipulate the tags with PHP in many different ways. Uh, many, yeah; put the coffee on. :-) -- Hassan Schroeder - [EMAIL PROTECTED] Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com dream. code. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL Tables
--- Hassan Schroeder [EMAIL PROTECTED] wrote: If Cowboy State has a semantic meaning, like nickname, you might want to think about either having a field for it or, if it's part of a text segment that doesn't lend itself to that, use a semantic tag for it, like `nicknameCowboy State/nickname, (reinforced ... and then, for display purposes, transform that XML using XSLT into your appropriate output. You mean I can make up a name for a semantic tag, designating every nicknname nickname or every emphasized word emphasize, for example? And is this something that can only be done with XML? I do recall reading that XML is a very flexible language that lets you create your own codes, styles, etc. Am I correct in guessing that the pros prefer XML to HTML or XHTML when working with MySQL? If so, that's another thing for me to learn. I've found XHTML pretty simple, but XML looks a little more complex. Thanks. __ Do you Yahoo!? Yahoo! Domains Claim yours for only $14.70/year http://smallbusiness.promotions.yahoo.com/offer -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL Tables
--- Hassan Schroeder [EMAIL PROTECTED] wrote: If Cowboy State has a semantic meaning, like nickname, you might want to think about either having a field for it or, if it's part of a text segment that doesn't lend itself to that, use a semantic tag for it, like `nicknameCowboy State/nickname, (reinforced ... and then, for display purposes, transform that XML using XSLT into your appropriate output. You mean I can make up a name for a semantic tag, designating every nicknname nickname or every emphasized word emphasize, for example? And is this something that can only be done with XML? I do recall reading that XML is a very flexible language that lets you create your own codes, styles, etc. Am I correct in guessing that the pros prefer XML to HTML or XHTML when working with MySQL? If so, that's another thing for me to learn. I've found XHTML pretty simple, but XML looks a little more complex. Thanks. __ Do you Yahoo!? Yahoo! Domains Claim yours for only $14.70/year http://smallbusiness.promotions.yahoo.com/offer -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL Tables
David Blomstrom wrote: You mean I can make up a name for a semantic tag, designating every nicknname nickname or every emphasized word emphasize, for example? Yep, XML lets you create your own DTD/schema -- though sometimes it makes sense to use (or leverage) an existing one. And is this something that can only be done with XML? No, but 1) it works well for this kind of application, and 2) there are lots of tools available... -- Hassan Schroeder - [EMAIL PROTECTED] Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com dream. code. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: HTML in MySQL Tables
On May 21, 2004, at 9:14 PM, David Blomstrom wrote: --- Hassan Schroeder [EMAIL PROTECTED] wrote: If Cowboy State has a semantic meaning, like nickname, you might want to think about either having a field for it or, if it's part of a text segment that doesn't lend itself to that, use a semantic tag for it, like `nicknameCowboy State/nickname, (reinforced ... and then, for display purposes, transform that XML using XSLT into your appropriate output. You mean I can make up a name for a semantic tag, designating every nicknname nickname or every emphasized word emphasize, for example? And is this something that can only be done with XML? I do recall reading that XML is a very flexible language that lets you create your own codes, styles, etc. Am I correct in guessing that the pros prefer XML to HTML or XHTML when working with MySQL? If so, that's another thing for me to learn. I've found XHTML pretty simple, but XML looks a little more complex. What you want to look into is CSS. If you're already working XHTML, then that's great. It's a cleaner, more straightforward, back the intent of HTML before the browser wars polluted it. Use CSS to define how things appear. Honestly, it takes a while to get. Not the syntax and such (generally easy), but more the methods in how to best apply it. Most CSS refc I have found deal with the mechanics of it. It's hard to find a good refc on how to apply. I recommend the book Eric Meyer on CSS -- it's about practical application. You'll need a companion guide for syntax reference. So, you'd (potentially) end up with: span class=nicknameCowboy State/span It's very easy to initially want to do span class=boldred10ptCowboy State/span and that's pretty typically for everyone's first CSS era, but try to get past that level quickly. I finally hit what I call my third era in CSS this past year, and man, does it make web design so much better. Anyway, quite off topic, so, if you have some questions, hit me up offline. -- greg willits -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Html and mysql..
Brad wrote Josh Trutwin writes: Javascript is a client-side language, the code is executed by the user's browser. It has no way to connect to the database server and run queries so you need to use a server-side programming language like Java (JDBC), PhP, Perl, etc. Tomcat is a decent servlet engine with a nice price tag (free) and PhP/Perl are pretty easy to get working with an Apache server. If you've never done this before, I'd advise to use PhP as it has the smallest learning curve in my opnion. It might be possible to build a backend php or cgi script that could act as the backend access for JavaScript. But it would definitely be a kludge and fraught with security issues. Mainly because you'd be sending the requests, authorization, and responses across the net. Rather than just across the connection between the web server and the database server. I have a PHP script that I've been hacking around with that I can send a random SQL statement and get the results displayed in a basic web page column headings and all :) It isn't real pretty, but does allow me to test out SQL and my skills with PHP. Would I allow such access via HTTP, not by a long shot. It's just too fraught with security issues. Brad Eacker ([EMAIL PROTECTED]) /Brad Hello list, For those of you not familiar with developing web-based applications with M$'s IIS, JavaScript **IS** available server-side. It's one of the two languages you can use to write ASP pages. The only connection I have found from M$ scripts (VBScript or JavaScript) to MySQL has been through the ODBC driver but that doesn't mean there aren't others. The most recent driver I have found has been version 3.53 so if you have a MySQL server more recent than 4.1.x you will have to do some kludging to get it to authenticate. See http://dev.mysql.com/doc/mysql/en/Password_hashing.html for more details. Shawn -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Html and mysql..
Javascript is a client side language. I seriously doubt it alone would do anything for you. My Sql [EMAIL PROTECTED] 05/05/2004 12:18 PM To: [EMAIL PROTECTED] cc: Subject:Html and mysql.. Hi all, I have got one serious doubt. Can we access mysql database from the front end html. If it all it is possible, we have to right in javascript. ofcourse we can write it using JDBC(provided we have a servlet engine integrated with a webserver). My question is can we access mysql database from the front end html using javacript. I would be really glad, if some one can help me in this regard. Thanks, Bharath - Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Html and mysql..
On Wed, 5 May 2004 09:18:01 -0700 (PDT) My Sql [EMAIL PROTECTED] wrote: Hi all, I have got one serious doubt. Can we access mysql database from the front end html. If it all it is possible, we have to right in javascript. ofcourse we can write it using JDBC(provided we have a servlet engine integrated with a webserver). My question is can we access mysql database from the front end html using javacript. I would be really glad, if some one can help me in this regard. Javascript is a client-side language, the code is executed by the user's browser. It has no way to connect to the database server and run queries so you need to use a server-side programming language like Java (JDBC), PhP, Perl, etc. Tomcat is a decent servlet engine with a nice price tag (free) and PhP/Perl are pretty easy to get working with an Apache server. If you've never done this before, I'd advise to use PhP as it has the smallest learning curve in my opnion. Josh -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Html and mysql..
Depending on who your intended audience is and what you are attempting to achieve two possibilities are using LiveWire, http://developer.netscape.com/viewsource/kuslich_javascript.html, or you could use Applets that talk to servlets, http://www.onjava.com/pub/a/onjava/2002/02/20/applets.html. -Original Message- From: My Sql To: [EMAIL PROTECTED] Sent: 5/5/04 11:18 AM Subject: Html and mysql.. Hi all, I have got one serious doubt. Can we access mysql database from the front end html. If it all it is possible, we have to right in javascript. ofcourse we can write it using JDBC(provided we have a servlet engine integrated with a webserver). My question is can we access mysql database from the front end html using javacript. I would be really glad, if some one can help me in this regard. Thanks, Bharath - Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Html and mysql..
Josh Trutwin writes: Javascript is a client-side language, the code is executed by the user's browser. It has no way to connect to the database server and run queries so you need to use a server-side programming language like Java (JDBC), PhP, Perl, etc. Tomcat is a decent servlet engine with a nice price tag (free) and PhP/Perl are pretty easy to get working with an Apache server. If you've never done this before, I'd advise to use PhP as it has the smallest learning curve in my opnion. It might be possible to build a backend php or cgi script that could act as the backend access for JavaScript. But it would definitely be a kludge and fraught with security issues. Mainly because you'd be sending the requests, authorization, and responses across the net. Rather than just across the connection between the web server and the database server. I have a PHP script that I've been hacking around with that I can send a random SQL statement and get the results displayed in a basic web page column headings and all :) It isn't real pretty, but does allow me to test out SQL and my skills with PHP. Would I allow such access via HTTP, not by a long shot. It's just too fraught with security issues. Brad Eacker ([EMAIL PROTECTED]) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]