Jump to content


Mysql and PHP help


4 replies to this topic

#1 Crofty

    Young Padawan

  • Members
  • Pip
  • 32 posts

Posted 27 September 2006 - 04:03 AM

ok well i am trying to make a top selleres list but when the amountsold goes past 10 it reads it as 1

	$r4 = mysql_query("SELECT * FROM `products` order by `amountsold` DESC LIMIT 0,10");
	while($row = mysql_fetch_assoc($r4)){
	echo' 
	  <tr>
		<td width="200" align="center"><a href="index.php?view=dvd&id='.$row['dvdid'].'">'.$row['dvdname'].'</a></td>
	  </tr>';
}

have i missed out something?

#2 Crofty

    Young Padawan

  • Members
  • Pip
  • 32 posts

Posted 27 September 2006 - 10:39 AM

well in my database there is a field called amountsold and once this value increases above 10 it dosent read the second digit

#3 Mr. Matt

    Moderator

  • P2L Staff
  • PipPipPipPip
  • 1,945 posts
  • Gender:Not Telling

Posted 27 September 2006 - 11:20 AM

you missed the $ from the $r so you will get an error.

Matt

#4 Crofty

    Young Padawan

  • Members
  • Pip
  • 32 posts

Posted 27 September 2006 - 12:07 PM

the limit seems to be fine it works atm

#5 Crofty

    Young Padawan

  • Members
  • Pip
  • 32 posts

Posted 29 September 2006 - 04:09 AM

EDIT: SOLVED DIDNT MAKE AMOUNT SOLD INT


no sorry i mean the limt worked fine in the first place. every time a product is bought it adds 1 to the amountsold field of that product, but when the amount sold gets bigger than 10 it starts to read the first didgit only for example it reads 10 as 1 and 25 as 2, i dont know why its doing this?

Edited by Crofty, 29 September 2006 - 04:10 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users