View Single Post
Old 06-16-2006, 01:57 PM   #1 (permalink)
franknu
Junior Member
 
Join Date: Jun 2006
Posts: 1
Default Associating Colums and tables

Ok, I have a database and i want to associate colums to be display when a user type in something in categories. I created a diffrent table for almost everything. I was just wondering if i have to create a full table with the information i want to associate or if it is ok to have in diffrent tables

here is the code


PHP Code:
<?php 
print_r
($_POST); 

if(isset(
$_POST['submit'])) 


$host "localhost"
$username "localhost"
$password "abc123"
$database "contacts"

if(isset(
$_POST['Categories'])) 

    
$Categories trim(addslashes($_POST['Categories'])); 

else 

    echo 
'No Category Passed'
    exit; 


$db mysql_connect($host$username$password); 
mysql_select_db($database); 
$query "SELECT * FROM Categories WHERE Categories LIKE '%$Categories%'"
$result mysql_query($query) or die (mysql_error()); 
$num_result mysql_num_rows($result); 

if(
$num_result == 0

    echo(
"No Results found."); 
    exit; 


echo 
"<p>Number of business found: $num_result </p>"
while(
$row mysql_fetch_assoc($result)) 

     echo 
'<p><strong>Business Name (' stripslashes($row['BusinessName']) . ')'
     echo 
'(' $row['slogan'] . ')</strong><br />'
     echo 
'Address (' stripslashes($row['BusinessAddress']) . ')<br />'
     echo 
'State (' stripslashes($row['make']) . ')<br />'
     echo 
'City (' stripslashes($row['type']) . ')<br />'
     echo 
'Tel (' stripslashes($row['tel']) . ')<br /></p>'


?>
this is what i am displaying

Array ( [make] => Massachusetts [type] => Lawrence [Categories] => printing [textfield] => [submit] => Search )
Number of business found: 1

BusinessName ()()
Address ()
State ()
City ()
Tel ()

i have a business name MASS AD
Address 19 Central St
In MAKE MASSACHUSETTS
TYPE LAWRENCE
978.327.5139

how can i make like that for now it is just showing that i have a category Name "Printing"
franknu is offline   Reply With Quote
Sponsored Links