Jump to content

villeit

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Everything posted by villeit

  1. ok I solved it now with serialization. Its not ideal, but at least it works! // Serialize $serializedhits = serialize($hits); session_start(); header("Cache-control: private"); //IE 6 Fix $_SESSION['hitsarray'] = $serializedhits; // Save hits into session // Unserialize $hits = $_SESSION['hitsarray']; // Person array from Session $hitsFromSess = unserialize($hits); unset($_SESSION['hitsarray']); // Delete session variable Its a bit of shame that you can´t store objects straight into a session even if you have the session.auto_start = 1 in php.ini Or maybe its just me having this problem
  2. Ok, the reason I am putting an array of hits into a session is that I can easily delete after I have displayed a hitlist to the user. From that hitlist user is able to select a row for deletion. When the page is posted for deletion, I will retrieve the array from the Session and delete the expected index. // Check that the search form has been submitted if (isset($_POST['search'])) { // After user has clicked submit $firstName = $_POST['fnamn']; $lastName = $_POST['enamn']; // Create a query object $query = new Query($firstName, $lastName); $bl = new BL(); // Returns an array of person $hits = $bl->FindPerson($query); if(count($hits) < 1){ echo "<p>Tyvärr, inga träffar på din sökning.</p><br>"; }else{ SaveToSession($hits); DisplayResults($hits); } } // Check that the erase form has been submitted if (isset($_POST['erase'])) { // Get index to delete $index = $_POST['radiobutton']; // retrieve persons from session $hits = $_SESSION['hitsArray']; $bl = new BL(); // Pass person for deletion $result = $bl->ErasePerson($hits[$index]); // Erase the selected person echo "Deletion happened: " . $result; }
  3. The "$hits" variable is an array of MyObject. So I am essentially inserting the whole array of objects into the Session variable.. . function SaveToSession($hits){ session_start(); header("Cache-control: private"); //IE 6 Fix require_once("tiers/Person.php"); session_register('hitsArray'); $_SESSION['hitsArray'] = $hits; // Save hits into session }
  4. Hi all, I am getting really frustrated with storing and retreiving objects from a session. But it may be because of my lack of knowledge in sessions First some system specs: OS - Vista Home 32bit Webserver - IIS 7 PHP - PHP 5.2.11 php.ini session.auto_start = 1 So, when I decide to store an object array in the session, it works just fine. I can also retrieve it from the session but with an extra attribute mentioning: "__PHP_Incomplete_Class_Name" with the value of the Object Name. Code when I try to retrieve object from session: $hits = $_SESSION['hitsArray']; // Array of MyObject AMethodThatDoesSomething($hits[0]); // Requires MyObject Type And this is where it fails: I get following information in the debugger: __PHP_Incomplete_Class_Name | MyObject Attribute 1 | A value Attribute 2 | Another Value ....And so on.... Ok, so I did some research and found out objects do not work if you have "session.auto_start = 1" in php.ini AND that you need to add following line above your session_start(): require_once("MyObject.php"); session_start(); header("Cache-control: private"); session_register('hitsArray'); // Array of MyObject $_SESSION['hitsArray'] = $hits; // Store into session So, I changed "session.auto_start = 0" in php.ini and added the required line above. Well then it didn't even store my object array in the session in the first place! Now I feel that I am stumbling in the dark and hope for someone to be able to help me in my ordeal!
  5. Hi, I have just recently started to play around with JQuery (Version 1.3.2) but I am stuck. I have three images that I that links to three unique DIV tags with text. When I load the page, I want the content of the three different sections of text to be displayed on the same area (Below the images) depending on what the user has clicked. So I thought that it should be easily done using Z-Index to have each DIV tag in their specific index (So they overlap, but only one is visible at a time) and use the toggle() method in jquery to display the expected div tag and hide the others. But it doesn't seem to work. Is this a good way of approaching my problem? Or is there any other (easier) way of to achieve this? Grateful for any help!
  6. Thanks. The video clarified a couple of things for me and I got it working. But the main reason was that in Windows, you have to add the absolute paths to the ROOT directory and the CAKE_CORE_INCLUDE_PATH. So the correct way to point these where (in my case): if (!defined('ROOT')) { define('ROOT', 'C:'.DS.'Program Files'.DS.'Apache Software Foundation'.DS.'Apache2.2'.DS.'htdocs'); } /** * The actual directory name for the "app". */ if (!defined('APP_DIR')) { define('APP_DIR', 'Posts'); } /** * The absolute path to the "cake" directory, WITHOUT a trailing DS. */ if (!defined('CAKE_CORE_INCLUDE_PATH')) { define('CAKE_CORE_INCLUDE_PATH', 'C:'.DS.'Program Files'.DS.'Apache Software Foundation'.DS.'Apache2.2'.DS.'htdocs'.DS.'cakeroot'); }
  7. Hi, I am completely new to CakePHP and I have just finished the first tutorial of building the Blog website. It worked well under my CakePHP installation, however I realised that having this structure means I need a Cake framework for each app. Not so good on my dev machine. So I decided I am going to configure my standard CakePHP installation so I can use the same framework for multiple Cake applications. My current structure is as follows: /htdocs (My Apache DocumentRoot) /cakeroot (contains the CakePHP installation) /app /cake /vendors /Website1 (Not using Cake) /Blog (a renamed copy of the /app directory) /config /controllers /locale /models /plugins /tests /tmp /vendors /views /webroot So if I understand things correctly, I am supposed to configure the 3 sections in /Blog/webroot/index.php as to get the application running from another directory path. Below is my configuration in this file: // The full path to the directory which holds "app", WITHOUT a trailing DS. if (!defined('ROOT')) { define('ROOT', 'htdocs'); } //The actual directory name for the "app". if (!defined('APP_DIR')) { define('APP_DIR', 'Blog'); } //The absolute path to the "cake" directory, WITHOUT a trailing DS. if (!defined('CAKE_CORE_INCLUDE_PATH')) { define('CAKE_CORE_INCLUDE_PATH', 'htdocs'.DS.'cakeroot'); } But my problem is that when I try to access "http://localhost/Blog" I get a blank page! The current /cakeroot/app directory contains the same application as the Blog directory and that one works fine on my browser as "http://localhost/cakeroot" (I configured the routing to make the URL neater) What am I missing? ???
  8. Thanks, I had to delete the files that I manually added to the ext directory in the first place. Then I added all the PHP extras as you described. But then I had some hickups with Apache. After going through some error logs and testing changes in httpd-conf I could not get Apache to restart, then my computer crashed (bluescreen). Started it up and voila! Its all up and running! Random random but its working for now at least
  9. Hi roopurt, I checked the phpinfo() and the Loaded Configuration File is in the same directory: "C:\Program Files\PHP\php.ini" And I agree its a bit strange that it did not create the extension directory the when I installed PHP. I have been thinking as another option to install PHP5.3 as it has been recently released. One of the changes is apparently that the configuration file defaults with the MySQL settings and you should be ready to go straight away. Does anyone know how hard it is to upgrade from 5.2 to 5.3? (Keep in mind, I am complete rookie in this stuff ) I really want a simple stock standard configuration at this stage (with MySQL capability). Or perhaps its easier to delete the previous installation and install 5.3? Thanks, Ville
  10. Hi, I am a recent convert from Microsoft to the Opensource community, so please bear with me. (Oh this is my first post in this forum ) First some stats about my setup: OS: Windows Vista 32 Bit PHP: Version 5.2.9-2 Database: MySQL 5.1.35-win32 Trying to install: PHPMyAdmin3.2.0 Webserver: Apache 2.2.11 I have already developed a (basic) PHP website and I can call the phpinfo() to see all the information about my PHP installation so I believe the webserver and PHP installation seems to be up and running correctly. The Database msi file was fine to install and configure. I used the "developer" configuration from the installation wizard. But as I understand, MySQL does not provide a Client application for managing your databases. Anyways, I found this application called phpMyAdmin which seems to do the job. In the php.ini I have added following lines to ensure the MySQL extensions are utilised: Under section "Paths and Directories": extension_dir ="C:\Program Files\PHP\ext" I had to manually create the ext directory as it was not there from the original installation. Under section "Dynamic Extensions": extension=php_msqli.dll I downloaded the above php_msqli.dll and libmysql.dll from here and dropped them in the ext directory of my PHP installation. I configured the file config.inc.php in the root directory of MyPHPAdmin. Here is an excerpt from that: <?php /* * Generated configuration file * Generated by: phpMyAdmin 3.2.0 setup script by Piotr Przybylski <piotrprz@gmail.com> * Date: Tue, 30 Jun 2009 09:41:20 +0000 */ /* Servers configuration */ $i=0; /* Server: My local dev machine [1] */ $i++; $cfg['Servers'][$i]['verbose'] = 'My local dev machine'; $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['port'] = ''; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'xxxxxxx'; $cfg['Servers'][$i]['ssl'] = false; $cfg['Servers'][$i]['SignonURL'] = 'scripts/signon.php'; /* End of servers configuration */ $cfg['blowfish_secret'] = '4a49d8a327d8e5.15294135'; $cfg['ShowPhpInfo'] = true; $cfg['SQLQuery'] = array ( 'Validate' => true, ); $cfg['Export'] = array ( 'charset' => 'utf-8', ); $cfg['UploadDir'] = ''; $cfg['SaveDir'] = ''; $cfg['GZipDump'] = false; $cfg['BZipDump'] = false; $cfg['ZipDump'] = false; $cfg['ForceSSL'] = false; $cfg['DefaultLang'] = 'en-utf-8'; $cfg['ServerDefault'] = 1; ?> So to my problem: When I try to load the phpMyAdmin locally on my browswer I get the following error: "phpMyAdmin - Error Cannot load mysqli extension. Please check your PHP configuration. - Documentation". I am thankful for any suggestions! // Ville
×
×
  • 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.