Jump to content

Archived

This topic is now archived and is closed to further replies.

lpxxfaintxx

Couple of Questions

Recommended Posts


I was wondering, for MySQL there are many data types.

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]CHAR( ) A fixed section from 0 to 255 characters long.
VARCHAR( ) A variable section from 0 to 255 characters long.
TINYTEXT A string with a maximum length of 255 characters.
TEXT A string with a maximum length of 65535 characters.
BLOB A string with a maximum length of 65535 characters.
MEDIUMTEXT A string with a maximum length of 16777215 characters.
MEDIUMBLOB A string with a maximum length of 16777215 characters.
LONGTEXT A string with a maximum length of 4294967295 characters.
LONGBLOB A string with a maximum length of 4294967295 characters.[/quote]

Which is best suited for storing PHP coding and/or any type of programming language?

Ex: A site that provides AIM profiles to users. When the user saves their settings, the code gets processed, stored into MySQL, and makes a folder named after the user, and creates the actual file (user329/index.php, etc). Will it even store special characters, (such as $, <, >, *, &, ^, etc) or will I have to do something fancy?

2) In my previous PHP project, I used the code

<?
$filename = $_GET["fname"];
$yourvar= $_GET["content"];

$yourvar = stripslashes($yourvar);

$data = fopen($filename, "w");

fwrite($data,$yourvar);

fclose($data);

echo "File created!";
?>

and it worked great. How would I create a FOLDER and then the file?

-Thanks <3

Share this post


Link to post
Share on other sites
mediumtext or longtext should statisfy your needs.

with your secound quesion you can use a function called [a href=\"http://uk2.php.net/manual/en/function.mkdir.php\" target=\"_blank\"]mkdir[/a] which will attempt to create a folder for you.

Share this post


Link to post
Share on other sites
[!--quoteo(post=349292:date=Feb 25 2006, 08:30 AM:name=lpxxfaintxx)--][div class=\'quotetop\']QUOTE(lpxxfaintxx @ Feb 25 2006, 08:30 AM) [snapback]349292[/snapback][/div][div class=\'quotemain\'][!--quotec--]
So MySQL can take all syntax?
[/quote]

as long as you escape your string properly (using mysql_real_escape_string() or something similar), it can handle anything you put in there.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.