Mem- wrote:I just dont understand how the email one works. Does it work like a table and the first column is just an integer that goes up by int+1. Where the second row is the email address is that correct?
Well, if I got your question right, then yes. We'll have something like
- Code: Select all
ID email
1 john@exampleDOTcom
2 mary@exampleDOTnet
3 iamthethirduser@trollDOTorg
4 etc@hackthissiteDOTorg
in this case, let's suppose id is an unsigned int and email is a string (VARCHAR(255)) for example.
also assume that we have another table:
- Code: Select all
email name
john@exampleDOTcom John Doe
iamthethirduser@trollDOTorg Fuckin' Idiot
mary@exampleDOTnet Mary Poppins
etc@hackthissiteDOTorg Every Body
(sorry about DOTting, the parser complained about 'URLs')
In this case, for example, if you say SELECT * FROM email WHERE ID=2 UNION SELECT name FROM names WHERE email='etc@hackthissite.org' the query will not execute because the number of columns do not match.
Also, if you "select *" from both tables, the query will still fail due to the coulmn types (UNSIGNED INT vs. String) being different.
if you say SELECT * FROM email WHERE ID=2 UNION SELECT 0,name FROM names WHERE email='etc@hackthissite.org'
your query will execute and you'll get 2 rows:
- Code: Select all
2 mary@example.net
0 Every Body
Keeping in mind that the query won't execute if the number of columns don't match, the number of columns can be found out easily by giving the appropriate garbage to the database. this way the website will display error/not display stuff if the columns count is wrong, otherwise, you'll see your garbage besides the normal result of your select.
I really hope my post is not spoilish...





