TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-16-2009, 07:44 PM   #41 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
Regarding the SVN problems, read http://code.google.com/p/talkphp/source/checkout for instructions except the path to Phlox is https://talkphp.googlecode.com/svn/phlox/trunk/

Kind of related to my previous posts, is this project indended to be a distributed software like Gallery or a centralised application like Flickr?
It will be distributed open source (under the MIT license), it will however function like Flickr.
__________________

Village Idiot is offline  
Reply With Quote
Old 01-16-2009, 09:15 PM   #42 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Thank you Salathe.

It has now been uploaded!
__________________
Tanax is offline  
Reply With Quote
Old 01-16-2009, 09:19 PM   #43 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

To follow naming convention (I never made this clear), please name it class.mysql.php

Great work, I will start assigning other tasks now.
__________________

Village Idiot is offline  
Reply With Quote
Old 01-16-2009, 09:25 PM   #44 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Can't I name it class.DBmysql.php ? Since the class itself isn't named mysql, it sounds a little confusing to use different names on the file and the class. I can understand if you want to use a prefix of class. infront of the classname, so everyone can see it's a class, but to rename it?

Ahwell, tell me what to do. Rename to class.mysql.php or class.DBmysql.php
__________________
Tanax is offline  
Reply With Quote
Old 01-16-2009, 09:29 PM   #45 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

That does make sense, name it that class.DBmysql.php .
__________________

Village Idiot is offline  
Reply With Quote
Old 01-16-2009, 09:41 PM   #46 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Done !
__________________
Tanax is offline  
Reply With Quote
Old 01-16-2009, 10:34 PM   #47 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

I'd like to make continual little comments on the submitted code. Where do you guys think this would be best placed? Code Review is enabled for the project at Google so people can review lines (or files, blocks of code, etc.) even on a per-revision basis which would make things more tied together. Or, would those coding prefer comments to be made in threads like this one?
Salathe is offline  
Reply With Quote
Old 01-17-2009, 01:01 AM   #48 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Use the Code Review feature. I look forward to seeing your feedback on the code.
__________________

Village Idiot is offline  
Reply With Quote
Old 01-17-2009, 01:42 AM   #49 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

I just noticed that your userclass uses mysql_result. I haven't used it in my class, actually, I've never used it. But I could implement it in the getQueryResult.

My idea would basicly means that you would do like this:
PHP Code:
$dbobj->exeQuery($sql);

$this->username $dbobj->getQueryResult(0"username");
$this->password $dbobj->getQueryResult(0"user_pass");
$this->rank $dbobj->getQueryResult(0"rank"); 
Want me to implement it?
__________________
Tanax is offline  
Reply With Quote
Old 01-17-2009, 02:00 AM   #50 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

That would be good.
__________________

Village Idiot is offline  
Reply With Quote
Old 01-17-2009, 03:45 PM   #51 (permalink)
The Contributor
 
Ross's Avatar
 
Join Date: Jan 2008
Location: England, UK
Posts: 83
Thanks: 3
Ross is on a distinguished road
Default

Could I suggest using a DAL for the database? E.g. an abstract database class, that is extended by the MySQL class.
__________________
Ross » Blog » Twitter
Ross is offline  
Reply With Quote
Old 01-17-2009, 05:23 PM   #52 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Already suggested it myself, but VI didn't want it for now.

Quote:
Originally Posted by Tanax View Post
Okey, after reading about their functions, I see why you thought it would sound silly or impractical. Indeed, it would be very impractical to have mysqli option in the mysql DB object. However, I've done a DB factory class, which would let you create a db object based off of what db you want, like:

$db = DB::getDatabase('mysql');

and it would then create a new DBmysql and return the instance.
It would then be easy to create other objects, such as DBmysqli, DBmysql_PDO, DBsqlite_PDO, etc.

But that's only if you guys want it. However, I think Orc will have to change the __construct in his class since it's checking if the class is an instance of DBmysql, and I don't know if someone else has done something using this class that would be affected by this change.

I would however be happy to change it, if you want.
And by "change it", I mean create the factory class.
__________________
Tanax is offline  
Reply With Quote
Old 01-17-2009, 05:48 PM   #53 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

How do I update an already existing file in the svn?
When I try to add it, it says it already exists..
__________________
Tanax is offline  
Reply With Quote
Old 01-17-2009, 07:28 PM   #54 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

You make the changes locally, then "commit" those changes to the central repository. Are you using the command line or some application to use SVN?
Salathe is offline  
Reply With Quote
Old 01-17-2009, 07:40 PM   #55 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by Ross View Post
Could I suggest using a DAL for the database? E.g. an abstract database class, that is extended by the MySQL class.
While I do not think that it is a bad idea, I don't want to get that complex with the SQL class right now. Reason being that all development is waiting for it, to add something else to it would delay development even more than it already has been,
__________________

Village Idiot is offline  
Reply With Quote
Old 01-17-2009, 08:17 PM   #56 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Yes, I've done the change locally.
How do I commit the changes?

I'm using tortoise svn
__________________
Tanax is offline  
Reply With Quote
Old 01-17-2009, 08:32 PM   #57 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by Tanax View Post
Yes, I've done the change locally.
How do I commit the changes?

I'm using tortoise svn
You right click on the file and hit "SVN Commit"
__________________

Village Idiot is offline  
Reply With Quote
Old 01-17-2009, 08:52 PM   #58 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Ah, it was a little more to it than that. I had to create a repository first, then download all the files, then modify the file, and THEN commit. But I've updated it now so it works with the getQueryResult(2, 'field')
__________________
Tanax is offline  
Reply With Quote
Old 01-17-2009, 08:57 PM   #59 (permalink)
The Contributor
 
Ross's Avatar
 
Join Date: Jan 2008
Location: England, UK
Posts: 83
Thanks: 3
Ross is on a distinguished road
Default

Quote:
Originally Posted by Tanax View Post
Ah, it was a little more too it than that. I had to create a repository first, then download all the files, then modify the file, and THEN commit. But I've updated it now so it works with the getQueryResult(2, 'field')
Remember to do an SVN Update before you Commit to check that noone else has edited the file since you started :)
__________________
Ross » Blog » Twitter
Ross is offline  
Reply With Quote
Old 01-17-2009, 09:03 PM   #60 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Tanax: I don't know if you noticed but I made a whole bunch of comments on your previous version, revision 55.

It's ok there's nothing too huge to worry about, I guess the main is that magic quotes line in the secure method. Also, there's the overall comment (which I'll quote to save you clicking) which could do with some attention.

Quote:
Why are there so many places where one can provide a SQL query as an argument? I count 5.

There also appears to be a confusing selection of ways to achieve a usually simple task: grab an assoc. array of results. More clear documentation of the use of this class is requested (perhaps on the forums).
Salathe is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] How to organize your classes | Part 1 Tanax Advanced PHP Programming 10 03-01-2009 10:08 PM
A Generic Singleton Base Class Theo Advanced PHP Programming 7 08-18-2008 02:25 AM
[Tutorial] Basic tutorial about class basics Tanax Absolute Beginners 14 07-24-2008 01:37 PM
PHP5 Classes A to Z Part 1 quantumkangaroo Advanced PHP Programming 11 04-01-2008 04:21 AM
Tutorial: PHP and OOP, a beginners guide Village Idiot Tips & Tricks 0 09-06-2007 04:23 PM


All times are GMT. The time now is 12:48 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design