Jump to content
Larry Ullman's Book Forums

Chapter 12 Access Denied


Recommended Posts

The book mentions that this could happen but doesn't offer any advice.

 

 

Successfully connected to MySQL!

Could not create database because:Access denied for user 'cjbergin'@'10.%' to database 'myblog'

Could not select database because:Access denied for user 'cjbergin'@'10.%' to database 'myblog'

 

 

 

 

 

I seem to be able to manually create databases if I access MySQL from the control panel of the hosting site. When I attempted to manually create 'myblog', I was greeted with a MySQL message indicating that it was already created but yet I don't see it existing in the GUI .

Link to comment
Share on other sites

since I'm already discussing Chapter 12, I'll throw this out there. What would be the English translation of this statement?

 

if ($r = mysql_query($query, $dbc))

 

It's obviously not a comparison because the statement doesn't include "==" operator.

 

Also, in the following statement, does the variable $row only hold one record at a time?

 

$row= mysql_fetch_array($r);

Link to comment
Share on other sites

I seem to be able to manually create databases if I access MySQL from the control panel of the hosting site. When I attempted to manually create 'myblog', I was greeted with a MySQL message indicating that it was already created but yet I don't see it existing in the GUI .

 

If you're using a hosted site, you almost certainly don't have a database user that has permissions to create new databases via a PHP script. If the hosting panel says the site was created but you don't see it, you'll need to talk to them about it.

 

since I'm already discussing Chapter 12, I'll throw this out there. What would be the English translation of this statement?

 

if ($r = mysql_query($query, $dbc))

 

It's obviously not a comparison because the statement doesn't include "==" operator.

 

Right. The conditional is a bit trickier because it both executes a statement and then evaluates the condition. First the mysql_query() function is called, assigning the result to $r.

 

If the results of the execution are good, then the conditional will be true. This is equivalent to just:

 

$r = mysql_query($query, $dbc);

if ($r) {

 

Also, in the following statement, does the variable $row only hold one record at a time?

 

$row= mysql_fetch_array($r);

 

Yes, exactly.

Link to comment
Share on other sites

 Share

×
×
  • Create New...