473,320 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

while($row = ) fetch row from table show not complete result..

when we do mysql_query with while and mysql_num_rows() together then while do no show the first row from table in database..

example :
<?
$conn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName"); $sqlquery = "SELECT * FROM $table WHERE opinion = 'is great'";
$result = mysql_query($sqlquery,$conn);
$number = mysql_num_rows($result); //to get the total rows

echo "Total row is " . $number ;

while($rows = mysql_fetch_assoc($result)) //show all the values in all rows in table

{
echo $uid = $row['id'];
echo $name = $row[''name];
}
//while show not the first value in the row , to show the value in first and all other //rows we have to run the another $sql_query and that is not good idea ...
exit;
?>

please tell me how to resolve it...thanks..
Sep 15 '06 #1
2 7386
ronverdonk
4,258 Expert 4TB
Your result set is in $rowS, while you get your values from $row (without the S).
So this statement
[PHP]while($rows = mysql_fetch_assoc($result)) {
[/PHP]
must be changed to
[PHP]while($row = mysql_fetch_assoc($result)) {
[/PHP]

Ronald :cool:
Sep 15 '06 #2
Hello,

that was just in hurry while posting, that S, nut when i code is all right . coding is not problem, if any code wrong then , script does not run.

you try with same sql query for num rows and while(),

try it i am running all my db system, thing is if it work proper then i had not to run two different sql query...

thanks
Sep 16 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: VM | last post by:
I'm trying to dynamically display the rows in a datagrid while filling the datatable source. I'm doing it this way because we had already finished the app but this section sometimes took so long...
2
by: VM | last post by:
When I display data to a Windows datagrid I usually fill the underlying table (in another class) and then, once it contains all the data, I attach it to the grid. But there are some processes that...
4
by: bridgemanusa | last post by:
Hi All: I have a very long page of html that I want to take portions and hide them in divs, then show when a link is clicked. I have the hide show part working when the link is clicked, however...
14
by: dawnerd | last post by:
Hi, I am developing a CMS and came across something which has never happened to me before, and I re-wrote the specific script twice, both differently, and still had the same error. I'm not sure...
2
by: mpar612 | last post by:
Hi everyone, The code posted below retrieves all of the rows from a database table. It paginates them by limiting to 20 results per page. It is supposed to print 5 rows of results with 4...
7
by: monomaniac21 | last post by:
Hi all! How can you get rid of the error that displays if you do a query which returns no result and then try and fetch the array, WITHOUT having to put the while in another conditional like if...
2
by: azmiza | last post by:
Hi everybody, I need your help. I want to view my sql database and its work very well which is display in my web browser but once I want to press button yes, its not working, I check the...
6
by: michael941 | last post by:
Hi, I have 2 tables in an html page. I have div them separately and id them as id1 and id2. I have a link there. What I need is click the link to hide one table and show the other and verse when...
6
by: RoomfulExpress | last post by:
Here's the problem that I'm having- I'm trying to pull in 2 fields from my database and place them in the title of the HTML. I'm connecting to the db and selecting everything exactly the same as I am...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.