Hey, hows it going everyone? I am having database conflicts I was wanting some help with.
Basically, I have a header that pulls in a random database field. Nothing special. It is in my header in my template and works just fine on non WordPress pages.
$sql = "SELECT * FROM headerslogans ORDER BY RAND() LIMIT 1";
$result = mysql_query($sql);
while ($myrow = mysql_fetch_array($result)) {
echo $myrow['slogan'];
};
I am using the same database, same user name, same password, etc. However, I get this error where the echo should be....
Warning: mysql_query() [function.mysql-query]: Access denied for user 'nobody'@'localhost' (using password: NO) in <dir name>
So obviously the wordpress connection is "overwriting" the other (wordpress works flawlessly). BUT, I was also confused as to why it doesn't work, although it is connecting to the same database with same username and password.
Can anybody help me out on this?
UPDATE: Posted connection code
$x = mysql_connect($server,$dbuser,$dbpass,true) or die(mysql_error()); mysql_select_db($dbname,$x);