Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Skrypt nie widzi zmiennej globalnej
Forum PHP.pl > Forum > Przedszkole
trifek
Witam serdecznie,
Mam taki skrypt:
  1. $GLOBALS['zmienna'] = $_GET['zmienna'];
  2.  
  3. class UploadHandler
  4. {
  5.  
  6. protected $options;
  7.  
  8. protected $error_messages = array(
  9. 1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
  10. 2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'
  11. 'image_resize' => 'Failed to resize image'
  12. );
  13.  
  14. protected $image_objects = array();
  15.  
  16. public function __construct($options = null, $initialize = true, $error_messages = null) {
  17. $this->response = array();
  18.  
  19. protected function get_file_name($file_path, $name, $size, $type, $error,
  20. $index, $content_range) {
  21. //$name = $this->trim_file_name($file_path, $name, $size, $type, $error,
  22. // $index, $content_range);
  23. $time_start_variables = microtime(true);
  24. $name = $this->trim_file_name($file_path, md5($name.$time_start_variables), $size, $type, $error, $index, $content_range);
  25. //echo "<br/>-".$name."<br/>"; nazwa pliku zmienionego
  26.  
  27.  
  28. $zmienna_zapis = null;
  29. $zmienna_zapis = $name;
  30. require_once("../../db.php");
  31. require_once("../../lib.php");
  32. // GLOBALS['zmienna']
  33.  
  34. $sizeese = str_replace("image/", "", $type);
  35.  
  36. $ms->query("INSERT INTO " . $GLOBAL['bfprzed'] . "produkty (enable, foto1, kategoria, rozmiar) VALUES ( '1' , '" . $zmienna_zapis .".$sizeese". "', '" . GLOBALS['zmienna'] . "', '".$size."');");
  37.  
  38.  
  39.  
  40.  
  41.  
  42. return $this->get_unique_filename(
  43. $file_path,
  44. $this->fix_file_extension($file_path, $name, $size, $type, $error,
  45. $index, $content_range),
  46. $size,
  47. $type,
  48. $error,
  49. $index,
  50. $content_range
  51. );
  52. }
  53.  
  54.  
  55. }
  56.  
  57.  
  58.  


Parametrem GET dostarczam wartość do skryptu: $GLOBALS['zmienna'] = $_GET['zmienna'];

i chciałbym ją odczytać w:
$ms->query("INSERT INTO produkty (enable, foto1, kategoria, rozmiar) VALUES ( '1' , '" . $zmienna_zapis .".$sizeese". "', '" . GLOBALS['zmienna'] . "', '".$size."');");

(funkcja get_file_name)

Wie ktoś co zrobić żeby skrypt zobaczył tą wartość?
trueblue
Dopisać "$"?
trifek
racja, dziękuje smile.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.