Forums

PHP

This topic is locked

PHAkt / UD4 Issues - Does PHAkt work?

Posted 13 Aug 2001 14:30:43
1
has voted
13 Aug 2001 14:30:43 Starman Seven posted:
I'm trying to use PHAkt with UD4 but am not having much luck. I'm using Win2k, UD4, Apache 1.3.20 w/ PHP 4.06, and MySQL 3.23.40

My problems are these:

My DB connections work, the query works when tested. When inserted, the preview gives this error: Fatal Error: Failed Opening Required './adodb/adodb.php.inc' (include_path=" in c:\program files\apache\apache group\htdocs\untitled-11b4tci.php on line 8 (it's pretty bogus I had to type that, the error from UD didn't allow me to select/cut/paste).

My include path in php.ini is empty (Install.txt does not mention include_path). When I save the page and view it I get no error. But, I also don't see the recordset I specified in the query... So I thought maybe I need to use
Show Region thing - if record is not empty. And this also fails with a different error (the same error when previewing as above) but in the browser:

Fatal error: Call to a member function on a non-object in c:\program files\apache group\apache\htdocs\ud4_php\untitled-1.php on line 19 my code is at bottom.

I'm begining to wonder what the use of PHAKt is - is it just for writing queries? (that don't preview). What about other operations like logic needed in building an application? Is it there?

