Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 28th, 2006, 07:54 PM
Registered User
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to fedoracore
Default paging through data - Data Access Objects

RE: Basic Appointment Calendar or "Events Scheduler"

hi. this is my first attempt at using MySQL (SELECT - WHERE) style queries on a table using Data Access Object style PHP Classes -- where all of the table data will be returned in the form of a "Data Object", or array as one might say.

although it took me a while, trial and error and much research to figure out how to select only certain fields from the DB using this OOP approach (as in, make a drop-down w/ only the date info, or only the "event" name), i feel like i developed a fair understanding of how to 'look at' these data objects (the arrays returning my rows of events data), but i'm having trouble thinking about how i'm going to do my UPDATEs if necessary-- and furthermore-- even how to simply take a single, user-selected event-date, and query the db for displaying the corresponding details (another Data Object puzzle for me).

[maybe this next part isn't a problem, but for me...] to make matters worse, in my testing on localhost, i've deleted rows (where i messed up and inserted blank fields), so no longer do i have a consecutively enumerated Primary Key, but simply rather random, Unique id's, put there originally by an autoincrementing id, and of course any new entries will continue where the AutoInc left off...

my data Class select Method looks like this:
function selectWhere($table,$field,$where) {    

    $dbconnect = mysql_connect("secretstuff");

    $this->query = "SELECT * FROM ".$table." WHERE ".$field."=".$where.";";
    $this->result = mysql_query($this->query) or die(mysql_error());
    $this->data = mysql_fetch_assoc($this->result);

    return $this->data;
     the way i see it, my problem stems from my inability to take a user input, plug it into this selectWhere() method at $where, and return that singular row which the user wants to see. there it is. that's my issue. to retrieve a single row using this method.

your own commentary is preferred, of course, but if you know of a URL which covers precisely this issue, i'd appreciate it.

thank you for reading my short-story/ thriller, titled:
 "When OOP Crushed a Newb into Bits pt. II - the Puzzle Continues"

I look forward to your reply.

Do the hokey pokey.
Turn yourself around.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot data: Linq to Objects jimibt BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 September 22nd, 2008 01:22 PM
Paging Data grid view Prakash001 Visual Basic 2005 Basics 0 February 6th, 2008 04:07 AM
Apply Paging on Grouped Data jhansib4u XSLT 4 November 26th, 2007 01:30 PM
Paging and Data base connectivity nicesukhi ASP.NET 2.0 Basics 1 August 2nd, 2006 09:33 AM
What is JDO(java data objects) arvindwrites Java Databases 1 August 19th, 2004 12:26 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.