Mark's Tech Stuff


Sunday, November 01, 2009

Zencart Configuration and Email Options or Transport Not Showing

I thought I'd post this, since it just took up the last few hours of my day trying to figure it out.

The problem was that in my zencart installation on a windows machine I was getting nothing displayed when I clicked on any of the options in the configuration section of the admin panel.

Eventually, I found a fix at the strangest of places. I found the following line in "admin\configuration.php"

$configuration = $db->Execute("select configuration_id, configuration_title, configuration_value, configuration_key,
use_function from " . TABLE_CONFIGURATION . "
where configuration_group_id = '" . (int)$gID . "'
order by sort_order");

Then changed it to:

$configuration = $db->Execute("select configuration_id, configuration_title, configuration_value, configuration_key,
use_function from " . TABLE_CONFIGURATION . "
where trim(configuration_group_id) = '" . (int)$gID . "'
order by sort_order");


As you may notice, I used a trim function on the trim(configuration_group_id) then everything worked fine.
It seems that the mysql version that I am using might not be the smoothest to use for zencart, but all is working for now. So I will see how things go.



Labels: , ,

Saturday, October 31, 2009

Chmod 644 in Windows For Zencart

If you're getting the warning "I am able to write to the configuration file" ... "configure.php" in Zencart in Windows and are unsure about how to chmod in windows.

Relax, all you need to do is set the file to read only.



Labels: , ,

Zencart 1064 TYPE=MyISAM Problem

If you're getting the following error when trying to install Zencart:

"1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 1"

It is likely that you are trying to install on a relatively old MySQL version. To get around this problem:

1) find and open the file "zc_install\sql\mysql_zencart.sql"

2) Replace all instances of "TYPE=MyISAM" with "ENGINE=MyISAM"


That should help solve the problem.


Labels: ,

How to run PHP in a Tomcat server instance

One of the very few tutorials that actually works, thanks to the blog pointing to both a download for PHP and PECL libraries that match each other:

How to Run PHP 5.x with Apache Tomcat 4.x or Apache Tomcat 5.x @ AurosBlog


Labels: , ,

Friday, October 30, 2009

Updating a table in SQL where records in table A don't exist in table B.

I find myself doing this a lot recently, so I'm posting it here too. Hopefully it is SQL92 and should run on just about anything.


1. Updating a table in SQL where records in table A don't exist in table B:

insert into tableB (field1, field2, field3)
select f1 as field1, f2 as field2, f3 as field3
from tableA A
WHERE
A.f1 like '%bleh%'
and not exists(SELECT * FROM tableB WHERE f1=A.f1 and f2=A.f2);



2. Hey, and why not do something silly like have a union query and some limit in the mix (limit works in MySQL only):

insert into tableB (field1, field2, field3)
select field1, field2, field3 from
(select f1 as field1, f2 as field2, f3 as field3
from tableA A
WHERE
A.f1 like 'bleh'
and not exists(SELECT * FROM tableB WHERE f1=A.f1 and f2=A.f2)
limit 10) A1
union
select field1, field2, field3 from
(select f1 as field1, f2 as field2, f3 as field3
from tableA A
WHERE
A.f1 not like 'bleh'
and not exists(SELECT * FROM tableB WHERE f1=A.f1 and f2=A.f2)
limit 10) A2;

Labels: , , , , ,

Wednesday, October 14, 2009

MySQL: Updating from the same table

You might ask 'why' I am doing this, but that's not the point. To update a field in a table in mysql, from the same table (which MySQL disallows):

UPDATE mytable
set myvalue = myvalue+(select myvalue FROM (select myvalue from mytable where year='2008') b )
where
year = 2009


Basically, you have to trick mysql into selecting the subquery from a temporary table; as done above.

Kudos to Peter Geer for the idea for this.

Labels: ,

Saturday, September 19, 2009

MySQL, Insert Statement "ERROR 1064 (42000): You have an error in your SQL syntax"

So, I got the error "ERROR 1064 (42000): You have an error in your SQL syntax" when trying to execute a similar insert statement to:

INSERT INTO sections (code, desc) VALUES('123','example of a description');

It was due to the 'desc' field being a reserved word. If you're getting a similar error, make sure that your field names are not using any reserved words in MySQL. Although, yes it is kind of strange that MySQL would allow you to create fields based on reserved words to begin with. To solve my problem, I used:

INSERT INTO sections (code, description) VALUES('123','example of a description');



Labels: ,

Testing XSLT Transformations

A neat and very simple tool for testing XSLT transformations:

http://www.codeproject.com/KB/XML/XSLT_Tester.aspx

Labels: ,

Monday, June 15, 2009

VBA Unicode Done Right

Nice post on using Chinese characters in VBA:

http://teaandbiscuits.org.uk/drupal/node/69



Labels: , ,

Monday, May 18, 2009

New Menu Not Showing in Joomla

So you made a menu in Joomla 1.5 and it didn't show on your front page?

Don't forget to go to 'extensions' -> 'module manager' and enable the menu there.


Labels: , ,