Also, unless I save the file first, the db behavior puts in windows urlencoded paths (file://foo%20bar). I can live with this by saving the document first. but, it's annoying.

Am I missing something, where are the instructions?



<?php


// Copyright (c) Interakt Online 2001
// www.interakt.ro/

require("./adodb/adodb.inc.php";
require("./Connections/connUD4_PHP.php";
?>
<?php if ($Recordset1__totalRows>0) { ?>
<?php
$Recordset1=$connUD4_PHP->Execute("SELECT artist, title, year, label, tracks, review FROM cds" or DIE($connUD4_PHP->ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1->RecordCount();
?>
<?php } // end $Recordset1__totalRows>0 ?>
<?php
$Recordset1->Close();
?>





Edited by - starman7 on 08/13/2001 21:33:52

Replies

Replied 13 Aug 2001 15:30:11
Replied 13 Aug 2001 17:08:37
13 Aug 2001 17:08:37 Starman Seven replied:
I looked at that post, it seems to answer the part about weird paths, that's where I found the solution of saving the file first... Are the other questions answered there...? I didn't see that they were.



Edited by - starman7 on 08/13/2001 17:09:26
Replied 13 Aug 2001 18:30:13
13 Aug 2001 18:30:13 Tim Green replied:
Starman,

I appreciate your frustration. However the reason you are receiving the error about the file adodb.inc.php is simply because you haven't uploaded the adodb folder to your webserver (the file can't be found because it isn't there).

You will also find that errors regarding 'Call to a member function on a non-object' (the object hasn't been created because the adodb folder is missing from the webserver).

As far as the relative paths are concerned, I know it's a little annoying, but just think about this logically for a second.... If you haven't saved the file, how on earth do you expect a relative path to be created when the software has no idea where you are placing the file ?

As far as PHAkT is concerned, well, no, it isn't for creating non-viewable queries alone, but you will only get a true appreciation for what PHAkT actually does once it is working.

Stick with it a little longer and I'm sure you will soon begin to appreciate its true worth.

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 13 Aug 2001 19:13:20
13 Aug 2001 19:13:20 Starman Seven replied:
Rawveg,

Thanks for the encoragement, I am planning to stick with it until I see the program's true value <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>. I double-checked my site specification and noticed a possible discepency of web roots, etc. I made them all point to my site root - now previewing doesn't give an error but I still get this when trying to view the results of my non-empty query....

Fatal error: Call to a member function on a non-object in c:\program files\apache group\apache\htdocs\ud4_php\untitled-1.php on line 19

Line 19 is: &lt;?php
$Recordset1-&gt;Close();
?&gt;

full code follows:


&lt;?php


// Copyright (c) Interakt Online 2001
// www.interakt.ro/

require("./adodb/adodb.inc.php";
require("./Connections/connUD4_PHP.php";
?&gt;
&lt;?php if ($Recordset1__totalRows&gt;0) { ?&gt;
&lt;?php
$Recordset1=$connUD4_PHP-&gt;Execute("SELECT artist, title, year, label, tracks, review FROM cds" or DIE($connUD4_PHP-&gt;ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1-&gt;RecordCount();
?&gt;
&lt;?php } // end $Recordset1__totalRows&gt;0 ?&gt;
&lt;?php
$Recordset1-&gt;Close();
?&gt;

Thanks,
Bill


i'm just looking for the steps to display some of my data...



Edited by - starman7 on 08/13/2001 19:38:13
Replied 13 Aug 2001 19:58:28
13 Aug 2001 19:58:28 Tim Green replied:
Luckily, this problem is fairly easy to diagnose <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

You see line after the requires ?

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>&lt;?php if ($Recordset1__totalRows&gt;0) { ?&gt;<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

I take it that you have added this line yourself, as what this is doing is saying :-

"If the total recordset rows are greater than zero, then create the Recordset"...

The problem with this is that the Recordset has to be created for the total rows to be known. Therefore, what happens is that the Recordset 'object' isn't created. As there is no condition like this around the $Recordset1-&gt;Close() line, you get the error.

Remove the condition, and you will find that your recordset should be created successfully at Run-Time.

Hope this helps <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Edited by - rawveg on 08/13/2001 20:00:48
Replied 13 Aug 2001 21:32:26
13 Aug 2001 21:32:26 Starman Seven replied:
actually, all that code was written by phakt... removing that line didn't help ;-(
i don't know what's going on obviously. is there a simple step by step way to get data out of the db with ud4 and phakt? my method was: start with an empty document. save it. go to data binding and make a new query - test it to make sure there's a row returned. no filtering at all. save again. select the data binding under server behavior and do a show region if not empty... save. i still get this error:


Fatal error: Call to a member function on a non-object in c:\program files\apache group\apache\htdocs\ud4_php\untitled-1.php on line 19

and here's the code phakt generated, maybe i'm doing something out of order?


&lt;?php


// Copyright (c) Interakt Online 2001
// www.interakt.ro/

require("./adodb/adodb.inc.php";
require("./Connections/connUD4_PHP.php";
?&gt;
&lt;?php if ($Recordset1__totalRows&gt;0) { ?&gt;
&lt;?php
$Recordset1=$connUD4_PHP-&gt;Execute("SELECT artist FROM cds" or DIE($connUD4_PHP-&gt;ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1-&gt;RecordCount();
?&gt;
&lt;?php } // end $Recordset1__totalRows&gt;0 ?&gt;
&lt;?php
$Recordset1-&gt;Close();
?&gt;

taking the last php clause out (line 19) makes the error go away - but my row isn't printed.

Edited by - starman7 on 08/13/2001 21:34:34
Replied 13 Aug 2001 21:52:45
13 Aug 2001 21:52:45 Tim Green replied:
Hmmm, I know for a fact that PHAkT doesn't put a condition around the recordset creation, but anyway, that's by the by.

The code you have posted isn't enough to actually output anything to the page, all it does is create a recordset, and nothing else.

Although PHAkT is a new Server Model, the standard way of working with UD applies here, and for that you should really read the online help included with UD.

There aren't any tutorials here that strictly cover what you are doing, but you must also understand that it's not as simple as creating a recordset and leaving it at that.

So that you know the code :-

&lt;?php if ($Recordset1__totalRows&gt;0) { ?&gt;

&lt;?php } // end $Recordset1__totalRows&gt;0 ?&gt;

are two lines inserted by the Conditional Region 2 behaviour, by Waldo Smeets.

Anyway, back to your problem...

Try this to give you some visual kind of result :-

&lt;?php


// Copyright (c) Interakt Online 2001
// www.interakt.ro/

require("./adodb/adodb.inc.php";
require("./Connections/connUD4_PHP.php";
?&gt;
&lt;?php
$Recordset1=$connUD4_PHP-&gt;Execute("SELECT artist FROM cds" or DIE($connUD4_PHP-&gt;ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1-&gt;RecordCount();
?&gt;
&lt;!-- This Outputs a single item from your Recordset--&gt;
&lt;?php echo $Recordset-&gt;Fields("artist"; ?&gt;
&lt;?php
$Recordset1-&gt;Close();
?&gt;


To get this extra item, go to the DataBindings Palette abd expand the view of the Recordset, which will show you the columns as detailed in your query.

Simple drag one of the listed columns into the position where you want it displayed on the page.

Note too, that I removed the Loop around the recordset generation section of your code.

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 13 Aug 2001 22:06:20
13 Aug 2001 22:06:20 Starman Seven replied:
yes, that code worked after naming recordset on line 16 to recordset1.

i'll have to read the macromedia docs on how to work w/ server models. thanks for the gentle clues on how to work with the palette. hopefully i can figure it out.

cheers,
bill

Replied 13 Aug 2001 22:10:37
13 Aug 2001 22:10:37 Tim Green replied:
Ooops... that's what happens when you rush your typing (you can tell when someone is used to a spellchecker... lol).

I'm sure you'll figure it out, there are still some things that I'm finding out ! UD is so feature rich that some things are easily missed.

Anyway, good luck, and if I can help you any further just let me know <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic