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 14 1619
*** sm***********@gmail.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
--
Hi,
thanks but where is the help??
Bye
Can you post the code where you loop and output the results?
Steve
smilesinbl...@gmail.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 sm***********@gmail.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
*** sm***********@gmail.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
--
Hi,
Forgive me for not giving the php code.
the datatype for hits is varchar(10).
The query is :
$query_mostwanted = "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_mostwanted = mysql_fetch_assoc($mostwanted)); ?>
Please help and let me know if you need any more info.
Thanks once again
Bye
Hi,
I am so sorry but isnt there anyone who can help?
Thanks
Bye sm***********@gmail.com wrote: Hi, Forgive me for not giving the php code.
the datatype for hits is varchar(10).
The query is :
$query_mostwanted = "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_mostwanted = mysql_fetch_assoc($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_mostwanted = "SELECT * FROM table ORDER BY hits DESC";
$result_mostwanted = mysql_query($query_mostwanted);
$serialid = 1;
while ($row_mostwanted = mysql_fetch_assoc($result_mostwanted)) {
echo
"<tr><td>$serialid</td><td>{$row_mostwanted['hits']}</td><td>{$row_mostwanted['artist']}</td></tr>\n";
$serialid++;
}
JP
--
Sorry, <de*****@cauce.org> is a spam trap.
Real e-mail address unavailable. 5000+ spams per month.
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
*** sm***********@gmail.com wrote/escribió (5 May 2005 06:38:19 -0700): <?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_mostwanted = mysql_fetch_assoc($mostwanted)); ?>
You first use $row_mostwanted before giving it any value, so in the first
iteration its contents are unpredictable. Fix this first.
Also, it's a good idea to always use htmlspecialchars() to output text into
HTML, otherwise you may face problems when your strings contain certain
chars.
--
-- Á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
--
*** sm***********@gmail.com wrote/escribió (5 May 2005 20:37:55 -0700): I am so sorry but isnt there anyone who can help?
I've never understood why people post messages like this. This is not a pay
help desk where operators spend eight hours a day helping customers (or
fourteen if in China). If you are in a hurry, it's unlikely that posting
twice will make group fellows log in sooner. Oh, come on, get a glass of
warm milk and relax on the coach for a while. Answers will come; if they
don't, it's normally because:
* Poster didn't write an informational "subject" line
* Poster didn't provide enough info
* Nobody knows the answer (some times happens)
--
-- Á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
--
*** sm***********@gmail.com wrote/escribió (6 May 2005 00:30:13 -0700): 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.
Before it was working too, only that not as expected: alphabetical order is
not very useful when dealing with numbers :)
--
-- Á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
-- sm***********@gmail.com wrote: 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
that was the reason i asked about the datatype of 'hits' yesterday!
don't worry: i tool out time without batting an eyelid.
s This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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 !!!
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
| |