show(print) value from the database

gesf

Active member
Hi
Can anyone tell how can i show(print) a value from my db?
my field is int(10) and and using this code to show what is inside:

$test = mysql_query("SELECT myfield FROM mytable WHERE id = '1'");
echo "$test";

But it show '4' and not the value that is in that field.

I wanna know too, how can i show a value from the db with this format: 12.34567, using this code:
$test = number_format($test, 'something');

thanks
 
Code:
$test = mysql_query("SELECT myfield FROM mytable WHERE id = 1"); 
$row=mysql_fetch_array($test);

echo $row["NameofIntField"]; //Leave the quotes in when you substitute the name of your DB field.


The 4 you are getting I think is a result resource. There are a couple other ways to do what you need, but this is the most flexible in my opinion.
 
Back
Top