Re: show a field in php file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thats just executing the query.. you need to use the result set, and
iterate over it...

$rs = mysql_query($query);
while($row=mysql_fetch_array($rs)) {
 echo $row[0]; ...

}

stuff like that.


> Hey guys how would i show a filed from a MySQL database in a php file?
> Isnt it this?
> SELECT * FROM `user`
> But that dosent work because it comes out blank :-\
> And I already am connected to the database
> Code:
>
> mysql_connect ('localhost','myaccount','mypass')
> 	or die ("could not connect to server");
> mysql_select_db ('database')
> 	or die ("could not connect to database");
>
> $query = "SELECT *
> FROM `user`
> LIMIT 0 , 30";
> 	mysql_query($query);
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux