Jump to content

littlevisuals

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Everything posted by littlevisuals

  1. Hi everyone, I have a database with the looks like the following; I have created the model below <?php /** * Description of gallery * * @author lv */ class Model_DbTable_Artist extends Zend_Db_Table_Abstract { protected $_name = 'artist'; } class Model_DbTable_Image extends Zend_Db_Table_Abstract { protected $_name = 'image'; } class Model_DbTable_Category extends Zend_Db_Table_Abstract { protected $_name = 'category'; protected $_referenceMap = array( 'ArtistCategory' => array( 'columns' => 'artist_id' , 'category_id', 'refTableClass' => 'Artist', 'Category', 'refColumns' => 'artist_id' , 'category_id', ), 'ImageCategory' => array( 'columns' => 'image_id' , 'category_id', 'refTableClass' => 'Category', 'Image', 'refColumns' => 'image_id' , 'category_id', ), 'Artist' => array( 'columns' => 'artist_id', 'refTableClass' => 'Image', 'refColumns' => 'image_id' ) ); } Is the right way to join tables in zend???
  2. Hi everyone im am currently getting the following error my layout is like this -views/ /scripts /artists /index.phtml /index /index.phtml In the IndexController I have used the same code in the ArtistsController. The path index/index works perfectly but the artists/index throws the error code. Here is the Controller <?php /** * Description of ArtistsController * * @author */ class ArtistsController extends Zend_Controller_Action { /** * accessing our session variable * @var Zend_Session_Namespace */ protected $session; public function preDispatch() { $this->session = new Zend_Session_Namespace('Default'); } public function loadModel($class, $module = null) { $modelDir = $this->getFrontController()->getModuleDirectory($module) . DIRECTORY_SEPARATOR . 'models'; Zend_Loader::loadClass($class, $modelDir); // if we got here - then file is included return $class; } public function init() { $uri = $this->_request->getPathInfo(); $activeNav = $this->view->navigation()->findByUri($uri); $activeNav->active = true; $activeNav->setClass("active"); } public function indexAction() { } It says line 40 is here public function init() { $uri = $this->_request->getPathInfo(); $activeNav = $this->view->navigation()->findByUri($uri); $activeNav->active = true; $activeNav->setClass("active"); } Which calls the navigation.xml file. It works in the IndexController but not the ArtistsController? Can anybody explain what im doing wrong? many thanks!
  3. I made the mistake of jumping straight into Zend without a good knowledge of OOP and frameworks in general. Needless to say ive been stressed out getting to grips. In the end I found the ZendCasts website very helpful. I started from the beginning and by writing out the code alongside the videos I quickly picked up the basics.
  4. Hi guys, Hope someone could answer my question. I want to list some details of rooms on Tinychat.com on a webpage. It gives instructions on the developers api section which is just a few lines of code... http://tinychat.com/devapi.html How would I intergrate in into a php webpage?
  5. After many hours Ive solved the problem. If anyone wants to know here is the solution. The 403 errors have to do with permissions , which threw me off the ball a bit. The actual issue was with the .htaccess file having the rewriteEngine on , which went back to apache and 403'd. I had this in my config <Directory "/Users/username/Sites/mywebsite/public"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory> By changing AllowOverride None to AllowOverride All I got the 403 so I added the line Options +Indexes +FollowSymLinks +ExecCGI and low and behold it worked. Its a tricky one as the errors threw me on a wild goose chase. Anyways the final code looked like this <Directory "/Users/username/Sites/mywebsite/public"> Options Indexes MultiViews Options +Indexes +FollowSymLinks +ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> Hope this can save someone the time I wasted in future!
  6. Hi, having a real problem here with Apache. I have activated it locally and works fine, but when I set up a Virtual Host it gives me a 403 forbidden error? Im using Mac OS X with the zend framework. I know its got to do with permissions but i've changed them all using the wonderful 'BatChmod' application. It used to give a 500 error when I typed something random to see if it saw the file. Now all I get is the 403 forbidden error? Any thoughts?
  7. Hi everyone, I was wondering if anyone could be kind enough to help me out with this problem please. Basically im using the zend framework and the project is located in my sites folder. (Mac OS X) I have apache and set up a virtual server for http://mysite which directs to the project. When I type http://mysite it directs to the public/index/ folder. I have other pages added, page1.phtml + page2.phtml with the IndexController looking like this <?php class IndexController extends Zend_Controller_Action { public function indexAction() { } public function page1Action() { } public function page2Action() { } } ?> I know everything goes through index.php and the page are accessed by typing http://mysite/index/page1 , but when I type http://mysite/page1 I get a 404 error outside of my app?! If I type some random url after the index e.g http://mysite.com/index/ejkhfjkewhjk I get an error inside my application ( im using layout.phtml as well ) So my host file has been set up with a virtual server pointing to the directory of my app, apache rewrite on in my httpd.conf and a .htaccess file with RewriteEngine on RewriteRule !\.(js|ico|gif|jpg|png|css|pdf|mov|mp3)$ index.php What am I doing wrong?
  8. Ok, im learning zend, can install it just swell Only I have been knocked down by many things 1. Got the Zend Framework in Action book to find out its basically useless with the new version of the framework 2. Learning through videos http://www.zendcasts.com and found that these are no good with the new framework as im always getting raped by incompatabilty issues here is an example Notice: Zend_Loader::Zend_Loader::registerAutoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead 3. Followed basic CRUD tutorials which do the same as (2) but i just want to complete one without learning one thing and then realising its wrong. Im afraid and every time I follow a simple tutorial, I die a little inside... Every person who has a guide does it so differently I get nowhere. So I ask if anyone who is a Zend Veteran if they could give me any advice, pitfalls and where to start with this framework. I would really appreciate it ! Thanks in advance
  9. Here is my lazy reply http://www.sitepoint.com/examples/rounded_images/
  10. Sorry I realised that straight after posting. Ran the script and works like a dream! Thankyou once again your time and effort.
  11. Hi MadTechie, Have tried the following and I get Parse error: syntax error, unexpected '}' in /Library/WebServer/Documents/checkbox.php on line 14 <?php include("connect.php"); mysql_select_db("work"); $cat_ID = $_POST['cat_id']; $image_ID = $_POST['image_id']; $result = mysql_query("SELECT cat_ID FROM categories"); $result = mysql_query("SELECT image_ID FROM categories"); foreach($_POST['cat_id'] as $cat_ID) { $query = "INSERT INTO image_catlu (cat_ID, image_ID) VALUES ('$cat_ID', '$image_ID')"; $results = mysql_query($query) } $results = mysql_query($query) or die ("Could not execute query : $query." . mysql_error()); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>CHECKBOX</title> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"> <table> <tr> </tr> <?php $sql = "SELECT id,cat FROM categories ORDER by id ASC"; "SELECT id,id FROM gallery"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); while(list($id,$cat)=mysql_fetch_row($result)){ echo '<tr><td>'.$cat.'</td><td><input type="checkbox" name="cat_id[]" value="'.$id.'" '.$image_ID.'/></td></tr>'."\n"; } ?> <tr><td colspan="2"><input type="submit" name="submit" value="add" /></td></tr> </table> </form> </body> </html>
  12. Thankyou for the reply, this is a snippet of the whole script it belongs to. The rest of the form is for uploading an image then adding details like title, description etc and I wanted to have multiple categories with them The image_ID will be a value when the rest of the form is processed so in image_catlu I have something like this cat_ID Image_ID 5 107 6 107 5 108 Then the image can have multiple cats. Im just going to make the changes you have posted
  13. Hi guys, I seem to be doing something wrong. At current the script inserts a checked category number into the table images_catlu into the cat_ID field and the image_ID field. How do I modyfy it to insert multiple checked data into the table? Not in the same field, but multiple rows of all the checked data Here is the code <?php include("connect.php"); mysql_select_db("work"); $cat_ID = $_POST['cat_id']; $image_ID = $_POST['image_id']; $result = mysql_query("SELECT cat_ID FROM categories"); $result = mysql_query("SELECT image_ID FROM categories"); $query = "INSERT INTO image_catlu (cat_ID, image_ID) VALUES ('$cat_ID', '$image_ID')"; <?php if (isset($_POST['cat_id', 'image_id'])) { $categories = ""; for ($i=0; $i < count($_POST['cat_id']); $i++) { $categories = $categories . $_POST['cat_id'][$i] . " "; } $results = mysql_query($query) or die ("Could not execute query : $query." . mysql_error()); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>CHECKBOX</title> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"> <table> <tr> </tr> <?php $sql = "SELECT id,cat FROM catorgories ORDER by id ASC"; "SELECT id,id FROM gallery"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); while(list($id,$cat)=mysql_fetch_row($result)){ echo '<tr><td>'.$cat.'</td><td><input type="checkbox" name="cat_id" value="'.$id.'" '.$image_ID.'/></td></tr>'."\n"; } ?> <tr><td colspan="2"><input type="submit" name="submit" value="add" /></td></tr> </table> </form> </body> </html>
  14. I followed this tutorial online http://www.itnewb.com/v/Comprehensive-Guide-to-PHP-MySQL-Tag-Clouds-Includes-Demo/page4 I couldn't understand where $articlestags even fits into it Im going to modify it into my cms im making but thought id see if it works first.
  15. Sure, here is the code I have <?php foreach ( $articleTags as $tag ) { $resultID = @mysql_query("SELECT tag_id FROM articles_tags WHERE tag_name='$tag'") or outputMessage( "SELECT FROM articles_tags failed: " . @mysql_error($linkID) ); if ( $row = mysql_fetch_array($resultID, MYSQL_ASSOC) ) { $tagID = $row['tag_id']; @mysql_query("UPDATE articles_tags SET num_articles=num_articles+1 WHERE tag_id=$tagID") or outputMessage( "UPDATE articles_tags failed: " . @mysql_error($linkID) ); } else { @mysql_query("INSERT INTO articles_tags(tag_name) VALUES ('$tag')") or outputMessage( "INSERT INTO articles_tags failed: " . @mysql_error($linkID) ); $tagID = @mysql_insert_id() or outputMessage( "mysql_insert_id() failed: " . @mysql_error($linkID) ); } @mysql_query("INSERT INTO articles_tagged (tag_id, article_id) VALUES ($tagID, $articleID)") or outputMessage( "INSERT INTO articles_tagged failed: " . @mysql_error($linkID) ); } ?>
  16. Hi everyone Trying to add tags to a script so i've found a script online. However every time I run the script I get the error Warning: Invalid argument supplied for foreach() in /Library/WebServer/Documents/tags.php on line 2 Can anybody tell me what this means? Im using PHP Version 5.2.5, MySQL 5.1.35 via socket
  17. Hi, is there anyone who could help me? Ive been stuck for two days on this and cannot for the life of me figure it out :-\ Im not sure if im even going about it the right way. I have an image upload form for every picture with name, artist, about etc, and want to include mulitple checkboxes of the different catergories to associate with the picture ( kinda like tags because the catergories are dynamically generated by the admin) Ex table which cat data gets pulled from id cat 1 Abstract 2 Figurative 3 Landscapes I know there prob needs to be a few tables but most of the checkbox questions on the web are from non-dynamic forms, thus making it hard to find a solution
  18. sorry here is the code: <?php include("connect.php"); mysql_select_db("artists"); $cat_ID = $_POST['cat_id']; $image_ID = $_POST['image_id']; $result = mysql_query("SELECT cat_ID FROM catorgories"); $result = mysql_query("SELECT image_ID FROM catorgories"); $query = "INSERT INTO image_catlu (cat_ID, image_ID) VALUES ('$cat_ID', '$image_ID')"; $results = mysql_query($query) or die ("Could not execute query : $query." . mysql_error()); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>CHECKBOX</title> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"> <table> <tr> </tr> <?php $sql = "SELECT id,cat FROM catorgories ORDER by id ASC"; "SELECT id,id FROM gallery"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); while(list($id,$cat)=mysql_fetch_row($result)){ echo '<tr><td>'.$cat.'</td><td><input type="checkbox" name="cat_id" value="'.$id.'" '.$image_ID.'/></td></tr>'."\n"; } ?> <tr><td colspan="2"><input type="submit" name="submit" value="add" /></td></tr> </table> </form> </body> </html>
  19. Hi all, Im really stuck on using checkboxes and ill be happy if someone could help me on the issue. I have 3 tables Catorgories (spelt wrong I know!) id cat 1 Abstract 2 Figurative 3 Landscapes 4 Local Artists 5 Marine 6 Naive Contemporary 7 Originals 8 Still Life Gallery id artist location heading 123 vangough holland famous_painter image_catlu (where the id FROM gallery should go, and the id FROM cat) cat_ID image_ID 2 0 2 0 7 0 7 0 The idea is to fetch the different types of catergories and echo as checkboxes for the user to tick. This is part of a form where a user will upload a picture entering details into gallery table, and each pic will be associated with multiple catergories. Hence the 2 other tables. However im stuck because muliple checkboxes can be selected but only 1 gets put into image_catlu and as you can see the image's id in gallery just gets a big fat 0. What it need to do is enter muliple catergories in image_catlu with the image ID in gallery which is in the same script?! Sorry if thats confusing :-\
  20. Found the issue my code connected to the database, but selecting the table is done when inserting the data using the query $query = "INSERT INTO DATA to $query = "INSERT INTO cat Maybe I was too quick to jump to the forum
  21. Hi everyone, Just a quick question if I may, I have a db 'DATA' and 6 or so tables named 'DATA' 'cat' 'images' 'user_id' . Now ive made a form which inserts information fine in 'DATA' when I use include("../connect.php"); mysql_connect("localhost","root","password"); mysql_select_db("DATA"); Now im trying to insert data on other tables 'cat' for example and use the same query but does mySQL go through all the tables looking for that field in a db, or because I have a table called the same as the db 'DATA' it finds that but not 'cat' My other question is in my above code do I need to select_db and a table, if so any ideas as how I could? Many thanks edit: the main error I get is Unknown column 'location' in 'field list', which is clearly located in a table...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.