FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


get data from mySQL





asiddle423
hi can any one help me fix this problem.

i have created a develoment area for my site.
i want to create an edit option for my developments.
a list of developments will be displayed on a page and when i click on the name of the development i want it to edit that development

can anyone give me an example of code that i could use

if you need to know more then just ask

thx asiddle423
asiddle423
any information on retrieving the data from a mySQL database in php will be useful
Thanks
AftershockVibe
To extract (and insert) data into a MySQL database you will need to learn SQL- "Structured Query Language".

Without this you can't really do anything at all. I'd google for "PHP MySQL tutorial" if I were you.
asiddle423
I have sorted my problem with the database.
I purchased a book on sql, read some mysql documentation and looked at a few example scripts.

This works on my database when i have a primary key of numbers that auto_increments.

Seeing as no one could answer my post i believe that it would help people if i post some of the script so that they can use it if come across this problem.

first of all the page that lists the milestones that i would want to edit would have a link that would refer to the same page but have a query string on the end of the address. For you that don't understand this is where you have the .php and then it has a ? to declare there is a query string and then the string after it. This query string would be the primary key number that is set for the row.

For Example
the link could be www.yoursite.com/index?1

This will allow you to retrieve that query on your edit page

On the edit page you can set a variable that holds this variable $HTTP_SERVER_VARS['QUERY_STRING']
this will get the string that is after the ? in the address

For example i used this
$link = $HTTP_SERVER_VARS['QUERY_STRING'];

i have now stored the query string in a variable for later use in the script

then you will need to declare a query for the database, to select information u want.

For example
$query = mysql_query('SELECT column_name FROM table_name');

this will then allow you to retrieve the results into the $query variable

Now to output the results
you will use a command like this to output your query
echo mysql_result($query, $link);

the $query part runs the query to get information from the database.

the $link filters the information so that it just outputs the row with that primary number

This isn't very clear so if you have any questions please post a message and i will be happy to help
Related topics
Build an online dictionary by PHP/MySQL
MYsql
insert data to mySQL database problem
Delete data from MySQL database problem!!
MySQL Data Not Inserting - I keep getting an error
Esay Php, Freeware
Need Expert help in php-mysql
Images in MySQL
Data Mining From tables and then insert into MySQL
Getting host to connect to my local mysql?
cannot add data to mysql from PHP form
What MySQL Data type would you use to store a Webpage
PHP and Javascript Issue handling data from a mysql query
Storing MySQL connection data securely and conveniently
Need help on what is MySQL and PHP!
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.