PHP won’t connect to my existing MySQL databases
-
Hi.
I am using the Exec-PHP plugin. When I try some simple php code in either a post or a page I get good output. However, when I try connecting to an existing mysql database I get an error message.
Here’s the code I put in:
============ snip ===========
<?php
$user=”me”;
$password=”you_knoe”;
$database=”testData”;
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( “Unable to select database”);
$query=”SELECT * FROM Stuff ORDER BY day ASC, time ASC, city ASC”;
$result=mysql_query($query);
mysql_close();
?>
============ snip ===========Here’s the error message:
============ snip ===========
WordPress database error: [Table ‘Stuff.wp_comments’ doesn’t exist]
SELECT * FROM wp_comments WHERE comment_post_ID = ’28’ AND (comment_approved = ‘1’ OR ( user_id = ‘1’ AND comment_approved = ‘0’ ) ) ORDER BY comment_date
============ snip ===========Is there a way I can access the data I have in mysql, or do I maybe have to create new databases inside wordpress?
Ray
- The topic ‘PHP won’t connect to my existing MySQL databases’ is closed to new replies.