Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - Sorting is ... [PHP/MySQL] | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
Darth Coby Vire Dacht je nou echt dat het over was? Dacht je nou echt dat ik gebroken was? Nee toch? Nou kijk eens goed op uit je ogen gast. zonder clic heb je geen kloten tjap... bitch Level: 55 Posts: 582/1371 EXP: 1240774 For next: 73415 Since: 03-15-04 From: Belgium Since last post: 2 days Last activity: 9 hours |
| ||
Alright, so I'm working on the ExGFX workshop and I got the sorting all worked out and all, but now I have some little problems. I have 8 columns: URL, Name, Author, Palette, Type, Pic8, Pic16, Downloads. When I sort on URL, Name and Author one file just DOESN'T APPEAR. It's not in the damn list! The file starts with a number and all the other files with a letter. Here's my code: $sql = mysql_query("SELECT * FROM kt15x_files ORDER BY $sorting ASC"); for($i=0;$file[$i]=mysql_fetch_array($sql, MYSQL_ASSOC);$i++); while($next = next($file)){ $url = $next[URL]; $name = $next[Name]; echo "$name"; $author = $next[Author]; $palette = $next[Palette]; $type = $next[Type]; $pic8 = $next[Pic8]; $pic16 = $next[Pic16]; $downloads = $next[Downloads]; MakeTable($url, $name, $author, $palette, $type, $pic8, $pic16, $downloads); } The $sorting variable is set in the beginning of the file with a switch. Why doesn't it show the 3 at ALL in URL, Name and Author? :s EDIT: I have a page that outputs a file with header thingies and all so your download'll start. (download.php?file=filename) but when I tried to input a bit of MySQL so it would add to a counter in the DB it still gave the file for download but it didn't update the DB. Here's the code: include_once("db_connect.php"); $filename = $_GET['file']; $counter = mysql_query("SELECT `Downloads` FROM `kt15x_files` WHERE `Name` = $filename LIMIT 1"); $counter = $counter++; $sql = mysql_query("UPDATE `kt15x_files` SET `Downloads` = $counter WHERE `Name` = $filename LIMIT 1"); $sql = mysql_close($connection); This doesn't return an error or nothing, is it because download.php is getting the header of a .zip file when you download from it? (edited by Coby on 06-20-04 09:17 AM) (edited by Coby on 06-20-04 11:37 AM) |
|||
sloat Level: 16 Posts: 2/85 EXP: 18044 For next: 2212 Since: 05-21-04 From: South Central Delaware Since last post: 19 days Last activity: 5 hours |
| ||
text/string coulmns have be enclosed in single or double quotes. check your insert query for your first problem. it's also the problem with your second set of queries. ie: "SELECT `Downloads` FROM `kt15x_files` WHERE `Name` = '$filename' LIMIT 1" "UPDATE `kt15x_files` SET `Downloads` = $counter WHERE `Name` = '$filename' LIMIT 1" and also be sure to escape the strings that you're passing in the query, if magic quotes aren't turned on. php provides the mysql_escape_string() function for this. if that doesn't work...well, sorry i guess. |
|||
Darth Coby Vire Dacht je nou echt dat het over was? Dacht je nou echt dat ik gebroken was? Nee toch? Nou kijk eens goed op uit je ogen gast. zonder clic heb je geen kloten tjap... bitch Level: 55 Posts: 588/1371 EXP: 1240774 For next: 73415 Since: 03-15-04 From: Belgium Since last post: 2 days Last activity: 9 hours |
| ||
Thx! I got it to work now! It still didn't fix the problem of some files not showing up but I worked around that by adding a dummy with the lowest possible number and the highest possible download counter. Of course these are excluded from the page. Not the way it's supposed to but hey it works. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - Sorting is ... [PHP/MySQL] | | | |