So I want to pull a random record off my DB:
mysql_connect("127.0.0.1","my_shop","xxxxxx");
mysql_select_db("my_shop_db");
error_reporting(E_ALL && ~E_NOTICE);
$random_record = "SELECT * FROM products ORDER BY RAND() LIMIT 1";
$random_product = mysql_query($random_record) or die ($random_record);
echo $random_product['id'];
What I tried so far:
- DB Connection works 100%
- Tables exist, have exact wordings and contain data
- DB User has rights to pull Data
What is wrong with my script?