The following code returns two times the same error, even though I would have expected only one: $ conn = mysql_connect ('localhost', 'root', ''); $ conn2 = mysql_connect ('localhost', 'root', ''); mysql_select_db ('db1', $ conn); mysql_select_db ('db2', $ conn2); $ result = mysql_query ("select 1 from dual", $ conn); $ result2 = mysql_query ("select 1 from luad", $ conn2); echo mysql_error ($ conn) "".
The reason for this is that mysql_connect not working as expected a further connection returns.
// you are already connected, you dont need this again // Make a My SQL Connection //mysql_connect("localhost", "dbuser", "dbpass") or die(mysql_error()); //mysql_select_db("versionx_recruit") or die(mysql_error()); // you dont need this here /*$getreport = mysql_query("SELECT ID, Name, Month, Day, Year, Xfire, Steam, status_refer, Referrer, Donate, Division, Reason_Join, Clan_history, Time_Stamp FROM recruit WHERE ID = '$appid'"); */ You also need to look into how to validate and make the user input safe, since your sql's are woundable to sql injection. It's also creating an error when I try and re-run the script.
Have a look at mysql_real_escape_string() (always use this on user input), type casting, sprintf(), filters are some of the things that can be used. (Also, I wasn't sure if I implemented what you meant correctly, so if I didn't feel free to yell at me!!
Since the parameters are equal, a further reference to the previous link is returned.
So also changes the second mysql_select_db the selected DB of $conn to 'db2'. mysql_error()); This will print out something like... Query: SELECT * FROM table Error: (err_no) Bla bla bla, you did everything wrong It's very useful to see your query in order to detect problems with syntax.
Would it make sense to change the examples in the documentation for mysql_query () and for mysql_error () accordingly? I do -not- recomend using this procedure, however, for queries which execute on your site that are not user-specific as it has the potential to leak sensative data.
Instead, the My SQLi or PDO_My SQL extension should be used. There is a bug in either documentation about error_reporting() or in mysql_error() function cause manual for mysql_error(), says: "Errors coming back from the My SQL database backend no longer issue warnings." Which is not true.The script writes a log file in directory ( in this case /log ) as well.The system is vulnerable when database/query information is prompted to visitors.Not very important, but why return more than you need (or something along that line ) Instead of repeating for every cell, have a look at the colgroup tag: can also save a bit of typing/code by using css, it will also make the html a bit more up to date i believe and easier to tweak the styling later on if needed.Thanks for all your help Crowly, I believe it is updating correctly.