473,668 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strange query problem php/mysql

Hi all,

I have a table with a lot of songs. All songs have a field called hits.
Everytime a song page is seen hits becomes hit++, everything smooth
going.

I also have a page where I run the query

select * from table order by hits DESC

No error all fine but songs that have 1000+ hits is not shown above
songs with 50 hits...until... they cross 1500.

This is a strange problem.

the page is here http://tinyurl.com/b8qr8

all songs that cross 100+ hits disapear...but they are in the DB and
the hits are going up but they wont show up on this page until they
cross one more digit.

Please help is something wrong with my query.

I use mysql 4.022 with php 4.3.11

Thanks once again

Bye

Jul 17 '05 #1
14 1639
*** sm***********@g mail.com wrote/escribió (4 May 2005 23:05:44 -0700):
Please help is something wrong with my query.


Yep, there's probably a problem with your code.
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #2
Hi,

thanks but where is the help??

Bye

Jul 17 '05 #3
Can you post the code where you loop and output the results?

Steve
smilesinbl...@g mail.com wrote:
Hi all,

I have a table with a lot of songs. All songs have a field called hits. Everytime a song page is seen hits becomes hit++, everything smooth
going.

I also have a page where I run the query

select * from table order by hits DESC

No error all fine but songs that have 1000+ hits is not shown above
songs with 50 hits...until... they cross 1500.

This is a strange problem.

the page is here http://tinyurl.com/b8qr8

all songs that cross 100+ hits disapear...but they are in the DB and
the hits are going up but they wont show up on this page until they
cross one more digit.

Please help is something wrong with my query.

I use mysql 4.022 with php 4.3.11

Thanks once again

Bye


Jul 17 '05 #4
sm***********@g mail.com wrote:
Hi all,

I have a table with a lot of songs. All songs have a field called hits.
Everytime a song page is seen hits becomes hit++, everything smooth
going.

what's the data type of the field 'hits'?

<snip />

s
Jul 17 '05 #5
*** sm***********@g mail.com wrote/escribió (5 May 2005 01:36:11 -0700):
thanks but where is the help??


My excuses... That was all the help I could provide with the information I
have. You posted a link to the resulting HTML and all I can tell you is
that your HTML is fine, the problem must be in the underlying code (either
PHP or SQL).

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #6
Hi,
Forgive me for not giving the php code.

the datatype for hits is varchar(10).

The query is :

$query_mostwant ed = "SELECT * FROM table ORDER BY hits DESC";

I repeat the <tr> using:

<?php do { ?>
<tr>
<td><?php echo $serialid++; ?></td>
<td><?php echo $row_mostwanted['song']; ?> - <?php echo
$row_mostwanted['hits']; ?></td>
<td><?php echo $row_mostwanted['artist']; ?></td>
</tr>
<?php } while ($row_mostwante d = mysql_fetch_ass oc($mostwanted) ); ?>
Please help and let me know if you need any more info.

Thanks once again
Bye

Jul 17 '05 #7
Hi,

I am so sorry but isnt there anyone who can help?

Thanks
Bye

Jul 17 '05 #8
sm***********@g mail.com wrote:
Hi,
Forgive me for not giving the php code.

the datatype for hits is varchar(10).

The query is :

$query_mostwant ed = "SELECT * FROM table ORDER BY hits DESC";

I repeat the <tr> using:

<?php do { ?>
<tr>
<td><?php echo $serialid++; ?></td>
<td><?php echo $row_mostwanted['song']; ?> - <?php echo
$row_mostwanted['hits']; ?></td>
<td><?php echo $row_mostwanted['artist']; ?></td>
</tr>
<?php } while ($row_mostwante d = mysql_fetch_ass oc($mostwanted) ); ?>
Please help and let me know if you need any more info.

Thanks once again
Bye

I find that style of mixing of code and HTML rather unreadable. How
about this:

<?php

$query_mostwant ed = "SELECT * FROM table ORDER BY hits DESC";
$result_mostwan ted = mysql_query($qu ery_mostwanted) ;
$serialid = 1;

while ($row_mostwante d = mysql_fetch_ass oc($result_most wanted)) {
echo
"<tr><td>$seria lid</td><td>{$row_mo stwanted['hits']}</td><td>{$row_mo stwanted['artist']}</td></tr>\n";
$serialid++;
}

JP

--
Sorry, <de*****@cauce. org> is a spam trap.
Real e-mail address unavailable. 5000+ spams per month.
Jul 17 '05 #9
Hi,
I can't belive i can be such a big dump.....i just had to change the
varchar(10) to int. thats it. its working now.

thanks to everyone who tool out time.

Thanks

Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1828
by: Frank | last post by:
Scripts tested on: Win 98 - PWS PHP & MySQL Win 2000 Server - IIS PHP MySQL Win98 - Apache PHP MySQL Scripts all work fine !!!
0
2135
by: Neculai Macarie | last post by:
Hi! Using Union and Order By gives strange behaviour in the following test-case: drop table if exists gallery; drop table if exists gallery_categ; # create test tables create table gallery (d_image_small char(100), d_image_big char(100)); create table gallery_categ (d_image char(100)); # insert test data
0
2357
by: Soefara | last post by:
Dear Sirs, I am experiencing strange results when trying to optimize a LEFT JOIN on 3 tables using MySQL. Given 3 tables A, B, C such as the following: create table A ( uniqueId int not null default 0 auto_increment, a1 varchar(64) not null default '',
3
2056
by: Sven Reifegerste | last post by:
Hi, i have a table with INT columns id,key,b1,b2,c1,c2, having 1.500.000 rows. 'key' and 'id' are indexed (Kardinality 385381) and id (Kardinality 1541525). Performing a SELECT * FROM table WHERE key IN (10,11,12) OR key BETWEEN 20000 AND 28000 AND b1<4500000 AND b2>3954545 AND c1<4543554 AND c2>4400000
3
1257
by: Bob Bedford | last post by:
I've no access to mysql NG, so I ask here. I've a strange behaviour with mysql. when I do a select from a simple table, then I get a result for a certain field when I then put a "union" and create a query that return no result, I get an other result for that field. All other fields seems ok. the field's type are different (one is a mediumint(8) and the other is a
16
1559
by: Justin Koivisto | last post by:
I am trying to create a query to use as a report record source. Below is what I want to do (this was tested and works with a MySQL web script): SELECT contacts.id, contacts.email, contacts.first_name, contacts.last_name, contacts.middle_name, contacts.company,
9
1949
by: davek | last post by:
(posted to: php.general, comp.lang.php, alt.php, alt.php.sql) I have a form where registered users on my site can edit their login details. For some reason, the script is inserting an extraneous quote mark in the mysql update query that is preventing it from running successfully, but I am at a complete loss to understand why. This is my code: $sql = "UPDATE users SET username = '{$usr}',
9
1689
by: Dave | last post by:
Hi guys, I have just set up a duplicate server running: apache 2.54, mysql 5.04 and php 5.04 This is the same setup as as the server we are using now, apart from the hardware inside. I have copied across the database and website, with exact same permissions as the first server. The problem is that part of the php code is executing but others
2
1801
by: Frank Aune | last post by:
Hi, Explaining this problem is quite tricky, but please bear with me. Ive got an application which uses MySQL (InnoDB) for two things: 1. Store and retrieve application data (including viewing the application log) 2. Store the application log produced by the python logging module The connection and cursor for the two tasks are completely separate, and they
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8890
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8791
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8575
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7398
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2784
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1783
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.