Jump to content


Photo

Couple of Questions


  • Please log in to reply
4 replies to this topic

#1 lpxxfaintxx

lpxxfaintxx
  • Members
  • PipPipPip
  • Advanced Member
  • 181 posts

Posted 24 February 2006 - 09:16 PM


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



#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 25 February 2006 - 12:53 PM

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.

#3 lpxxfaintxx

lpxxfaintxx
  • Members
  • PipPipPip
  • Advanced Member
  • 181 posts

Posted 25 February 2006 - 01:30 PM

So MySQL can take all syntax?

#4 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 25 February 2006 - 02:12 PM

[!--quoteo(post=349292:date=Feb 25 2006, 08:30 AM:name=lpxxfaintxx)--][div class=\'quotetop\']QUOTE(lpxxfaintxx @ Feb 25 2006, 08:30 AM) View Post[/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.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#5 lpxxfaintxx

lpxxfaintxx
  • Members
  • PipPipPip
  • Advanced Member
  • 181 posts

Posted 27 February 2006 - 08:54 PM

Can you give me more insight on that? Thanks, I'm trying to store PHP codes into MySQL.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users