3 Replies - 3992 Views - Last Post: 16 April 2015 - 06:18 AM Rate Topic: -----

#1 Koseng_Ali   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 15-April 15

Parse error: syntax error, unexpected 'for' (T_FOR), expecting

Posted 15 April 2015 - 03:34 PM

got this error message:
Parse error: syntax error, unexpected 'for' (T_FOR), expecting ',' or ';' in C:\xampp\htdocs\Smartphones\UserAnzeigen.inc.php on line 13
but i cant find a mistake... can you help me?

<?php
   echo "Inhalt der Datei: kneipenAnzeigen.inc.php";

   include('db_connect.inc.php');

  //SQL-Befehl vorbereiten
  $sql = 'SELECT *
          FROM kneipen';
          
  $erg = mysql_query ($sql,$db) or die ("Fehlermeldung=".mysql_error());
  $anz = mysql_num_rows($erg);
     
   echo"<table>";  
   echo"<tr><th>Name</th><th>Art</th><th>Note</th><th>Kommentar</th></tr>"; 
  for($i=0; $i<$anz; $i=$i+1){
    $a=mysql_result($erg,$i,"Name");
    $b=mysql_result($erg,$i,"Art");
    $c=mysql_result($erg,$i,"Note");
    $d=mysql_result($erg,$i,"Kommentar");
    echo"<tr><td>$a</td><td>$b</td><td>$c</td><td>$d</td></tr>";
  }
  echo"</table>";

?>


Is This A Good Question/Topic? 0
  • +

Replies To: Parse error: syntax error, unexpected 'for' (T_FOR), expecting

#2 Koseng_Ali   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 15-April 15

Re: Parse error: syntax error, unexpected 'for' (T_FOR), expecting

Posted 15 April 2015 - 03:47 PM

ooh i have found my mistake... nevertheless thank you guys...
Was This Post Helpful? 0
  • +
  • -

#3 CTphpnwb   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3837
  • View blog
  • Posts: 13,998
  • Joined: 08-August 08

Re: Parse error: syntax error, unexpected 'for' (T_FOR), expecting

Posted 15 April 2015 - 03:48 PM

Deprecated MySQL functions are simpler to use (not counting all the sanitizing you need to add) than PDO or MySQLi prepared statements, but far less secure. That's why they've been deprecated. If you're just learning PHP you should start with
http://www.dreaminco...duction-to-pdo/
or
http://php.net/manua...-statements.php
When dealing with old code that uses deprecated MySQL functions you should replace them if possible. If it's not possible, your experience with PDO or MySQLi will benefit you when dealing with MySQL functions.
Was This Post Helpful? 1
  • +
  • -

#4 Koseng_Ali   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 15-April 15

Re: Parse error: syntax error, unexpected 'for' (T_FOR), expecting

Posted 16 April 2015 - 06:18 AM

Thank you :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1