PDA

View Full Version : Using mySQL for a simple list of members


:mo:
08-17-2005, 11:46 AM
I have a website which has an admin section which can easily be customised to insert things into the mySQL database, but i can't really use mySQL in the pages


What i need is a php script that can see how many entries there are for 'name', 'picture_url' and 'comment' (i have phpmyadmin but dont know what to insert so taht i can hold these values)

then the php script needs to insert each value for 'name', 'picture_url' and 'comment' into a seperate arrays

by that i mean

the array name_list may contan ('John', 'Fred')

i hope u understand me because i had difficulty explning that in words


thanks in advance

nikkiH
08-17-2005, 04:00 PM
phpMyAdmin can create the PHP code for you, IIRC. I think I remember seeing a link in there to do that.

:mo:
08-17-2005, 07:12 PM
i need to get them in three arrays and i have no idea what structure to use or anything

nikkiH
08-17-2005, 07:44 PM
I'm not sure what you mean...
PHP has arrays. If you want it in arrays, put it there.

This is the MySql forum, so I assumed the question was about MySql, not PHP.
If your question is how to create and use PHP arrays, see this.
http://www.theopensourcery.com/phparray.htm


If you aren't sure how to get a query result into an array, see
http://us2.php.net/manual/en/function.mysql-fetch-array.php


And the documentation, of course.

:mo:
08-17-2005, 07:49 PM
first of all i need to create the table for where the data is stored

i need some idea what structure i should use

nikkiH
08-19-2005, 10:10 PM
You mean you haven't even created the database tables yet?

Structure depends on what you're storing, how it will be used, etc.
You'd have to say a lot more about your data (and how you plan to use it) before I could recommend the best table structure (inc. indexes etc for optimized searches).
For example, if you'll be searching for a particular thing often, you should at least index it or get it organized so that it has a primary key (for best performance).

Like if you'll be searching for every picture that belongs to a page, then every comment that belongs to that picture, you should give each pic a unique id (primary key) in a pic table, and then hang a foreign key to it on a comments table.