PHP selected mysql data view as number

2014-05-04T18:39:49

I'm selecting data from mysql database and print it in a webpage. I'm using wamp server. why I can't fetch the data ?

$result = mysql_query("SELECT userid FROM user WHERE logid = 'root'") or die(mysql_error());
echo $result; //result view as Resource id #7

but I count number of rows which equels to root it views as 1

$result = mysql_query("SELECT userid FROM user WHERE logid = 'root'") or die(mysql_error());
$no_of_rows = mysql_num_rows($result);
echo $no_of_rows; //result view as 1

Copyright License:
Author:「Dumindu Madushanka」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/23455236/php-selected-mysql-data-view-as-number

About “PHP selected mysql data view as number” questions

I'm selecting data from mysql database and print it in a webpage. I'm using wamp server. why I can't fetch the data ? $result = mysql_query("SELECT userid FROM user WHERE logid = 'root'") or die(
I am new to PHP. I have completed some tasks for file saving/edit and view the data information from mysql table. I have found some code from web that can export mysql selected data to pdf. but it ...
I've tried several codes for me to attain the results needed. But it still gives me the wrong results. The results that it gave me is the most recent entry and not the sum of my selected data. CRE...
I have current mysql database and i want to make a query to this database with php and if any number of rows are selected based on this mysql query. I want to take variables from these selected row...
I have 3 SQL tables, "artists", "tracks" and "tracks_artists" (=linking table, because one track can have multiple artists, I'm restricted to use a linking table). I now have an "edit page" where ...
Error: No Database Selected I have a website that was hosted with ARVIXE (windows 2008 server) and presently with IXWEBHOSTING (windows 2003 server). It was very simple to move. It was a matter to...
this code showing all MySQL table data to any users but i want only admin and user to show data of mysql query i have multiple users 1.admin 2.user123 3.xyz so i want only admin and user to s...
I'd like to be able to remember the selected value of my dropdownlist. Whether it be from java, a Session or Cookie and have it selected accordinaly after postback. Any help would be much appreciat...
I have made ​​a view mysql and php I want to display the operation through the filter, but the result could not be displayed. Here is the code this function to show data function tampilDataRegFilt...
How can I select some MySQL data from an HTML table? And how can I update all selected data with one HTML update form? I thought with using a checkbox I can select some data, but how can I update ...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.