Jump to content

Gurzi

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Everything posted by Gurzi

  1. session_start() will register internal output handler for URL rewriting when trans-sid is enabled. If a user uses ob_gzhandler or like with ob_start(), the order of output handler is important for proper output. For example, user must register ob_gzhandler before session start. Ok, i'm not sure if it said headers or just output already sent, but in the session_start function description, it says that i throws output
  2. does the session_start deliver some output ?
  3. i don't have the error anymore, and i can't put online the old way, but it is just how i said, headers already sent
  4. I was trying to develop an captcha system so i had this <?php session_start(); if($_POST['captcha'] != $_SESSION['captcha']){ header("Location: index.php"); }else{ // do something } ?> When the user entered the captcha wrong, it says that output already had been sent. So i tried this way: <?php session_start(); $test = $_SESSION['captcha']; session_destroy(); if($test != $_POST['captcha']){ header("Location: index.php"); }else{ // do something } ?> and it worked :S but i dont know the reason :x
  5. Hello, i have a weird doubt and i dont know the answer. I was using the session_start in the first line of my code, and 5 lines after i had to use the header() function and of course it said that ouput already had been sent. I understood and i tried something, like this session_start() session_destroy() header() and it worked, and i dont know why , doesn't it sent ouput to the browser ?? Weird :s
  6. Hello guys, at this moment i have 2 distinct classes, User and Product. Now i need a bunch of methods to list products( for example, products recently added, all the products, etc) . Where shall i define this methods ? Inside the class User ? Product ? within a new Class? Can you give me some advices ? Thanks
  7. FOUND! Sorry but i'm working on a team and i am using ajax, and the another guy forgot to retire the name of the file from the <form action=""> so it was calling the file twice I didn't see it Sorry And thanks a lot
  8. I said the same, it's impossible, but it's happening !! I changed $database->execute to mysql_query() and it's the same, it inserts the query twice and i tried using echo constant string has you said and it just returned one time. The stupid thing now it's that i have this foreach($_POST['produtos'] AS $key=>$value){ $adicionaProdutoQuery = "INSERT INTO Proposta_Produto_Temporario(IDPropostaTemporaria,IDProduto) VALUES($idProposta,$value)"; //echo $adicionaProdutoQuery . "<br />"; //$database->execute($adicionaProdutoQuery); mysql_query($adicionaProdutoQuery); echo "a"; } and it's executing the query 2 times but i just see a single "a" character.
  9. I did var_dump at the $_POST and it has returned : array(2) { ["idProduto"]=> string(1) "2" ["produtos"]=> array(1) { [0]=> string(1) "1" } } after i did this foreach($_POST['produtos'] AS $key=>$value){ $adicionaProdutoQuery = "INSERT INTO Proposta_Produto_Temporario(IDPropostaTemporaria,IDProduto) VALUES($idProposta,$value)"; //echo $adicionaProdutoQuery . "<br />"; $database->execute($adicionaProdutoQuery); } The funniest thing here, is that if i use the echo, it just prints one time, but if i use the $database->execute() , it inserts the query twice. I really don't understand :x Any ideas ?
  10. It said that i cannot have values defined in interface arguments list.
  11. <?php include("class.factorydatabase.php"); Class ligadb{ private static $lconnection = false; private static $type = "MYSQLPROD"; private function __construct(){} public static function getInstance(){ if( self::$connection === false){ self::$connection = FactoryDatabase::getDatabaseConnection(self::$type); } return self::$connection; } } ?> This is my Singleton class that works with Factory pattern ( FactoryDatabase file ) and now i'm developing one class for set/get categories(products) and i need to make some inserts/selects in the database. Wich is the most professional method to work with the database in the class ? Shall i include the ligadb.php in every file and create an instance of that class? Something like this <?php include_once("class.ligadb.php"); Class Category { private $connection; public function __construct(){ $connection = ligadb::getInstance(); } public function setCategory(){ $this->connection->execute(" INSERT BLABLABLABLA"); } }?> Is this the right way to accomplish the goal ? Help
  12. Hello Guys, i defined an interface for my databases and now i have this method in my interface: public function queryUniqueObject($query, $debug ); My problem is that i alwasy done without interfaces this methodas as public function queryUniqueObject($query, $debug = false ); If now i try to use this last method in the class that implements the interface, it says that it has to be like that ( interface ). But in the interface, it doesn't let me put the method like $debug= false. Why ? how can i solve this ? because i really dont want to modify my entire code.
  13. Hello everyone I am trying to use CodeIgniter and i am a little bit confused. I have the file index.php that has the entire website layout. I will need to use it in a lot of differente pages. The only thing that really change is the div content that is inside the index.php. How i can create just one file and use it in different pages ? Create the header and footer in differente pages and use include ? ( this is the default style that i use ) but with MVC Pattern i dont know if this is the right method to reach the goal. any suggestions ? thanks
  14. Hello everyone I am trying to use CodeIgniter and i am a little bit confused. I have the file index.php that has the entire website layout. I will need to use it in a lot of differente pages. The only thing that really change is the div content that is inside the index.php. How i can create just one file and use it in different pages ? Create the header and footer in differente pages and use include ? ( this is the default style that i use ) but with MVC Pattern i dont know if this is the right method to reach the goal. any suggestions ? thanks
  15. Does it possible to modify Eclipse PHP to recognise NaturalDoc ?
  16. but you they initialize the vars ? where they make something like this $name = $array['name']; ? explode returns an array :s
  17. i saw a lot of external examples calling the vars like this ( echo $name; ) in the view file. But as you explained , they come in array style. how they pass the array variable to a single variable ? you did something like this in your example ( view file ) <?php echo array['name']; ?> that i can understand but there is a lot of examples in another tutorials dealing with <?php echo $name; ?> how is that possible ?
  18. ok, i didn't know that point... i tryed a different way, and it's fine.. but i dont understand why.. because i think that is the same thing : $handle = @fopen($file, "ab+")  OR die("Failed to open the file " . $file);     $nome = $_POST['Nome']; $email = $_POST['Email'];     $gravar = $nome  ."|-|". $email; @fwrite($handle, "$gravar\r\n"); and now, the file jump to the next line
  19. Hy there... I have one question about managing files.. I have one form with 2 input type="text" and i want to write the $_POST data on the file.. Ok, it works, but my problem is i want that the next registration be on a new line, so, when i open te agenda.txt(agenda is adress book in Portuguese, btw  ;D) the data is written on a new line... I wrote the "\n" but i a single char appears on the .txt and the new registration occurs next the last one , instead of a new line the code is : if(isset($_POST['Adicionar'])) { $handle = @fopen($file, "a+") OR die("Failed to open the file " . $file . "\n");     $nome = $_POST['Nome']; $email = $_POST['Email']; @fwrite($handle, $nome . "|-|"); @fwrite($handle,$email ); @fwrite($handle, "\n"); } thnks a lot
  20. thnks a lot.. i saw somethings on book but didnt work like... echo "$name i search and i saw that i must use $_POST[name] ; why all tutorials says that the name inside the array for example $_POST[name] use $_POST['name'] the [b]'[/b] but if i use i receive a error.. if i dont use.. its everything ok and running.. my other doubt.. which advantages i have passing variables into the url ?
  21. hY GUYS [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /] i started learn php yesterday and i bought a book called PHP 4 " a beginner's Guide" from Bill McCarty - Osborne..." The shop where i bought the book for the money i have to spend only had php 4.3 from 2 authors from Portugal..(i'm Portuguese) and the book i bought.. my question is.. the php 4 and php 4.3 are too much different ? i want your advice .. thnks
  22. Hy all.. [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /] Yesterday i bought one book called PHP 4 " A beginner's Guide from Osborne Editor , author > Bill McCarty.. my first question is, anyone knows that book ? is good ? the book talks about php 4... i know that nowadays php is running on version 5 (i think..) .. Can i have any problem learning php 4 ? At this moment i'm trying to change company web host but the server is running on Linux and the other server is running with Windows Microsoft XP (xampp) [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /] Has you just thought the directories are different and i don't know anything of PHP. I Just programmed some C and i recognize some things.. require "$_SERVER[DOCUMENT_ROOT]/Az-Auto/lib/config.obj.php"; require "$_SERVER[DOCUMENT_ROOT]/Az-Auto/lib/globalserver.obj.php"; require "$_SERVER[DOCUMENT_ROOT]/Az-Auto/include/topo.inc.php"; require "$_SERVER[DOCUMENT_ROOT]/include/lang.$lingua.php"; i tryed the _SERVER['DOCUMENT_ROOT'] with the [b]' ' [/b] and didn't work.. the other question... --------------------------------- [b]file: config.obj.php[/b] | -------------------------------- Class config { var $db; var $login; var $senha; var $odbc; var $driver; var $servidor; Function config () { $this->db="azauto_main"; $this->login="azauto"; $this->senha="azautosite"; $this->odbc= ""; $this->driver= ""; $this->servidor="localhost"; } } the reply from the host is :> Fatal error: Cannot redeclare class config in c:\programas\xampp\htdocs\Az-Auto\lib\config.obj.php on line 6 need help =D thnks
×
×
  • 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.