Forums
This topic is locked
PHAKT and manual code
Posted 04 Sep 2001 15:03:21
1
has voted
04 Sep 2001 15:03:21 Michael O'Neill posted:
I am using PHAKT, php 4 and ultradev 4.I am currently mixing manual code with Ultradev/PHAKT code especially for the database connections eg.
require("./adodb/adodb.inc.php"
require("./Connections/phaktconn.php"
session_start();
$query = "SELECT * from cart WHERE partno = '$partno' and username = '$username'";
$result = mysql_query($query);
Is this OK.
I am trying to do things like email confirmation of entries to my MySQL database etc. and this is the only way I could manage it as I am not very good with "Ultradev" code.
Any comments appreciated.
Mike.
Replies
Replied 04 Sep 2001 22:39:45
04 Sep 2001 22:39:45 Tim Green replied:
You can mix safely your own code and UD Code, but there are a couple of things you need to take into consideration.
The first thing, is that you decide not to use the UD Style of connections, or the ADODB wrapper library, then you are really on your own, as PHAkT (and UD) has no support for the connections you are trying to make.
However, if you look inside the ADODB folder (in Configuration/Shared/PHAkT/adodb) you will find a Readme.htm which describes all of the features of ADODB and how to use them.
The inbuilt server behaviours in UD will sort out all of the Recordset generation, and SQL Queries that you need. All it takes is a little time to look through the UD Standard Help and follow the instructions for creating recordsets/queries/inserts/updates/deletes etc.
If however, you want to stick to your manual coding, then you will have to do it all from scratch. In your code, for example, you can forget the require statements, as these won't contain any information or code that will help you in this way.
Believe me though, getting used to UD code will increase your productivity enormously. If you need pointers, there are a number of tutorials on this site. Sure not all of them are PHP related, but the majority of them will have some bearing.
Dip your toe in, the water's fine <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>
The first thing, is that you decide not to use the UD Style of connections, or the ADODB wrapper library, then you are really on your own, as PHAkT (and UD) has no support for the connections you are trying to make.
However, if you look inside the ADODB folder (in Configuration/Shared/PHAkT/adodb) you will find a Readme.htm which describes all of the features of ADODB and how to use them.
The inbuilt server behaviours in UD will sort out all of the Recordset generation, and SQL Queries that you need. All it takes is a little time to look through the UD Standard Help and follow the instructions for creating recordsets/queries/inserts/updates/deletes etc.
If however, you want to stick to your manual coding, then you will have to do it all from scratch. In your code, for example, you can forget the require statements, as these won't contain any information or code that will help you in this way.
Believe me though, getting used to UD code will increase your productivity enormously. If you need pointers, there are a number of tutorials on this site. Sure not all of them are PHP related, but the majority of them will have some bearing.
Dip your toe in, the water's fine <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>
Replied 05 Sep 2001 19:03:46
05 Sep 2001 19:03:46 Bruno Mairlot replied:
In addition to the precedent poste, I'll add one thing :
Try as much as possible to leave PHP tag generated by UD alone.
If you can, open a new tag to enter your code and don't modify the others. In this way you'll help UD search for ServerBehavior and Translator.
Not so long ago I was a pure hand-coding developper. But up to now, I have to admit that I use more and more Phakt PHP code-style.
There's still some case where UD archictecture isn't of any help, but it's rare.
"First they laugh at you, then they fight you, then you Win..." Ghandi
Edited by - Maehdros on 09/05/2001 19:04:47
Try as much as possible to leave PHP tag generated by UD alone.
If you can, open a new tag to enter your code and don't modify the others. In this way you'll help UD search for ServerBehavior and Translator.
Not so long ago I was a pure hand-coding developper. But up to now, I have to admit that I use more and more Phakt PHP code-style.
There's still some case where UD archictecture isn't of any help, but it's rare.
"First they laugh at you, then they fight you, then you Win..." Ghandi
Edited by - Maehdros on 09/05/2001 19:04:47
Replied 05 Sep 2001 21:13:54
05 Sep 2001 21:13:54 Michael O'Neill replied:
Thanks for the support guys. One last thing though. I have been using the PHAKT "require" statements at the start of my manual coding for some of the database queries instead of the normal:
@ $db = mysql_pconnect("localhost", "MyUser", "MyPass"
mysql_select_db("MyDb"
and all seems to work fine. Is this OK (or even required)?
Thanks again
Mike.
@ $db = mysql_pconnect("localhost", "MyUser", "MyPass"
mysql_select_db("MyDb"
and all seems to work fine. Is this OK (or even required)?
Thanks again
Mike.
Replied 05 Sep 2001 21:31:04
05 Sep 2001 21:31:04 Tim Green replied:
The PHAkT require statements are only necessary when you are using the UltraDev connection methods for accessing your DB.
If you are determined to go ahead with the mysql_connect statements directly, then you don't need to include them. However, if at a later stage you use any of the standard UD Database functions then these lines will be included automatically.
In my personal opinion, you get far more out of the ADODB connection method than by hand coding your connections the way you are doing, but of course this remains your choice.
Hope this helps.
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>
If you are determined to go ahead with the mysql_connect statements directly, then you don't need to include them. However, if at a later stage you use any of the standard UD Database functions then these lines will be included automatically.
In my personal opinion, you get far more out of the ADODB connection method than by hand coding your connections the way you are doing, but of course this remains your choice.
Hope this helps.
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 15 Sep 2001 07:55:25
15 Sep 2001 07:55:25 Stephen Cox replied:
What about including your own functions? Does Pkakt and UD have a problem with that?
Stephen Cox
web.net geek for nonprofits and political campaigns.
Stephen Cox
web.net geek for nonprofits and political campaigns.
Replied 15 Sep 2001 11:35:17
15 Sep 2001 11:35:17 Bruno Mairlot replied:
Absolutely not.
Never forget, that you can use DW and UD as a pure text file editor.
When PHP executes your code, it doesn't care anymore if the program which created it is UD, Phakt, or your brain ... <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
You can safely mix function, code, Phakt Code, UD code,....or whatever, as long as you keep PHP syntax correct .
What rawveg and I where saying, is that UD gives you lots of tool to increase your productivity.
"First they laugh at you, then they fight you, then you Win..." Ghandi
Never forget, that you can use DW and UD as a pure text file editor.
When PHP executes your code, it doesn't care anymore if the program which created it is UD, Phakt, or your brain ... <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
You can safely mix function, code, Phakt Code, UD code,....or whatever, as long as you keep PHP syntax correct .
What rawveg and I where saying, is that UD gives you lots of tool to increase your productivity.
"First they laugh at you, then they fight you, then you Win..." Ghandi
Replied 16 Sep 2001 04:34:11
16 Sep 2001 04:34:11 Tim Green replied:
And there are no problems in changing the generated code either, though if you do this PHAkT will no longer recognize the code blocks, and you will therefore have to do any minor modifications by hand also.
I constantly mix UD Generated code and hand written code, it makes sense as it enables true RAD development.
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>
I constantly mix UD Generated code and hand written code, it makes sense as it enables true RAD development.
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>