Autor Beitrag
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 14.06.06 09:22 
zu 3.: Mit explode kannst du aus dem String einen Array machen über den du mit für 1. eine Schleife laufen lassen kannst.
2.) max()

_________________
Markus Kinzler.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 14.06.06 09:32 
Max() liefert nicht die Anzahl der String zwsichen den Kommas zurück.

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
<html>
<head>
  <title>verarbeitung</title>
</head>
<body>
<?php 


 $host = '192.168.1.170:D:/Database/NESTRO_TESTD3.FDB';
 $username='SYSDBA';
 $password='masterkey';
 $kommt=NULL;
 $geht=NULL;

 if($_POST['zeit']=="kommt"){
  $kommt=date("d.m.Y H:i");
 }else{
  $geht=date("d.m.Y H:i");
 } 

  for ($i=1; $i=max($_POST['kartennummer']); $i++) 
   {
    $karte= explode(" ", $_POST['kartennummer']);

    $dbh = ibase_connect ( $host, $username, $password ) or die ("error in db connect");
     $query= ibase_prepare($dbh, 'Select * from RUECKMELDUNG_UHR(?,?,?)');
     $rs=ibase_execute($query, $karte[i], $kommt, $geht);
    $row=ibase_fetch_row($rs);

   ibase_free_query($query);
   }
 
 ibase_close($dbh);

 echo $row[0];
?>
</body>
<meta http-equiv="refresh" content="5; URL=index.php">
</html>


Moderiert von user profile iconChristian S.: Delphi- durch Code-Tags ersetzt

_________________
Das Unsympathische an den Computern ist, dass sie nur ja oder nein sagen können, aber nicht vielleicht.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 14.06.06 09:36 
Da hab ich dich falsch verstanden.Die Anzahl der Elemente des Arrays erhälts du mit count()

_________________
Markus Kinzler.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 14.06.06 10:04 
Aha, hier mal die Source!

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
<html>
<head>
  <title>verarbeitung</title>
</head>
<body>
<?php 


 $host = '192.168.1.170:D:/Database/NESTRO_TESTD3.FDB';
 $username='SYSDBA';
 $password='masterkey';
 $kommt=NULL;
 $geht=NULL;
 $karte= explode(",", $_POST['kartennummer']);

 if($_POST['zeit']=="kommt"){
  $kommt=date("d.m.Y H:i");
 }else{
  $geht=date("d.m.Y H:i");
 } 

  for ($i=0; $i=count($_POST['kartennummer']); $i++) 
   {
    
    $dbh = ibase_connect ( $host, $username, $password ) or die ("error in db connect");
     $query= ibase_prepare($dbh, 'Select * from RUECKMELDUNG_UHR(?,?,?)');
     $rs=ibase_execute($query, $karte[i], $kommt, $geht);
    $row=ibase_fetch_row($rs);

   ibase_free_query($query);
   }
 
 ibase_close($dbh);

 echo $row[0];
?>
</body>
<meta http-equiv="refresh" content="5; URL=index.php">
</html>


Der Rast einfach nur durch. Unednlich. Die Bedingung stimmt nicht. Der soll einfach bei einen Beispiel String von 1234,4321,5678 3mal durchlaufen.

Moderiert von user profile iconChristian S.: Delphi- durch Code-Tags ersetzt

_________________
Das Unsympathische an den Computern ist, dass sie nur ja oder nein sagen können, aber nicht vielleicht.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 14.06.06 10:08 
In Zeile 22 muß es $karte heißen.

Der Meta-tag in Zeile 38 gehört eigentlich in den <Head>-Tag.

_________________
Markus Kinzler.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 14.06.06 10:11 
Kein Erfolg. Er rennt weiter, unendlich! Das heißt, dass die Bedinguung im For nicht richtig ist.

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
<html>
<head>
  <title>verarbeitung</title>
  <meta http-equiv="refresh" content="5; URL=index.php">
</head>
<body>
<?php 


 $host = '192.168.1.170:D:/Database/NESTRO_TESTD3.FDB';
 $username='SYSDBA';
 $password='masterkey';
 $kommt=NULL;
 $geht=NULL;
 $karte= explode(",", $_POST['kartennummer']);

 if($_POST['zeit']=="kommt"){
  $kommt=date("d.m.Y H:i");
 }else{
  $geht=date("d.m.Y H:i");
 } 

  for ($i=0; $i=count($karte); $i++) 
   {
    
 //   $dbh = ibase_connect ( $host, $username, $password ) or die ("error in db connect");
 //    $query= ibase_prepare($dbh, 'Select * from RUECKMELDUNG_UHR(?,?,?)');
 //    $rs=ibase_execute($query, $karte[i], $kommt, $geht);
 //   $row=ibase_fetch_row($rs);

   ibase_free_query($query);
   }
 
 ibase_close($dbh);

 echo $row[0];
?>
</body>

</html>


Moderiert von user profile iconChristian S.: Delphi- durch Code-Tags ersetzt

_________________
Das Unsympathische an den Computern ist, dass sie nur ja oder nein sagen können, aber nicht vielleicht.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 14.06.06 10:14 
laß dir mal count($karte) anzeigen.

