Welcome visitor
* Login
* Register
It is currently September 20th, 2019, 1:48 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Server Side » PHP



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  MySQL database on PHP
PostPosted: February 4th, 2009, 8:54 pm 

Posts: 65
Hello agents.

I'd been out of the computers world for some 10 years or something, and now I'm trying to improve a little catalog that I'm developing for my business. Anyway, I'd been reading about databases, html forms, arrays, php, etc... and now what im doing is try to put all that together. So, these are some examples for my Html and Php files.

<form method="POST" action="catalog.php">

        <input type="text" name="product">
        <input type="submit" value="Check">
</form>

<?php

extract($_POST);
echo $product;
?>

Now, I don't want it just to write the product, instead of that I would like it to retrieve the info for that product from my database, and here's where I am, asking you for help. Anyways thank you for your cooperation, and have a good day.


Top
 Profile  
 
  Re: MySQL database on PHP
PostPosted: February 4th, 2009, 9:09 pm 
User avatar

Posts: 48
im not an expert, but id been doing something like that lately. heres the code id been usin, hope this can help u
mysql_connect('host' , 'user' , 'password');

mysql_select_db('database');

as u can see is the same info that u use to access the mysql database. then u will need to retrieve the row of the database that matches ur 'product'. if ur field on the db is called 'prods' use this code
$dbTable=mysql_query("SELECT * FROM databaseName WHERE prods='$product'"); 

$rowWithProductInfo=mysql_fetch_array($dbTable);

then u can break the row array and use the info from the vars as u wish


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Server Side » PHP


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron