PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
This buggered me an hour last night, maybe someone can tell me what I'm doing wrong. The query fails, with no error. I am connecting properly I believe. This is uber simple so what the heck am I doing wrong. I took the query from phpmyadmin where it returns results properly. This has to be something really simple, but since Im relatively new to php/mySQL I expect to be schooled quickly. Thanks.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
// mysql_connect() returns a MySQL resource
$dbhandle = mysql_connect('localhost', 'root', 'password');
// mysql_select_db() returns a boolean (true or false)
$link = mysql_select_db('exp', $dbhandle);
// $link is not a MySQL resource
$result = mysql_query($query, $link);
$query = "SELECT * FROM uidhistory WHERE UID = '1' LIMIT 0, 30"; //No weird wonky single quotes around fieldnames/table names for a start
+1 about the " usage
-1 about "//No weird wonky single quotes around fieldnames/table names for a start"
the "weird wonky single quotes" are called "backtikcs" and have an important meaning/usage that could save you a lot of headaches sooner or later (and you know the Murphy's laws already ) if you are not very consistent and careful with your choice of table/column names... and even if you are, nobody can prevent that MYSQL new version add more reserved words to the existent ones. http://dev.mysql.com/doc/refman/5.1/en/ ... words.html