_________________
Markus Kinzler.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 14.06.06 10:16 
Ich erhalte 0.

_________________
Das Unsympathische an den Computern ist, dass sie nur ja oder nein sagen können, aber nicht vielleicht.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 14.06.06 10:21 
Okay, jetzt gehts. Tipfehler. Count($karte) zeigt jetzt die anzahl der kartennummern.


ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
<html>
<head>
  <title>verarbeitung</title>
  <meta http-equiv="refresh" content="5; URL=index.php">
</head>
<body>
<?php 


 $host = '192.168.1.170:D:/Database/NESTRO_TESTD3.FDB';
 $username='SYSDBA';
 $password='masterkey';
 $kommt=NULL;
 $geht=NULL;
 $karte= explode(",", $_POST['kartennummer']);


 if($_POST['zeit']=="kommt"){
  $kommt=date("d.m.Y H:i");
 }else{
  $geht=date("d.m.Y H:i");
 } 

  for ($i=1; $i>=count($karte); $i++) 
   {
    
    $dbh = ibase_connect ( $host, $username, $password ) or die ("error in db connect");
     $query= ibase_prepare($dbh, 'Select * from RUECKMELDUNG_UHR(?,?,?)');
     $rs=ibase_execute($query, $karte[i], $kommt, $geht);
    $row=ibase_fetch_row($rs);


   echo $row[0];
   ibase_free_query($query);
   }
 
 ibase_close($dbh);

 
?>
</body>

</html>


Fehlermeldung:
Warning: ibase_close(): 0 is not a valid InterBase link resource in C:\wampp2\htdocs\send.php on line 37

Moderiert von user profile iconChristian S.: Delphi- durch Code-Tags ersetzt

_________________
Das Unsympathische an den Computern ist, dass sie nur ja oder nein sagen können, aber nicht vielleicht.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 14.06.06 10:23 
Das heißt ja, das der Array 0 Elemente hat oder die varibale nicht definiert ist, was sie aber sein sollte.
Was steht den in Kartennummer drin (im getesteten Beispiel)?

_________________
Markus Kinzler.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 14.06.06 10:24 
Noch ein Problem. Führt man den Code mit nur einer Kartennummer aus, als mit dem String 1234, passiert nix. Sicherlich, weil der explode versucht, das Komma zu finden.

_________________
Das Unsympathische an den Computern ist, dass sie nur ja oder nein sagen können, aber nicht vielleicht.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 14.06.06 10:26 
Explode ohne Komma mit diesen String: 1445 1319

Fehlermeldung: Warning: ibase_close(): 0 is not a valid InterBase link resource in C:\wampp2\htdocs\send.php on line 37

_________________
Das Unsympathische an den Computern ist, dass sie nur ja oder nein sagen können, aber nicht vielleicht.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 14.06.06 10:29 
Dann frag doch vorher mit strpos() ab ob der String ein komma enthält.

_________________
Markus Kinzler.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 14.06.06 10:35 
Es wird immr verrückter.

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
<html>
<head>
  <title>verarbeitung</title>
  <meta http-equiv="refresh" content="5; URL=index.php">
