I've just put some php code in a region and now I can't update anything on my site!!!!

HELP!

I can't even change the theme of my site, and don't know what to do.

Any advice would be most helpful.

I'm told that using phpMyAdmin, I need to load up my database, browse the blocks table, find the problem block, and change the status field to a zero. That sounds straightforward enough, but I don't tknow how to identify the problem block.

Any suggestions?

phpMyAdmin is something I rarely use, although I have been able to browse blocks from the list of tables in the database. Unfortunately I'm not sure what I'm looking for. There are around 20 records with status set to one. How do I identify the one which needs changing?

Comments

arh1’s picture

just to be sure, when you say you "put some php code in a region", do you mean you added php code to the body of a block?

assuming so, then yes, you'll need to edit the offending record in your database by hand. phpMyAdmin should make the task pretty simple -- just look for the block with the title you gave it. i think that setting the status of that block to 0 should get your site back online, and then you can fix the problem code.

jpolt’s picture

You're right - I added php code to the body of a block and now am unable to update any part of my website.

Could you just explain, as simply as possible, how I can identify which block it is, using phpMyAdmin?

I'm not particularly familiar with phpMyAdmin, but have it installed and have selected my Drupal database, which lists all the included tables. This is where I'm not sure what to do...

I select 'blocks' from the left hand frame and then click 'browse' from the main frame and this lists 30 records, but I can't identify which any of them are. Nothing appears under 'title'.

Can I change the them using phpMyAdmin? I'm using a theme which is still in development, so may have hit a bug.

arh1’s picture

yeah, it's not entirely clear looking at the db, is it? (i hadn't had to manually edit block data in a long time...)

basically, the blocks table has the properties for every block, w/ "additional data" (e.g. the body content of custom blocks you create) in the boxes table. the delta column in the blocks table will correspond to the bid column in the boxes table.

so, first find the blocks record. you don't have the benefit of looking at the links at /admin/build/block , so you may have to dig a bit. if it's a custom block you created, look for the title (should be the rightmost column). also, i believe the module column should have a value of 'block'.

or, it actually might be easier to start w/ the boxes table itself. if you don't have too many blocks defined, you should be able to find it there pretty easily by just looking for the problematic php code in the body column.

once you find the offending record, you can edit the boxes record to edit/remove the body column, or (i assume, as you mentioned above) edit the blocks record to set the status to 0.

btw, the Drupal Book can be an excellent resource for this type of thing (gives a unified narrative, which i find to be priceless). you might consider picking up a copy.

hope that helps.