The secret here is that mysql_query is happy to take in a CREATE statement. It even
does what you asked, which is why the second time you entered that query, MySQL
gave you an error, saying that the urls table was already created. When mysql_query
gets a CREATE statement, it returns false if there was an error—which your script
handles—but true if there’s not an error. And if there’s not an error, it doesn’t return
any rows. You get a true value in $result, but nothing else. And that’s where things
went wrong