php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2004

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 22.09.2004, 01:44  
Gast
 
Beiträge: n/a
Standard

hm trotzdem das gleiche problem mom ich paste nochmal den jetzigen source :
PHP-Code:
<?


include "config.php";

if (
$_GET['module'] == "news" && !isset($_GET['id'])); {


    echo 
"News\n
"
;
    
$sql "
       SELECT
                Titel,
                Inhalt,
                Datum
              FROM
                News
            ORDER BY
                ID DESC
    LIMIT 5

                              "
;
    
$result mysql_query($sql) OR die(mysql_error());
    if(
mysql_num_rows($result)) {
        while(
$row mysql_fetch_assoc($result)) {




echo 
"<table width=\"50%\" border=\"0\">";
echo 
"<tr valign=\"top\">";
echo 
"<td height=\"25\">";
echo 
"[b]";
echo 
$row['Titel'];
echo 
"[/b]";
echo 
"</td>   ";
echo 
"<td align=\"right\">";
echo 
date("d.m.Y "$row['Datum']); // Datum
echo date("H:i"$row['Datum']); // Uhrzeit
echo "</td>  ";
echo 
"  </tr>                      ";
echo 
"  <tr>                       ";
echo 
"  <td colspan=\"3\">        ";
echo 
nl2br($row['Inhalt']);
echo 
"</td>      ";
echo 
"  </tr>                             ";
echo 
"  <tr>                               ";
echo 
"  <td colspan=\"3\" td align=\"right\">       ";
echo 
"
"
;
echo 
"news posted by [ test ]</td> ";
echo 
"  </tr>                                       ";







            echo 
"

"
;




      }
   } else {
       echo
"

Keine News vorhanden</p>\n"
;
    }

    
mysql_close($db);
    echo 
"</table>   ";

}




       include 
"config.php";



if (
$_GET['module'] == "news" && isset($_GET['id']))  {



    echo 
"News\n
"
;
    
$sql "SELECT
                Titel,
                Inhalt,
                Datum
            FROM
                News
           WHERE ID = $id
        "
;



    
$result mysql_query($sql) OR die(mysql_error());
    if(
mysql_num_rows($result)) {
    while(
$row mysql_fetch_assoc($result)) {


echo 
"<table width=\"50%\" border=\"0\">";
echo 
"<tr valign=\"top\">";
echo 
"<td height=\"25\">";
echo 
"[b]";
echo 
$row['Titel'];
echo 
"[/b]";
echo 
"</td>   ";
echo 
"<td align=\"right\">";
echo 
date("d.m.Y "$row['datum']); // Datum
echo date("H:i"$row['datum']); // Uhrzeit
echo "</td>  ";
echo 
"  </tr>                      ";
echo 
"  <tr>                       ";
echo 
"  <td colspan=\"3\">        ";
echo 
nl2br($row['Inhalt']);
echo 
"</td>      ";
echo 
"  </tr>                             ";
echo 
"  <tr>                               ";
echo 
"  <td colspan=\"3\" td align=\"right\">       ";
echo 
"
"
;
echo 
"news posted by [ test ]</td> ";
echo 
"  </tr>                                       ";
}
} else {
echo
"

Keine News vorhanden</p>\n"
;
                              }

mysql_close($db);

echo 
"</table>";
    }
?>
 
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 22.09.2004, 01:48  
Erfahrener Benutzer
 
Registriert seit: 21.07.2003
Beiträge: 340
PHP-Kenntnisse:
Fortgeschritten
Simbo
Standard

entferne das semikolon ";" in der ersten if-Abfrage....
sorry, war mein fehler...
__________________
simbo.de
Simbo ist offline  
Alt 22.09.2004, 01:49  
Gast
 
Beiträge: n/a
Standard

upsi übersehen ja funktioniert big thx hast mir sehr geholfen
 
Alt 22.09.2004, 10:42  
Gast
 
Beiträge: n/a
Standard

PHP-Code:
<?


include "config.php";

if (
$_GET['module'] == "news" && !isset($_GET['id']) && !isset($_GET['module'])) {


    echo 
"News\n
"
;
    
$sql "
       SELECT
                Titel,
                Inhalt,
                Datum
              FROM
                News
            ORDER BY
                ID DESC
    LIMIT 5

                              "
;
    
$result mysql_query($sql) OR die(mysql_error());
    if(
mysql_num_rows($result)) {
        while(
$row mysql_fetch_assoc($result)) {




echo 
"<table width=\"50%\" border=\"0\">";
echo 
"<tr valign=\"top\">";
echo 
"<td height=\"25\">";
echo 
"[b]";
echo 
$row['Titel'];
echo 
"[/b]";
echo 
"</td>   ";
echo 
"<td align=\"right\">";
echo 
date("d.m.Y "$row['Datum']); // Datum
echo date("H:i"$row['Datum']); // Uhrzeit
echo "</td>  ";
echo 
"  </tr>                      ";
echo 
"  <tr>                       ";
echo 
"  <td colspan=\"3\">        ";
echo 
nl2br($row['Inhalt']);
echo 
"</td>      ";
echo 
"  </tr>                             ";
echo 
"  <tr>                               ";
echo 
"  <td colspan=\"3\" td align=\"right\">       ";
echo 
"
"
;
echo 
"news posted by [ test ]</td> ";
echo 
"  </tr>                                       ";
echo 
"

"
;
      }
   } else {
       echo
"

Keine News vorhanden</p>\n"
;
    }

    
mysql_close($db);
    echo 
"</table>   ";

}




 if (
$_GET['module'] == "news" && isset($_GET['id']))  {


       include 
"config.php";







    echo 
"News\n
"
;
    
$sql "SELECT
                Titel,
                Inhalt,
                Datum
            FROM
                News
           WHERE ID = $id
        "
;



    
$result mysql_query($sql) OR die(mysql_error());
    if(
mysql_num_rows($result)) {
    while(
$row mysql_fetch_assoc($result)) {


echo 
"<table width=\"50%\" border=\"0\">";
echo 
"<tr valign=\"top\">";
echo 
"<td height=\"25\">";
echo 
"[b]";
echo 
$row['Titel'];
echo 
"[/b]";
echo 
"</td>   ";
echo 
"<td align=\"right\">";
echo 
date("d.m.Y "$row['datum']); // Datum
echo date("H:i"$row['datum']); // Uhrzeit
echo "</td>  ";
echo 
"  </tr>                      ";
echo 
"  <tr>                       ";
echo 
"  <td colspan=\"3\">        ";
echo 
nl2br($row['Inhalt']);
echo 
"</td>      ";
echo 
"  </tr>                             ";
echo 
"  <tr>                               ";
echo 
"  <td colspan=\"3\" td align=\"right\">       ";
echo 
"
"
;
echo 
"news posted by [ test ]</td> ";
echo 
"  </tr>                                       ";
}
} else {
echo
"

Keine News vorhanden</p>\n"
;
                              }

mysql_close($db);

echo 
"</table>";
  }






