This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
-
Fire-Fox
- Master
- Posts: 299
- Joined: Sat Sep 23, 2006 9:01 pm
- Location: /dev/null
Post
by Fire-Fox »
what is wrong here :
Code: Select all
#Url
set sqlsiteurl "SELECT COUNT(DISTINCT(siteurl)) FROM home WHERE siteurl='siteurl'"
set siteurl [mysqlsel $mysql_(handle) $sqlsiteurl -flatlist]
Last edited by
Fire-Fox on Sat Mar 03, 2012 7:28 pm, edited 1 time in total.
-
nml375
- Revered One
- Posts: 2860
- Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 »
Well, that'd depend on the database structure and contents, as well as the expected results...
Anyhow...
Return the number of unique siteurl's from the filtered set.
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
-
Johannes13
- Halfop
- Posts: 46
- Joined: Sun Oct 10, 2010 11:38 am
Post
by Johannes13 »
sql injection ftw. Make sure you escape the user given variables
-
nml375
- Revered One
- Posts: 2860
- Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 »
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
-
Fire-Fox
- Master
- Posts: 299
- Joined: Sat Sep 23, 2006 9:01 pm
- Location: /dev/null
Post
by Fire-Fox »
Thanks nml375

Did it like this :
Code: Select all
#Url
set sqlsiteurl "SELECT COUNT(DISTINCT(siteurl)) FROM pred"
set siteurl [mysqlsel $mysql_(handle) $sqlsiteurl -flatlist]
and returned 715 urls
