Jump to content

neohunter

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by neohunter

  1. Hi, i have this function: function DescFileToSql(){ $miconexion = new DB_mysql; $miconexion->conectar("unionro_intranet", "localhost", "root", "mypassword"); foreach($this->loadFile('idnum2itemdesctable.txt') as $key => $value){ $value = str_replace("'","\'",$value); $querry="UPDATE `item_db` SET `desc` = '".$value."' WHERE item_db.id = $key;"; $miconexion->consulta($querry); $miconexion->verconsulta(); if($miconexion->Error){ echo "<b>$key:</b>:<br>"; echo $querry; echo "<font color=#ff0000>".$miconexion->Error."</font>"; echo "<br>"; } } } and give me this error: UPDATE `item_db` SET `desc` = 'A tame for the monster: Argos -=- Happy Catching Item Class : ^777777Pet Tame^000000 Weight : ^77777720^000000 ' WHERE item_db.id = 9606; 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 '' at line 1 but i execute the querry that gives me on phpmyadmin and works. what happend?
  2. OPS SORRY WAS A MISTAKEN ERROR... PLEASE DELETE THIS TOPIC
  3. Why this dont work: [code] <? class updates { function test(){ $data = "wow"; if(($fp=fopen('test.hex',"wb"))){ fwrite($fp,$data); fclose ($fp); } } } $test = new updates(); $test->test(); ?> [/code] and this, without the class work: [CODE] <? $data = "wow"; if(($fp=fopen('test.hex',"wb"))){ fwrite($fp,$data); fclose ($fp); } ?> [/CODE]
  4. OK I SOLVED IT! JUST CONCATENATING ( .= ) #the header-- $data= pack('a20V','TRIADPATCHERPATCHBIN',2); #name V #and the foreach goes here... $data.=pack('Va*Va*Va*', strlen($file_from), $file_from, strlen($file_to), $file_to, strlen($content), $content); #SUCCES!!
  5. i try it... pack($hex_format,$hex); but doesnt work...
  6. if you enter text on PS... php code... when you save the iamge... is just an image... i really dont understand
  7. try to explain better... the pack funcion is pack(format, parm1, parm2, parm3... etcetc); so, when the array containt one file i need to give to the pack funcion 8 parameters. but when the array  containt 2 files i will need to give 14 parameters to the pack function! i just dont know how to do that...
  8. hi, im just learning php since one month ago. this is my first post on this forum! so i wanna say hi to everybody ^^.. now i hope you can help me... i need to generate a custom binary file... let me explain you fast... this is the format of the file [code] TRIADPATCHERPATCHBIN -> main  -> this is the header [00][00][00][00]    -> filecount -> this bytes is a count of the files inside the file ------------------------------- NOW FOR EVERY FILE ------------------- [0C][00][00][00]    -> filenamecount  -> the numbers of bytes in the filename originalfilename    -> file_from            -> the name [0C][00][00][00]    -> file_tonamecount  -> the numbers of bytes in the file_to destinefilename      -> file_toname  -> the name of the file_to =P [07][00][00][00]    -> contentcount  -> the lenght in bytes Content              -> content -> the content of this file and the last block repeat for every file inside the file... [/code] well, so i start making a function; make_tpp($files) files is an array: $files = array('file_from.grf' => 'file_to.grf'); now i need to use the funcion pack for generate the file... i tried witout the array.. i did something like this... [code] $file_from='file_from.grf'; $file_to='file_to.grf'; $content='content test'; $data= pack('a20VVa*Va*Va*', 'TRIADPATCHERPATCHBIN', 1, strlen($file_from), $file_from, strlen($file_to), $file_to, $strlen($content), $content); #next i save it to a file... if(($fp=fopen('test.hex',"wb"))){ fwrite($fp,$data); fclose ($fp); } [/code] And thats works perfectly! but i need to pass more that one file, so i need a way to pass multi parameters to the pack function... [code] foreach ($files as $file_from => $file_to){ #[0C][00][00][00]    -> filenamecount            ->  V $hex_format .= 'V'; $hex[] = strlen($file_origen); #originalfilename    -> file_origen              ->  a* $hex_format .= 'a*'; $hex[] = $file_origen; #[0C][00][00][00]    -> destfilenamecount        ->  V $hex_format .= 'V'; $hex[] = strlen($file_dest); #destinefilename      -> destinefilename          ->  a* $hex_format .= 'a*'; $hex[] = $file_dest; #[07][00][00][00]    -> contentcount            ->  V $_content = file_get_contents($file_origen); $hex_format .= 'V'; $hex[] = strlen($_content); #content $hex_format .= 'a*'; $hex[] = $_content; } pack($hex_format,???????????); [/code] do you understand me????!?!?!?!?!??!
×
×
  • Create New...

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.