If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

php input.

Ok. I am a php noobie. I have good knowledge of html but i know i need some php for this. Any help is very appreciated. thanks

ok i want a page that has a simple form on it. There are two form inputs "Name" and "Picture Location." Upon the user pressing submit i am guessing that this information must be put into a database? I then need the code that will retrieve information from the database. I want the "Name" and "Picture Location" to be retrieved and put into this format. (hyperlink with frame target and name)

Okay, to do that you need to know how to first desgin a database, second how to connect to it with PHP, and third how to read and write data to it with PHP.

Let's start with simply designing the database. You're going to want a table of images with a field of name (varchar 255) and location (varchar 255) and id (int 11 unsigned auto_increment) which is a fairly simple design.

You then can connect to the database with mysql_pconnect() in php, and mysql_select_db(). If you can get that far, we can talk you through querying the database to add and display records.

if this right i am going to crack open some beer cause i am proud of that my first database

I dont understand what i should put in( $connid = mysql_connect ( 'localhost' 'username' 'password' ) ) should it be database name or IP? user name and password confuses me as it is defined by my previous question but if its database name then what do i set these as because i havnt password protected the database i have created in this code. I assume this is why when uploaded i get this error... www.forwardasone.clanservers.com/phpdata.php

Assuming it's a MySQL database, you need to use mysql_pconnect(server, username, password); then mysql_select_db(database_name); to establish a connection from PHP. Then you can execute a series of queries to read and write data.

To write data to the database, do something like mysql_query("INSERT INTO table_name SET column1='something', column2='something else'"); and to alter existing rows use something like mysql_query("UPDATE table_name SET column1='something', column2='something else' WHERE id='some id'");

To read data from the database, store the results of a query in a variable. If you want to pull one specific row, do something like $results = mysql_query("SELECT * FROM some_table WHERE id='some id' LIMIT 1"); then $row = mysql_fetch_object($results); In order to access your data, do something like echo $row->column1; or echo $row->column2; etc.

To read data when you're expecting multiple results from a query, do something like $results = mysql_query("SELECT * FROM some_table ORDER BY something"); then you place your rows through a loop such as:

First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection.

Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mysql_close() will not close links established by mysql_pconnect()).

So basically, any connections that come in are typically pooled into one connection. So you'd have to design a checking system to determine that the response is actually yours otherwise you have to throw it out.