| View previous topic :: View next topic |
| Author |
Message |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Sat Mar 03, 2012 5:16 pm Post subject: [SOLVED] count url |
|
|
what is wrong here :
| Code: | #Url
set sqlsiteurl "SELECT COUNT(DISTINCT(siteurl)) FROM home WHERE siteurl='siteurl'"
set siteurl [mysqlsel $mysql_(handle) $sqlsiteurl -flatlist] |
_________________ GreatZ
Fire-Fox | Denmark
Scripts: Relay | Store Text | TvMaze
Last edited by Fire-Fox on Sat Mar 03, 2012 7:28 pm; edited 1 time in total |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Mar 03, 2012 5:38 pm Post subject: |
|
|
Well, that'd depend on the database structure and contents, as well as the expected results...
Anyhow...
| Code: | | SELECT COUNT(DISTINCT(siteurl)) |
Return the number of unique siteurl's from the filtered set.
| Code: | | WHERE siteurl='siteurl' |
Filter the results to only return rows where the field siteurl is equal to the string "siteurl".
If you expect this to return anything other than 0 or 1, then you need to rethink your query. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Johannes13 Halfop
Joined: 10 Oct 2010 Posts: 46
|
Posted: Sat Mar 03, 2012 6:23 pm Post subject: |
|
|
| sql injection ftw. Make sure you escape the user given variables |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Mar 03, 2012 6:28 pm Post subject: |
|
|
Johannes13, since there are no variable substitutions within the query of the posted code, I don't see the relevance of sql injections. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Sat Mar 03, 2012 6:43 pm Post subject: |
|
|
Thanks nml375
Did it like this :
| Code: | #Url
set sqlsiteurl "SELECT COUNT(DISTINCT(siteurl)) FROM pred"
set siteurl [mysqlsel $mysql_(handle) $sqlsiteurl -flatlist] |
and returned 715 urls  _________________ GreatZ
Fire-Fox | Denmark
Scripts: Relay | Store Text | TvMaze |
|
| Back to top |
|
 |
|