Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with showing data fram database in textfield

Status
Not open for further replies.

TanTrazz

Programmer
Joined
Aug 18, 2001
Messages
54
Location
NL
Hi all,

I've got a problem with showing data in a textfield

The connection is made with the MySQL database.

This is the query:

$query = "SELECT * FROM uren WHERE id = $id";
$row = mysql_query($query);

And this is the textfield code :

<input type=&quot;Text&quot; name=&quot;datum&quot; size=&quot;30&quot; value = &quot;<? echo($row['datum']); ?>&quot;>


The problem is it also wont show the values in normal text like this

<? echo($row['datum']); ?>

Please help me

Tnx TanTrazz

 
it should be like

$query = &quot;SELECT * FROM uren WHERE id = $id&quot;;
$result=mysql_query($query);
$row = mysql_fetch_row($result);


________
George, M
 
Jojo, kdyz hodis
Code:
$result=mysql_query($query,$connection);
tak ti to vyhodi vysledek dotazu, ale potrebujes to jeste roztridit pomoci funkce mysql_result(), ktera ma parametry:
1. vysledek mysql dotazu, v tomto pripade $result
2. cislo radku, ze kteryho chces vybirat, v tomto pripade 0 jako prvni radek
3. cislo sloupecku nebo jeho jmeno, takze v tomto pripade 'datum'

kdyz teda hodis $datum=mysql_result($result,0,'datum'); tak ti to do promenny $datum vrati datum z tvyho dotazu...
 
Sorry to those who can't speak czech. I only said that the mysql_query() function returns result of the query and it needs to be passed into mysql_result() function or to the mysql_fetch_row() as shaddow said.
 
I finally got myself to write a FAQ about this ever popular difficulty.
faq434-3850
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top