if (
$_GET['module'] == "news" && isset($_GET['archiv']))  {





echo 
"</table>";
echo 
"<table width=\"50%\" border=\"0\">";
echo  
"<tr>                    ";
echo   
" <td>Nummer</td>      ";
echo   
"<td>Titel</td>       ";
echo  
"  <td>Datum</td>     ";
echo 
"  </tr>               ";



include 
"config.php";

      echo 
"News Archiv\n

"
;
    
$sql "SELECT
                ID,
                Titel,
                Datum
            FROM
                News
            ORDER BY
                id DESC"
;
    
$result mysql_query($sql) OR die(mysql_error());
    if(
mysql_num_rows($result)) {
        while(
$row mysql_fetch_assoc($result)) {




echo 
"<tr>";
echo 
"<td>";
echo 
"<a href=\"?module=news&id=".$row['ID']."\">";
echo 
$row['ID'];
echo 
"</a>";
echo 
"</td>";
echo 
"<td>";
echo 
$row['Titel'];
echo 
"</td>";
echo 
"<td>";
echo 
date("d.m.Y "$row['datum']); // Datum
echo date("H:i"$row['datum']); // Uhrzeit
echo "</td>";
echo 
"</tr>";










        }
    } else {
        echo
"

Keine News vorhanden</p>\n"
;
    }


     
mysql_close($db);

echo 
"</table>";



             }



  
?>


Hm nun funken module und die id ausgabe nur er zeigt mir bei ?module=news nicht die news an -.-
 
Alt 23.09.2004, 04:01  
Erfahrener Benutzer
 
Registriert seit: 21.07.2003
Beiträge: 340
PHP-Kenntnisse:
Fortgeschritten
Simbo
Standard

PHP-Code:
<?
if ($_GET['module'] == "news" && !isset($_GET['id']) && !isset($_GET['module'])) {
?>
wie kann $_GET['module'] gleich "news" sein, wenn es gleichzeitig nicht gesetzt sein darf??? das ergibt wohl keinen sinn...
ich denke du wolltest das so haben:
PHP-Code:
<?
if ($_GET['module'] == "news" && !isset($_GET['id']) && !isset($_GET['archiv'])) { 
?>
__________________
simbo.de
Simbo ist offline  
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
JS: Einführung - Javascript im Schichtenmodell nikosch Tutorials 4 11.04.2009 17:06
Rekursive Funktion bricht ab... duras666 PHP Tipps 2008 9 28.04.2008 11:36
gpc_quotes funktion: verbesserungsvorschläge? Promaetheus PHP Tipps 2007 10 12.08.2007 19:29
Komplexe Funktion: +Übersichtlichkeit, -Performance Jacks Rache PHP Tipps 2006 3 07.06.2006 14:22
PHP-GTK Tutorial Beitragsarchiv 9 02.11.2005 21:07
Rückgabewert einer rekrusiven Funktion PHP-Fortgeschrittene 7 06.10.2005 18:44
(schnellere) Funktion zum Zusammenfassen von CSS PHP-Fortgeschrittene 21 08.08.2005 16:47
In einer Funktion auf eine Funktion der Klasse zugreifen phpbeginner PHP Tipps 2005-2 2 28.07.2005 00:30
Funktion in einer Funktion aufrufen? PHP Tipps 2005-2 11 14.06.2005 15:14
[Erledigt] Array-Übergabe in Funktion PHP Tipps 2005 1 08.05.2005 21:05
[Erledigt] Variablen in eine Funktion übernehmen PHP Tipps 2005 1 26.02.2005 17:19
[Erledigt] Wie kann ich beliebig viele Werte an eine Funktion übergeben PHP Tipps 2005 11 25.01.2005 10:44
[Erledigt] Funktion in funktion nicht möglich? PHP-Fortgeschrittene 4 28.11.2004 00:14
[Erledigt] sql syntax error in funktion, kann aber nix finden :( PHP Tipps 2004 10 20.07.2004 19:19
[Erledigt] Referenz auf Funktion übergeben PHP-Fortgeschrittene 7 20.07.2004 09:51

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
if ($_get[\'id\'] echo

Alle Zeitangaben in WEZ +2. Es ist jetzt 04:02 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.