Wrox Programmer Forums
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP 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 December 20th, 2005, 12:12 AM
Registered User
 
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default manage page

I am new to the site - and PHP, though I have been studying PHP and MySQL for nearly 2 years.

I have a project I need to complete and If I can get a little nudge in the right direction...

I maintain a site for an animal rescue - www.theadweb.com/wilson - and I do all the updates as the pets are added and adopted.

I need to create a new site along the same display theme - individual display boxes - where the client can log on and add, delete and edit the pets as necessary...

I can see where PHP and MySQL are going to be a great help in this, but what is the best approach to the client manage side?

My first thought – the client logs in and has the necessary permissions. This is a /manage.php page on the site.

The manage page has the ADD / UPDATE options.

The ADD button is for a new entry, bringing up a new ADD page with a .jpg upload, a place for text, header, ADD button etc. The ADD button sends the info to the db and creates a new record.

The UPDATE choice pulls up a name list of the pets currently in the db through a for while loop and the name list is selectable. (how do the names become selectable – an iteration drops them into a form field?)(I could also make it a name entry and call the record that way... I prefer the former "select" option...)

Selecting the desired pet calls the record and displays the appropriate text box with the descriptive text available for editing – again – inputing into a form? I imagine this is all done on a separate page from the original EDIT page, with inserts into form fields...

An UPDATE button uploads the changes made to the text into the db and updates the record.

Meanwhile, once a pet is selected for edit, a DELETE button appears. Changing pages again? Clicking the DELETE deletes the record and displays another page... "success" another page?

So – The confusing part – not that I am all that clear about what I just said – this is all just theory for me at this point.

On the display page – the one the site visitor views when coming to the site, PHP calls the MySQL SELECT to display the data from the db - all the pets in their display boxes. But how does the <div> layout / propagate the individual pet display boxes? I believe it is through the “inclusion” call of the <div> / <table> layout / format from the inclusion file and a while loop / iteration places the db text in the appropriate places while generating the various boxes, and the image name from the db image field calls the appropriate .jpg from the image file?

...or something like that?

If I can just figure the manage side out I can do everything I currently have in view to accomplish with MySQL and PHP.

Thanks in advance for your help!!

David
 
Old January 8th, 2006, 11:00 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hum... not that i am going to read how you want to setup your site.
1st. You setup a table (members) in mysql like:
id / Username / pet / color / age / price
2nd. When you enter the new data in the database mysql auto create a new entry with the relevant info:
01 / John Smith / Cat / White and Black / 10 / 5
02 / Paul Smith / Cat / Black / 1 / 50
03 / Trevor Smith / Cat / White / 8 / 15
04 / Pikabou Smith / Cat / Pink / 3 / 500
etc.

when you retreive the info:
$query = "SELECT * FROM members WHERE Username LIKE '$username1'";
or
$query = "SELECT * FROM members WHERE pet LIKE '$pet1'";
which is follow by:
while ($row = mysql_fetch_array($result))
{
     extract($row);
$id1=$id;
$Username1=$Username;
$pet1=$pet;
$color1=$color;
}

So you have now you information stored in variables.. what you do with them its up to you really. If you plan to show more than 1 entry then either you store them in Array or you display them straight on the screen (much faster)
<table><tr>
while ($row = mysql_fetch_array($result))
{
     extract($row);
?> <td> <?php
echo "ID:".$id." ";
?> </td><td> <?php
echo "Username:".$Username." ";
?></td><td> <?php
echo "Pet:".$pet." ";
?> </td></tr><tr><?php

}
?>
</table>

Image are usually uploaded in a folder of your choice and the picture name stored in the table.
I hope this help.
 
Old January 21st, 2006, 01:10 AM
Registered User
 
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank for the great response. I'll keep working on it...





Similar Threads
Thread Thread Starter Forum Replies Last Post
want to manage membership sumit_0 ASP.NET 2.0 Basics 0 April 25th, 2008 06:31 AM
Manage. rupen SQL Server 2005 1 October 17th, 2007 11:27 AM
For Role Access+Manage Mukund.vadodariya ASP.NET 2.0 Professional 1 June 10th, 2006 02:43 AM
Manage error ciko1973 Classic ASP Databases 1 July 9th, 2003 12:04 PM





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