0

im trying to get a data from database into a text field:

$fothersq=("SELECT others FROM january");
$fothers=mysql_query($fothersq);

<input type="text" placeholder="0" name="febothers" size="11" value="<?php if(@$fothers){echo htmlentities(@$fothers);} ?>">

but i got this error in the text field instead.

<br /><b>Warning</b>:  htmlentities() expects parameter 1 to be string, resource given in <b>C:\xampp\htdocs\CashFlow\febprev.php</b> on line <b>116</b><br />

also in another text field i use this coding just to test:

<input type="text" name="febbonus" size="11" placeholder="0" value="<?php if(@$fbonus){echo (@$fbonus);} ?>">

and i got this error:

Resource id #7

any ideas?

Edited by pritaeas: Added markdown.

2
Contributors
4
Replies
13
Views
3 Years
Discussion Span
Last Post by nadiam
0

After:

$fothers = mysql_query($fothersq);

There should be:

$row = mysql_fetch_array($fothers);

and then use $row instead of $fothers

0

i added what u suggested :

$fothersq=("SELECT others FROM january");
$fothers=mysql_query($fothersq);
$row=mysql_fetch_array($fothers);

<input type="text" placeholder="0" name="febothers" size="11" value="<?php if(@$row){echo htmlentities(@$row);} ?>">

i got this error:

<br /><b>Warning</b>:  htmlentities() expects parameter 1 to be string, array given in <b>C:\xampp\htdocs\CashFlow\febprev.php</b> on line <b>117</b><br />

Edited by pritaeas: Added markdown.

0
<input type="text" placeholder="0" name="febothers" size="11" value="<?php if(@$row){echo htmlentities(@$row['others']);} 
0

oh.. right. hehe thank you so much! you've been helping me alot thanks :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.