Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP][CSS]die(); i css
Forum PHP.pl > Forum > Przedszkole
elewator
Więc... ledwo co się uporałem z jednym problemem, to mam nastepny...
Jest taki kod:
  1. <?php
  2. $mysql_mylink = mysql_connect(xxx, xxx, xxx)
  3. or die ("Cannot make the connection");
  4. or die ("Cannot connect to the database");
  5.  
  6. if (($_POST['ip']) &&($_POST['port']))
  7. $typ = $_POST['typ'];
  8. {
  9. $rime1 = "INSERT INTO lgsl (status, ip, q_port, c_port, s_port, type, cache, cache_time, zone, disabled) VALUES ('1', '".$_POST['ip']."', '0', '0', '0', '".$_POST['typ']."', '0', '0', '0', '0')";
  10. mysql_query($rime1) or die ("Nie udało się");
  11. print "Dane zostały zapisane!<br>Dziękujemy!";
  12. }
  13. ?>

kiedy ma się wyświetlić "die", cała strona sie rozjezdza, bo nie laduje sie css... Da sie cos z tym zrobic?
Link: http://siampa.hostil.pl/add.php (sprobujcie dodac jakis serwer ktory jest w http://siampa.hostil.pl/list.php)
Wicepsik
Funkcja
  1. <?php
  2. die()
  3. ?>
zatrzymuje cały skrypt i po niej nic się nie wyświetla
elewator
hmm... da sie to czymsc zastapic, zeby nie zatrzymywalo skryptu?
Wicepsik
if i else smile.gif


  1. <?php
  2. $mysql_mylink = mysql_connect(localhost, xx, xx)
  3. if(!$mysql_mylink){ echo "Cannot make the connection"; }else{
  4. $baza = mysql_select_db(siampa_siampa)
  5. if(!$baza){ echo "Cannot connect to the database"; }else{
  6.  
  7. if (($_POST['ip']) &&($_POST['port']))
  8. $typ = $_POST['typ'];
  9. {
  10. $rime1 = "INSERT INTO lgsl (status, ip, q_port, c_port, s_port, type, cache, cache_time, zone, disabled) VALUES ('1', '".$_POST['ip']."', '0', '0', '0', '".$_POST['typ']."', '0', '0', '0', '0')";
  11. mysql_query($rime1) or die ("Nie udało się");
  12. print "Dane zostały zapisane!<br>Dziękujemy!";
  13. }
  14.  
  15. }
  16. }
  17. ?>
elewator
Nie dziala sad.gif
Kod
Parse error: syntax error, unexpected T_IF in /home/siampa/domains/siampa.hostil.pl/public_html/add2.php on line 9
Wicepsik
  1. <?php
  2. $mysql_mylink = mysql_connect(localhost, xx, xx);
  3. $baza = mysql_select_db(siampa_siampa);
  4. ?>

Za nimi postaw ;

  1. <?php
  2. $mysql_mylink = mysql_connect(localhost, xx, xx);
  3. if(!$mysql_mylink){ echo "Cannot make the connection"; }else{
  4. $baza = mysql_select_db(siampa_siampa);
  5. if(!$baza){ echo "Cannot connect to the database"; }else{
  6.  
  7. if (($_POST['ip']) &&($_POST['port']))
  8. $typ = $_POST['typ'];
  9. {
  10. $rime1 = "INSERT INTO lgsl (status, ip, q_port, c_port, s_port, type, cache, cache_time, zone, disabled) VALUES ('1', '".$_POST['ip']."', '0', '0', '0', '".$_POST['typ']."', '0', '0', '0', '0')";
  11. mysql_query($rime1) or die ("Nie udało się");
  12. print "Dane zostały zapisane!<br>Dziękujemy!";
  13. }
  14.  
  15. }
  16. }
  17. ?>
elewator
Wszystko jest ok, tylko teraz nie moze sie do bazy podlaczyc... Dane sa na 100% dobre
Wicepsik
  1. <?php
  2. $baza = mysql_select_db('siampa_siampa', $mysql_mylink);
  3. ?>
elewator
dalej to samo
Wicepsik
A jaki błąd?


  1. <?php
  2. $mysql_mylink = mysql_connect('localhost', 'xx', 'xx');
  3. ?>
elewator
"Cannot make the connection"
Wicepsik
Musisz mieć złe dane, u mnie się normalnie łączy.

  1. <?php
  2. $mysql_mylink = mysql_connect('localhost', 'user', 'pass');
  3. if(!$mysql_mylink){ echo "Cannot make the connection"; }else{
  4. $baza = mysql_select_db('baza');
  5. if(!$baza){ echo "Cannot connect to the database"; }else{
  6.  
  7. echo 'Wszystko przebiegło pomyślnie.';
  8. }
  9. }
  10. ?>
elewator
  1. <html>
  2. <head>
  3. <?php include('includes/head.php'); ?>
  4. </head>
  5. <body>
  6. <?php include('includes/header.php'); ?>        
  7. <?
  8. $mysql_mylink = mysql_connect('localhost', 'uzytkownik', 'haslo');
  9. if(!$mysql_mylink){ echo "Cannot make the connection"; }else{
  10. $baza = mysql_select_db('baza');
  11. if(!$baza){ echo "Cannot connect to the database"; }else{
  12.  
  13. if (($_POST['ip']) &&($_POST['port']))
  14. $typ = $_POST['typ'];
  15. {
  16. $rime1 = "INSERT INTO lgsl (status, ip, q_port, c_port, s_port, type, cache, cache_time, zone, disabled) VALUES ('1', '".$_POST['ip']."', '0', '0', '0', '".$_POST['typ']."', '0', '0', '0', '0')";
  17. $zapytanie = mysql_query($rime1);
  18. if(!$zapytanie){ echo "Cannot make the connection"; }else{
  19. print "Dane zostały zapisane!<br>Dziękujemy!";
  20. }
  21. }
  22. }
  23. }
  24. ?>
  25. <?php include('includes/sidebar.php'); ?>
  26. <?php include('includes/footer.php'); ?>
  27. </html>

No za nic nie chce pojsc. Dane sa na 100000% dobre
erix
Ciężko zobaczyć, co mysql_error" title="Zobacz w manualu PHP" target="_manual wypluwa...?
elewator
Juz sobie poradzilem tongue.gif dzieki za pomoc
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.