</head>
<body>
<?php 

 $host = '192.168.1.170:D:/Database/NESTRO_TESTD3.FDB';
 $username='SYSDBA';
 $password='masterkey';
 $kommt=NULL;
 $geht=NULL;
 if($_POST['zeit']=="kommt"){
  $kommt=date("d.m.Y H:i");
 }else{
  $geht=date("d.m.Y H:i");
 }  

 $pos = strpos($_POST['kartennummer'],",")

 if ($pos == false)
  {
   echo "ein nummer";
  } else
  {
   $karte= explode(" ", $_POST['kartennummer']);
   echo count($karte);

   for ($i=0; $i>=count($karte)-1; $i++) 
    {
    
     $dbh = ibase_connect ( $host, $username, $password ) or die ("error in db connect");
      $query= ibase_prepare($dbh, 'Select * from RUECKMELDUNG_UHR(?,?,?)');
      $rs=ibase_execute($query, $karte[i], $kommt, $geht);
     $row=ibase_fetch_row($rs);


   // echo $row[0];
    ibase_free_query($query);
    }
 
 ibase_close($dbh);

 
?>
</body>

</html>


Fehler:
Parse error: parse error in C:\wampp2\htdocs\send.php on line 22

Moderiert von user profile iconChristian S.: Delphi- durch Code-Tags ersetzt

_________________
Das Unsympathische an den Computern ist, dass sie nur ja oder nein sagen können, aber nicht vielleicht.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 14.06.06 10:40 
Ok, vergisse alles letztere. Jetzt habe ich nur noch das alte Poblem, dieser Meldung.

2
Warning: ibase_close(): 0 is not a valid InterBase link resource in C:\wampp2\htdocs\send.php on line 51

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
<html>
<head>
  <title>verarbeitung</title>
  <meta http-equiv="refresh" content="5; URL=index.php">
</head>
<body>
<?php 

 $host = '192.168.1.170:D:/Database/NESTRO_TESTD3.FDB';
 $username='SYSDBA';
 $password='masterkey';
 $kommt=NULL;
 $geht=NULL;
 if($_POST['zeit']=="kommt"){
  $kommt=date("d.m.Y H:i");
 }else{
  $geht=date("d.m.Y H:i");
 }  

 $pos = strpos($_POST['kartennummer'],",");

 if ($pos === false)
  {
   $karte=$_POST['kartennummer'];
   
   $dbh = ibase_connect ( $host, $username, $password ) or die ("error in db connect");
    $query= ibase_prepare($dbh, 'Select * from RUECKMELDUNG_UHR(?,?,?)');
    $rs=ibase_execute($query, $karte, $kommt, $geht);
   $row=ibase_fetch_row($rs);

   echo $row[0];
   ibase_free_query($query);
  } else
  {
   $karte= explode(",", $_POST['kartennummer']);
   echo count($karte);

   for ($i=0; $i>=count($karte)-1; $i++) 
    {
    
     $dbh = ibase_connect ( $host, $username, $password ) or die ("error in db connect");
      $query= ibase_prepare($dbh, 'Select * from RUECKMELDUNG_UHR(?,?,?)');
      $rs=ibase_execute($query, $karte[i], $kommt, $geht);
     $row=ibase_fetch_row($rs);


   // echo $row[0];
    ibase_free_query($query);
    }
   }
 ibase_close($dbh);

 
?>
</body>
</html>


Moderiert von user profile iconChristian S.: Delphi- durch Code-Tags ersetzt

_________________
Das Unsympathische an den Computern ist, dass sie nur ja oder nein sagen können, aber nicht vielleicht.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 14.06.06 10:41 
ich würde das ganze ein bischen umbauen:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
$pos = strpos($_POST['kartennummer'],",")

 if ($pos === false)
  {
    $karte = array( $_POST['kartennummer']);
  } else {
   $karte= explode(" ", $_POST['kartennummer']);
  }
   for ($i=0; $i>=count($karte)-1; $i++)

_________________
Markus Kinzler.


Zuletzt bearbeitet von mkinzler am Mi 14.06.06 10:47, insgesamt 1-mal bearbeitet
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 14.06.06 10:42 
Jep, mit einer Kartennummer gehts es jetzt auch, aber irgendwas scheint noch nicht mit der for-schleife zu stimmen oder mit dem definieren des arrays.

_________________
Das Unsympathische an den Computern ist, dass sie nur ja oder nein sagen können, aber nicht vielleicht.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 14.06.06 10:50 
Die Fehlermeldung passiert schon hier!

for ($i=0; $i>=$max; $i++)

alles danach wird ignoriert!

_________________
Das Unsympathische an den Computern ist, dass sie nur ja oder nein sagen können, aber nicht vielleicht.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 14.06.06 10:58 
Klar

for ($i=0; $i>=$max; $i++)

Bedeutet ja, das die Schleife solange i>max ist ausgeführt wird, was nie gilt, deshalb wird die Schleife garnicht ausgeführt. das glkeiche Problem hast du auch im Programm

_________________
Markus Kinzler.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 14.06.06 11:45 
Überhaupt keine Reaktion. Schleife wird nicht gestartet bei folgenden String: 1234,5678

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
<html>
<head>
  <title>verarbeitung</title>

</head>
<body>
<?php 
  //<meta http-equiv="refresh" content="5; URL=index.php">
 $host = '192.168.1.170:D:/Database/NESTRO_TESTD3.FDB';
 $username='SYSDBA';
 $password='masterkey';
 $kommt=NULL;
 $geht=NULL;
 if($_POST['zeit']=="kommt"){
  $kommt=date("d.m.Y H:i");
 }else{
  $geht=date("d.m.Y H:i");
 }  

 $pos = strpos($_POST['kartennummer'],",");

 if ($pos === false)
  {
   $karte=$_POST['kartennummer'];
   
   $dbh = ibase_connect ( $host, $username, $password ) or die ("error in db connect");
    $query= ibase_prepare($dbh, 'Select * from RUECKMELDUNG_UHR(?,?,?)');
    $rs=ibase_execute($query, $karte, $kommt, $geht);
   $row=ibase_fetch_row($rs);

   echo $row[0];
   ibase_free_query($query);
  } else
  {
   $karte= explode(",", $_POST['kartennummer']);
   $max=count($karte);



   for ($i=0; $i<$max; $i++) 
    {
echo $karte[i];

    
     $dbh = ibase_connect ( $host, $username, $password ) or die ("error in db connect");
      $query= ibase_prepare($dbh, 'Select * from RUECKMELDUNG_UHR(?,?,?)');
      $rs=ibase_execute($query, $karte[i], $kommt, $geht);
     $row=ibase_fetch_row($rs);


    echo $row[0];
    ibase_free_query($query);
    }

   }
 ibase_close($dbh);

 
?>
</body>
</html>


Moderiert von user profile iconChristian S.: Delphi- durch Code-Tags ersetzt

_________________
Das Unsympathische an den Computern ist, dass sie nur ja oder nein sagen können, aber nicht vielleicht.