You are here: Re: Dynamic Form « PHP Programming Language « IT news, forums, messages
Re: Dynamic Form

Posted by Tyno Gendo on 04/05/07 15:36

Jerim79 wrote:
> A new situation that has arised is that now the for loop, even though
> it doesn't insert anything other than 0 to the database, it seems to
> be stuck in an infinite loop. Here is the code:
>
> <?php
>
> if ($_SERVER["REQUEST_METHOD"] == "POST") {
> $Number=$_POST['Number'];
> echo $Number;
> $Age[]=$_POST['Age'];
> $Height[]=$_POST['Height'];
>
> include ("../functions/db_conn.php");
>
> for ($i=0; i <= $Number; $i++) {
> $query="INSERT INTO Age(Age,Height)
> VALUES('$Age[$i]','$Height[$i]')";
> echo $Age[i], $Height[i];
> $result = mysql_query($query) or die('Query failed: ' .
> mysql_error());
> }
>
> There are two echo $Number commands, one is not pictured here as it is
> at the bottom of the page. Both of these confirm that $Number equals
> 2. I might try a while loop, to just see if that fixes anything. I
> don't know why this infinite loop just appeared.
>

Is the code cut and paste? its missing the $ off the i<= $Number

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация