Script-Fehler

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Script-Fehler

    Kann mir mal irgendjemad helfen ???

    In Zeile 47 & 57 --> Parse Error
    Code:
    <?php
    
    //Script © Matt Ford - [url]http://www.matthewford.co.uk[/url] 
    //Free to distribute edit etc as long as this 
    //remains. 
    
    //Nun folgen die Verbindungseinstellungen
    
    $MYSQL_HOST = "localhost";
    $MYSQL_USER = "root";
    $MYSQL_PASS = "sql";
    $DATABASE	= "news";
    
    //Verbindung zu DB-Server herstellen
    
    $db=mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS); 
    mysql_select_db($DATABASE,$db); 
    
    //Schreibe Formular
    if($write=="yes") 
    { 
    print("<form action=news.php method=post>"); 
    print("Title:<input type=text name=title><br>"); 
    print("Content:<textarea name=content cols=20 rows=5></textarea><br>"); 
    print("Email:<input type=text name=email><br>"); 
    print("Nickname:<input type=text name=nickname><br>"); 
    print("Date:<input type=text name=date><br>"); 
    print("Password:<input type=password name=pass><br>"); 
    print("ID:<input type=text name=id><br>"); 
    print("<input type=submit value=add>"); 
    print("<input type=hidden name=add value=yes>"); 
    print("</form>"); 
    } 
    
    //Daten hinzufügen
    if($add=="yes" && $pass=="password") 
    { 
    $db=mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS); 
    mysql_select_db($DATABASE,$db); 
    //add to database 
    mysql_query("INSERT INTO news VALUES ('$title','$content','$email','$nickname','$date','$id')"); 
    mysql_close(); 
    } 
    
    //read from database newset 5 stories 
    $result=mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 0,5",$db); 
    while ($myrow = mysql_fetch_row($result)) [b]<-- Zeile 47[/b]
    { 
    print("<table width=100% bgcolor=FF9933 cellspacing=1>"); 
    print("<tr><td bgcolor=808080><b>$myrow[0]</b></td></tr>"); 
    print("<tr><td bgcolor=333333><font size=-1>$myrow[1]</font></td></tr>"); 
    print("<tr><td bgcolor=808080 align=right><font size=-2><b>Submitted by <a href=mailto:$myrow[2]>$myrow[3]</a> on $myrow[4]</b></font></td></tr>"); 
    print("</table>"); 
    print("<br>"); 
    } 
    $result=mysql_query("SELECT * FROM news",$db);  
    $rows = mysql_num_rows($result); [b]<-- Zeile 57[/b]
    print("<font color=cccccc>$rows total stories</font>"); 
    mysql_close(); 
    ?>
    If something's HARD to do,

    then it's not worth doing.
    (Homer J. (Jay) Simpson)

  • #2
    Was für Parse Error ?
    Gib ihn mal bitte

    Kommentar


    • #3
      aber klar, hier

      Code:
      [b]Warning[/b]: Supplied argument is not a valid MySQL result resource in [b]d:\web\domain(1)\debug\news.php[/b] on line [b]47[/b]
      
      [b]Warning[/b]: Supplied argument is not a valid MySQL result resource in [b]d:\web\domain(1)\debug\news.php[/b] on line [b]57[/b]
      Kannste damit jetzt mehr anfangen ???
      If something's HARD to do,

      then it's not worth doing.
      (Homer J. (Jay) Simpson)

      Kommentar


      • #4
        Jah.
        War mir schon von anfang an komisch vorgekommen
        entweder du nimmst:

        mysql_db_query($db, $query);
        oder du nimmst
        mysql_query($query);

        wobei beim 2. die datenbank per
        mysql_select_db($db);
        selektiert werden muss

        Kommentar

        Lädt...
        X