completeamateur
-
Posts
69 -
Joined
-
Last visited
Never
Posts posted by completeamateur
-
-
Hi there, my site is working fine locally, but when I upload it to my webspace I get the following error...
http://dev.awayfans.co.uk/user/register
I've tried updating the Zend libraries but no luck. Any suggestions?
Regards.
-
Hi guys,
I'm setting up a database to help control my web site's product catalogue and stock levels.
I'm thinking of having 2 tables, one that describes each product (common information), as well as one that contains possible options (unique information).
I wanted to hear people's suggestions regarding the layout I have come up with...
CREATE TABLE IF NOT EXISTS `products` ( `productID` smallint(6) unsigned NOT NULL auto_increment, `team` text NOT NULL, `description` text NOT NULL, `HA3` tinyint(1) NOT NULL, `gk` tinyint(1) NOT NULL, `start` year(4) NOT NULL, `end` year(4) NOT NULL, PRIMARY KEY (`productID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; CREATE TABLE IF NOT EXISTS `stock` ( `stockID` smallint(5) unsigned NOT NULL auto_increment, `size` tinytext NOT NULL, `price` float NOT NULL, `condition` tinyint(1) NOT NULL, `qty` smallint(3) NOT NULL, `productID` smallint(5) unsigned NOT NULL, PRIMARY KEY (`stockID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
FYI, each product could have up to 50 different options (approx. 10 size variations and 5 condition variations). Is this the best approach or would you approach it differently? It seems a little cumbersome but my brain isn't capable of anything better!
Thanks for your help.
-
I have no finger nails or hair, but after what has felt like several years, I've managed to sort it!!
$sql = $this->select() ->from('category AS node') ->from('category AS parent', '') ->from('category AS sub_parent', '(COUNT(parent.name) - (sub_tree.depth + 1)) AS depth') ->joinInner( array('sub_tree' => $this->select() ->from('category AS node', 'name') ->from('category AS parent', '(COUNT(parent.name) - 1) AS depth') ->where('node.lft BETWEEN parent.lft AND parent.rgt') ->where('node.lft = ' . $lft) ->group('node.name') ->order('node.lft') ), 'sub_parent.name = sub_tree.name', array() ) ->where('node.lft BETWEEN parent.lft AND parent.rgt') ->where('node.lft BETWEEN sub_parent.lft AND sub_parent.rgt') ->group('node.name') ->having('depth = 1') ->order('node.lft');
-
Yup, all sorted... no doubt that will throw another couple of hundred questions within the next 5 mins!! ;-)
Out of interest, what's the default chmod (i.e. not 777)?
Regards.
P.S. Any suggestions re the complex query I posted??
-
Daniel,
I've made the modifications you have suggested and it looks as if we're half way there.
I seem to have some permissions problems as it is throwing the following errors...
Warning: move_uploaded_file(/Library/WebServer/Documents/bbusl/public/upload/catalogue/images/European Cup.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /Library/WebServer/Documents/library/Zend/File/Transfer/Adapter/Http.php on line 102Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/private/var/tmp/phpdDRdh9' to '/Library/WebServer/Documents/bbusl/public/upload/catalogue/images/European Cup.jpg' in /Library/WebServer/Documents/library/Zend/File/Transfer/Adapter/Http.php on line 102
Warning: move_uploaded_file(/Library/WebServer/Documents/bbusl/public/upload/catalogue/images/European Cup.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /Library/WebServer/Documents/library/Zend/File/Transfer/Adapter/Http.php on line 102
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/private/var/tmp/phpdDRdh9' to '/Library/WebServer/Documents/bbusl/public/upload/catalogue/images/European Cup.jpg' in /Library/WebServer/Documents/library/Zend/File/Transfer/Adapter/Http.php on line 102
I'm running Mac OS X, PHP 5.2.5, Apache 2.0. Any suggestions?
Thanks in advance.
-
Yippee!... this has been solved in a different thread!
http://www.phpfreaks.com/forums/index.php/topic,227860.0.html
-
Daniel, that's worked a treat. It was trying to enter it as a string rather than an expression. Thank you so much.
-
It's all running from my local machine so there shouldn't be a problem.
The query is supposed to resemble what is suggested in http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
I'm still not having any joy though. This is my latest (failed) attempt...
$sql = $this->select() ->from('category AS node') ->from('category AS parent') ->from('category AS sub_parent') ->from( array('sub_tree' => $this->select() ->from('category AS node') ->from('category AS parent', '(COUNT(parent.name) - 1) AS depth') ->where('node.lft BETWEEN parent.lft AND parent.rgt') ->where('node.lft = 1') ->group('node.name') ->order('node.lft') ), '(COUNT(parent.name) - (sub_tree.depth + 1)) AS depth' ) ->where('node.lft BETWEEN parent.lft AND parent.rgt') ->where('node.lft BETWEEN sub_parent.lft AND sub_parent.rgt') ->where('sub_parent.name = sub_tree.name') ->group('node.name') ->having('depth = 1') ->order('node.lft');
-
I'm afraid this just returns...
Notice: Undefined property: Catalogue::$update in /Library/WebServer/Documents/bbusl/application/models/Catalogue.php on line 80
Fatal error: Call to a member function __toString() on a non-object in /Library/WebServer/Documents/bbusl/application/models/Catalogue.php on line 80
-
I'm working with ZF so the code I use to generate the query is a little abstract...
$this->update(array('lft'=>'lft + 2'), 'lft > ' . $lft);
I've tried all variations of apostrophes and quotes but to no avail. Interestingly enough, I've found that...
$this->update(array('lft'=>'2'), 'lft > ' . $lft);
...works fine, but...
$this->update(array('lft'=>'lft'), 'lft > ' . $lft);
...doesn't. I presume this is because it is trying to enter the string 'lft'?
-
I've just upgraded from ZF 1.5 -> ZF 1.7 and it now throws a form validation error...
* The file '' could not be found
* The file '' was not found
-
Why is the ZF so baffling? I'm trying to provide a facility to upload files. I have created an element within the form...
$image = new Zend_Form_Element_File('image'); $image->setLabel('Photo') ->setAttrib('enctype', 'multipart/form-data') ->setRequired(false) ->setDestination('/upload/catalogue/images') ->addValidator('Count', false, 1) // ensure only 1 file ->addValidator('Size', false, 1024000) // limit to 1MB ->addValidator('Extension', false, 'jpg,png,gif'); // only JPEG, PNG, and GIFs
...and the controller consists of...
if ($this->_request->isPost()) { $formData = $this->_request->getPost(); Zend_Debug::dump($_FILES); exit;
...but this just returns...
array(0) {
}
i.e. no file is uploaded! I don't understand what I'm doing wrong. Any suggestions?
-
Hi guys,
I'm trying to increment the current value of a column by using an update query.
UPDATE category SET lft = lft + 2 WHERE lft > $lft;
Unfortunately, because I'm using Zend Framework, it interprets 'lft + 2' incorrectly (don't ask me why!). Is there another way to increment the existing value, e.g. lft++
-
Apologies, I'm using Zend Framework 1.5
-
Hi guys,
I'm trying to create a simple query to update some records.
$this->update(array('lft'=>'lft + 2'), 'lft > ' . $lft);
This works fine, except it does not write the correct value in the lft column, it just writes '0', where as it should be 'lft + 2' i.e. the original value + 2. I'm not quite sure what I'm doing wrong.
TIA
-
FYI, the error message I get when trying to run the first query is "Operand should contain 1 column(s)". Strange that it should work fine MYSQL Query Browser.
-
I'm trying to construct a fairly complex query...
I suppose firstly I should point out that I don't understand the difference between inserting the query as a string and constructing it in Zend (although what I would interpret as the same query gives differing ouputs)?
This is the query I'm trying to run;
$sql = ' SELECT node.name, (COUNT(parent.name) - (sub_tree.depth + 1)) AS depth FROM category AS node, category AS parent, category AS sub_parent, ( SELECT node.name, (COUNT(parent.name) - 1) AS depth FROM category AS node, category AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.lft = 1 GROUP BY node.name ORDER BY node.lft )AS sub_tree WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt AND sub_parent.name = sub_tree.name GROUP BY node.name HAVING depth = 1 ORDER BY node.lft'; $result = $this->fetchAll($sql); return $result;
...doesn't work (although I can run the query fine in mysql query browser),
$sub = $this->select() ->from( array('node' => 'category'), array('name', '(COUNT(parent.name) - 1) AS depth') ) ->from( array('parent' => 'category') ) ->where('node.lft BETWEEN parent.lft AND parent.rgt') ->where('node.lft = 1') ->group('node.name') ->order('node.lft'); $sql = $this->select() ->from( array('node' => 'category'), array('name', '(COUNT(parent.name) - (sub_tree.depth + 1)) AS depth') ) ->from( array('parent' => 'category') ) ->from( array('sub_parent' => 'category') ) ->from( array('sub_tree' => new Zend_Db_Expr('(' . $sub . ')')) ) ->where('node.lft BETWEEN parent.lft') ->where('parent.rgt AND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt') ->where('sub_parent.name = sub_tree.name') ->group('node.name') ->having('depth = 1') ->order('node.lft'); $result = $this->fetchAll($sql); return $result;
...doesn't work. I'm a bit stumped.
Any pointers much appreciated.
-
Hi guys,
I'm looking at using a "nested set model" similar to the one described on...
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
I have a table with several columns including a "lft" and a "rgt" (each containing unique values)
My question is, is it possible to search between the lft and rgt values when provided with only the lft value of a row?
Not quite sure that makes sense... TIA
-
-
-
Steam is coming out of my ears...
Does anybody know why the form on my site is rendering so poorly in IE? www.footieclassics.com/contact
Also the navigation list is displaying a bit strangely...
#books li { color:#FF7200; float:left; list-style:lower-roman inside; margin-right:0.4em; }
Thanks.
-
In case anyone stumbles across the same problem, I solved the issue by placing a span around the bullet content (the style of which can be altered separately)...
<ul> <li><span>Bullet Content 1</span></li> </ul>
-
Hi there,
I have been redesigning my websites using the Zend Framework (namely www.footieclassics.com), but have come across a little annoyance.
Using hidden elements in Zend Form seems to generate unwanted <dd>/<dt> tags which then cause some horrible white space. Is there any way to eliminate this?
<dd> <input type="hidden" name="cmd" value="_xclick" id="cmd"> </dd> <dt> </dt>
TIA
-
Hi guys,
I have an ordered list but I want to reduce the distance between the content & the marker...
1. <- This Distance -> Bullet Content 1
2. Bullet Content 2
Can't seem to find a way...
[SOLVED] Problem with Zend_Form_Decorator_FormErrors
in Frameworks
Posted
Simple mistake... I've set up a 'dev' subfolder in my hosting hence the path to the Zend libraries had changed, or at least that seems to have done the trick!