Página 1 de 1

Función dentro de una clase

NotaPublicado: 2012-01-26 13:15 @594
por BigBear
Tengo el siguiente código.

Sintáxis: [ Descargar ] [ Ocultar ]
Using php Syntax Highlighting
  1. <?php
  2.  
  3. /*
  4.  
  5. Contador 0.1
  6.  
  7. Coded By Doddy H
  8.  
  9. */
  10.  
  11.  
  12. class contador {
  13.  
  14. function start() {
  15.  
  16. $host = "localhost";
  17. $user = "root";
  18. $pass = "";
  19. $db = "contador";
  20.  
  21. if ($test = @mysql_connect($host,$user,$pass)) {
  22. if (mysql_select_db($db)) {
  23. return true;
  24. }}}
  25.  
  26. function end() {
  27. $test->close;
  28. }
  29.  
  30. public function instalar() {
  31.  
  32. start();
  33. $todo1 = "create table visitas (
  34. suma int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  35. PRIMARY KEY (suma));
  36. ";
  37.  
  38. if (@mysql_query($todo1)) {
  39. return true;
  40. }
  41. end();
  42. }
  43.  
  44. public function desintalar() {
  45.  
  46. if (@mysql_query("drop table visitas")) {
  47. return true;
  48. }}
  49.  
  50.  
  51.  
  52. }
  53.  
  54. // The End ?
  55.  
  56. ?>
  57.  
  58.  
Coloreado en 0.020 segundos, usando GeSHi 1.0.8.4


El problema es que no sé cómo hacer que start() funcione dentro de una clase para la función instalar(), todo dentro de la clase, porque con la función instalar() me aparece un error diciendo que no encuentra dicha función.

¿ Alguien me puede ayudar ?