Home > Archive > PHP DB > September 2007 > Data not fetching in the textfield.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Data not fetching in the textfield.
|
|
| Chris Carter 2007-09-26, 6:59 pm |
|
I am trying to fetch data through this code:
My code:
for($i=0;$i<mysql_num_rows($results);$i++)
{
$rows = mysql_fetch_array($results);
echo '<div>' ;
echo ' <div class="fieldrow">' ;
echo ' ' ;
echo ' <label for="storename">Store name:</label>' ;
echo ' ' ;
echo ' <input name="storename" type="text" maxlength="35" id="storename"
class="regForm" disabled="disabled" value=$rows[0]></input>' ;
echo ' </div>' ;
The value option in the textfield is not fetching the data, neither is it
throwing errors. However the same code works perfectly as suggested by one
of expert Nabble users:
Nabble code:
for($i=0;$i<mysql_num_rows($results);$i++)
{
$rows = mysql_fetch_array($results);
echo("<input name=\"input1\" type=\"text\" value=$rows[0]>");
}
Please help.
Chris
--
View this message in context: http://www.nabble.com/Data-not-fetc....html#a12904665
Sent from the Php - Database mailing list archive at Nabble.com.
| |
|
| You could always do something like:
while( $x = myql_fetch_array( $results ) ) {
list( $var1, $var2, $var3, ... ) = $x;
echo "<input name=storename type=text value=$var1>";
}
Chris Carter wrote:
> I am trying to fetch data through this code:
>
> My code:
> for($i=0;$i<mysql_num_rows($results);$i++)
> {
> $rows = mysql_fetch_array($results);
> echo '<div>' ;
> echo ' <div class="fieldrow">' ;
> echo ' ' ;
> echo ' <label for="storename">Store name:</label>' ;
> echo ' ' ;
> echo ' <input name="storename" type="text" maxlength="35" id="storename"
> class="regForm" disabled="disabled" value=$rows[0]></input>' ;
> echo ' </div>' ;
>
> The value option in the textfield is not fetching the data, neither is it
> throwing errors. However the same code works perfectly as suggested by one
> of expert Nabble users:
>
> Nabble code:
>
> for($i=0;$i<mysql_num_rows($results);$i++)
> {
> $rows = mysql_fetch_array($results);
> echo("<input name=\"input1\" type=\"text\" value=$rows[0]>");
> }
>
> Please help.
>
> Chris
|
|
|
|
|