Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 16th, 2005, 8:33 PM   #11
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Enjoy. I've written a tutorial database system (for which I was planning on eventually writing some tutorials for :p) if you wanna save some time.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 16th, 2005, 9:02 PM   #12
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Quote:
Originally Posted by big_k105
now that its summer and i get more time i plan on working on a full CMS for pfo that will be built around vB and it will consist of a good code snippet section, a good tutorial section and a good article section(esp if kurifu wants to keep writing )
That sounds good man, i will look forward to it, if you need help let me know :-)
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Jun 27th, 2005, 12:38 PM   #13
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,671
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
i added some things to dbSelect function

[php] function dbSelect($what, $from, $where = "", $order = "")
{
////////////////////////////////////////////////
// Purpose: This function lets you do a select from the db that you just connected to.
// Pre: The coonection has to be made, also you need to send at least what and from
// var for this function to run
// Example: if you wanted to select all cats from the table called cats:
// dbselect("*", "cats", "");
// if you wanted to select all the cats from the tabled called cats that are red:
// dbselect("*", "cats", "colour=red");
// Post: Returns the record set. Returns false if it blew up.
////////////////////////////////////////////////
if ($where == "" && $order == "")
{
$sql = "SELECT " . $what . " FROM " . $from . ";";
}elseif ($where != "" && $order == "") {
$sql = "SELECT " . $what . " FROM " . $from . " WHERE " . $where . ";";
}elseif ($where == "" && $order != "") {
$sql = "SELECT " . $what . " FROM " . $from . " ORDER BY " . $order . ";";
}
$res = pg_query($sql);

if ($res)
{
return $res;
}else{
return false;
}
}
[/php]
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Jun 27th, 2005, 3:17 PM   #14
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
thanks for the changes, makes more sence having it setup like that.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Jun 27th, 2005, 6:40 PM   #15
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,671
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
i should have one more thing added to that for when both $where and $order are there. im just missing an extra if ($where != "" && $order != "") and then have the sql for that
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Jun 28th, 2005, 10:55 AM   #16
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 6 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
I added some things to big_k's code, it didn't have code for the situation of there being a where and order by clause.

[php]
function dbSelect($what, $from, $where = "", $order = "")
{
////////////////////////////////////////////////
// Purpose: This function lets you do a select from the db that you just connected to.
// Pre: The coonection has to be made, also you need to send at least what and from
// var for this function to run
// Example: if you wanted to select all cats from the table called cats:
// dbselect("*", "cats", "");
// if you wanted to select all the cats from the tabled called cats that are red:
// dbselect("*", "cats", "colour=red");
// Post: Returns the record set. Returns false if it blew up.
////////////////////////////////////////////////
if ($where == "" && $order == "")
{
$sql = "SELECT " . $what . " FROM " . $from . ";";
}elseif ($where != "" && $order == "") {
$sql = "SELECT " . $what . " FROM " . $from . " WHERE " . $where . ";";
}elseif ($where == "" && $order != "") {
$sql = "SELECT " . $what . " FROM " . $from . " ORDER BY " . $order . ";";
}else {
$sql = "select {$what} from {$from} where {$where} order by {$order}";
}
$res = pg_query($sql);

if ($res)
{
return $res;
}else{
return false;
}
}
[/php]
__________________

tempest is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:45 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC