| View previous topic :: View next topic |
| Author |
Message |
matteoraggi Smarty Rookie
Joined: 02 Jan 2006 Posts: 11 Location: Italy - Forlė - Vecchiazzano
|
Posted: Mon Jan 02, 2006 8:43 am Post subject: error setup |
|
|
On your page,
http://smarty.php.net/sampleapp/sampleapp_p1.php
I click to see the demo(using firefox):
http://www.phpinsider.com/php/code/guestbook/
but I see this error:
Warning: main(DB.php): failed to open stream: No such file or directory in /var/www/www.phpinsider.com/docs/php/code/guestbook/libs/guestbook_setup.php on line 14
Warning: main(DB.php): failed to open stream: No such file or directory in /var/www/www.phpinsider.com/docs/php/code/guestbook/libs/guestbook_setup.php on line 14
Fatal error: main(): Failed opening required 'DB.php' (include_path='.:/export/httpd/php/include') in /var/www/www.phpinsider.com/docs/php/code/guestbook/libs/guestbook_setup.php on line 14 _________________ http://www.hotelsupplies.us/ |
|
| Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7047 Location: Lincoln Nebraska, USA
|
Posted: Tue Jan 03, 2006 2:30 pm Post subject: |
|
|
| fixed, thanks |
|
| Back to top |
|
chros Smarty Regular
Joined: 03 Mar 2006 Posts: 58
|
Posted: Thu Mar 09, 2006 10:35 pm Post subject: |
|
|
| gestionti wrote: | I am trying to use your Guestbook on my machine. I get the following error :
Call to undefined function: query() in /var/www/html/Guestbook/libs/sql.lib.php on line 69, which is this line :
$this->result = $this->db->query($query);
|
I have experienced the same error:
MySQL 4.1.18 Windows service
WinXP
PHP 4.3.11
The problem is the instance doesn't created until the connection was made.
It would be helpful to add to guestbook_setup.php :
| Code: | ...
$this->connect($dsn) or die("Can't connect to the database!");
... |
mysql log says:
"Client does not support authentication protocol requested by server; consider upgrading MySQL client"
I haven't found the solution yet ...  |
|
| Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7047 Location: Lincoln Nebraska, USA
|
Posted: Thu Mar 09, 2006 10:50 pm Post subject: |
|
|
| the sample and .tar.gz file have been updated, thanks. |
|
| Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5613 Location: Toronto, Canada
|
|
| Back to top |
|
chros Smarty Regular
Joined: 03 Mar 2006 Posts: 58
|
Posted: Fri Mar 10, 2006 8:41 am Post subject: |
|
|
| mohrt wrote: | | the sample and .tar.gz file have been updated, thanks. |
Are you sure it's updated ?
All the files are 2005.03.14 dated...
url: http://smarty.php.net/sampleapp/sampleapp_p1.php
edit: Ahh, I see that there's the updated guestbook_setup.php on the webpage, but not in the tar.gz file.
Question: Is your update solve my problem, or should I do like what boots said ?
Edit2: thanks boots, I didn't know that. That did the trick
| Code: | | SET PASSWORD FOR 'dbuser'@'localhost' = OLD_PASSWORD('userpasswd'); |
|
|
| Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7047 Location: Lincoln Nebraska, USA
|
Posted: Fri Mar 10, 2006 2:48 pm Post subject: |
|
|
| The tarfile is updated too. I didn't address your mysql client problem, I just added the error when the DB connection fails. |
|
| Back to top |
|
Ascendant Smarty Rookie
Joined: 10 Apr 2006 Posts: 8 Location: Netherlands
|
Posted: Sun Apr 16, 2006 8:45 pm Post subject: |
|
|
Generally lessons work better when you start with a stated objective.
I suspect you are intending people to be going to the 'working' demo, but it is not always there.
Actually, as I am reading, my personal preference would be for an image of the HTML to be created rather than having to go to a demo.
Having to read thru lots of detail, and trying to figure out what it means without having an reference to what I am achieving makes the learning curve longer.
Personally, I have had more help from the manual.
What would be helping me more is some lessons on the syntax. I am learning the spaces are taboo.
Basically, more simple things that identify the "moving" parts in foreach and section would work great for me. And as I get there in my understanding, I'll try to make some examples.
But first, I'll probably come with some questions (elsewhere).
Michael |
|
| Back to top |
|
Bart Smarty Rookie
Joined: 11 Jul 2006 Posts: 6
|
Posted: Sat Jul 15, 2006 5:27 pm Post subject: |
|
|
Hi guys,
I've used the main db class from the guestbook example in my new project...
it looks like this (see below):
NOW my problem is that I have come to a point where I want to use numRows() are affectedRows() to find out how many rows were affected by the last update...
.. I cant find out how to do this and the main problem is: i dont find any documentation about the SQL class I am extending... I mean ok it is pear db and the DB class is documented, but well..
My Questions:
1) Could you give me a quick hint how to do a num rows?
2) Where do I find a documentation about the SQL class of the Pear package we are using??
Cheers for the tipps
Bart
Here is the code:
<?php
// database configuration
class CustomSQL extends SQL {
function CustomSQL() {
// Superconstructor aufrufen
parent::__construct();
// Config vornehmen
$dsn = "mysql://".DB_USER.":".DB_PASSWORD."@".DB_HOST."/".DB_database;
$this->connect($dsn) || die('could not connect to database');
}
}
?> |
|
| Back to top |
|
mindfriction Smarty n00b
Joined: 11 Jan 2006 Posts: 4
|
Posted: Tue Aug 08, 2006 12:00 am Post subject: |
|
|
Hi Bart,
essentially the SQL class (sql.lib.php) in the sample app is just a wrapper class for Pear DB, so you should be able to look up the nuwRows() documentation on the Pear website and create the relative wrapper function. |
|
| Back to top |
|
danfreak Smarty Rookie
Joined: 23 Sep 2006 Posts: 10 Location: Italy
|
Posted: Sat Sep 23, 2006 9:58 pm Post subject: |
|
|
hey Monte (mohrt),
first of all cheers for the great and usefull application you developed!
Great job man!
I've taken your sample application as a start fro a new application I'm developing using smarty.
I builded a submenu, whose php file structure is based on the guestbook.lib.php (Class Guestbook).
I used an {insert} fuction to insert the menu in my main template.
Given that {insert} works only with functions, how is it possible to access the methods of a class using {insert}?
Could you please provide an example?
Cheers!
PS: I found this post in the forum ({insert}-php-function should be a "true" callback), but an example in the sample application on how to make it work could be usefull! |
|
| Back to top |
|
sanp Smarty n00b
Joined: 24 Oct 2006 Posts: 1
|
Posted: Tue Oct 24, 2006 10:59 am Post subject: |
|
|
whre can i get the DB.php?
i'm poor in php thanks |
|
| Back to top |
|
danfreak Smarty Rookie
Joined: 23 Sep 2006 Posts: 10 Location: Italy
|
|
| Back to top |
|
shahzadmasih Smarty n00b
Joined: 08 Feb 2007 Posts: 1
|
|
| Back to top |
|
PET Smarty Rookie
Joined: 28 Feb 2007 Posts: 11 Location: Timisoara/Romania
|
Posted: Wed Feb 28, 2007 12:50 am Post subject: |
|
|
Hello, please exchuse my n00bish, but...
I have installed smarty and tested a small script, so Smarty works. Then I have tested the Guestbook.
I simply copyed the directory (guestbook) from the archive to my "htdocs" folder, then run it trought the browser. Ofcourse, i got errors (pretty logic but I usualy do this then I configure the script ...I like to see errors).
Then I put the patch's like this:
guestbook_setup.php
| Code: |
require(GUESTBOOK_DIR . 'libs/sql.lib.php');
require(GUESTBOOK_DIR . 'libs/guestbook.lib.php');
require(SMARTY_DIR . 'Smarty.class.php');
require('C:/XAMPP/xampp/php/pear/DB.php'); // PEAR DB
|
index.php
| Code: |
// define our application directory
define('GUESTBOOK_DIR', 'C:/XAMPP/xampp/htdocs/guestbook/');
// define smarty lib directory
define('SMARTY_DIR', 'C:/XAMPP/xampp/Smarty/libs/');
// include the setup script
include(GUESTBOOK_DIR . 'libs/guestbook_setup.php');
|
This is the absolute patch. Did I do something wrong? All I see now when I acces the page is a WHITE PAGE. Should I put the templates files in the smarty dir?
Later Edit:
Since I posted this post. I'm usualy working on localhost on all my projects (pretty logic ) so, I create a directory in htdocs for each project. So since now I will start using Smarty, will the projects TEMPLATES file go into the "Smarty" directory? Or I can put the template files in a special templates directory inside projects directory? |
|
| Back to top |
|
|