Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Input box and more..

Links for php scripts

Moderators: macek, egami, gesf

Input box and more..

Postby crsk » Tue Aug 05, 2003 1:36 am

Right I managed to find my mistakes in the previous code...

Now what I wanna do is...

have a php page with just a input box, in this box I enter an ID number, this ID number relates to someone in my DB in mySQL, it will then extract data like firstname lastname building and there picture and dump into into another php file... any ideas on where to begin?

I've been dumped with this work coz the other guy is off ill for 3 months, I'm normally the java & asp guy.. so go slow as I'm a n00b :P
crsk
New php-forum User
New php-forum User
 
Posts: 6
Joined: Tue Aug 05, 2003 12:28 am

Postby sigix » Tue Aug 05, 2003 2:09 am

+Form input
| |
|__________|

-> show.php
for showing info
| |
| |
|________|
Make input box with name ID set the form method POST and action to page show.php(can change...)
now in show.php
connect to host & select database in which your table resides ..
$id=$HTTP_POST_VARS['ID'];
run this query
$result =mysql_query("SELECT * FROM ..table..name where uid=$id") or die ("sql problem ");
will extract all the information(record) of that particular id (unique). into $result variable;

Accessing the Table Columns :

while ($row=mysql_fetch_array($result)){
echo $row[0];
....
...} // will show all the record data;
0 indicates the first column(field) of that table
you can use the name of table field
like
$row['name'];
now the information that you want to display echo that record column value


if you can't understand. :?: read the mysql functions from php.net :!:
sigix
php-forum Active User
php-forum Active User
 
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Re: Input box and more..

Postby swirlee » Tue Aug 05, 2003 6:20 am

crsk wrote:Now what I wanna do is...

have a php page with just a input box, in this box I enter an ID number, this ID number relates to someone in my DB in mySQL, it will then extract data like firstname lastname building and there picture and dump into into another php file... any ideas on where to begin?


This is pretty much the most basic exercise in any MySQL/PHP textbook or tutorial. I recommend you start from the beginning.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.