Question : php and mysql search

i have the following codes...and what i want is if some one insert search key word and select table i will search the table and show result..

but it seems i have two issues...
1) i can't print the array...in formal way...not print_r style...i mean print filed name of the selected table with its search related content.
2) if no images, show no record found.

thanks.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
FORM...
 
  
Insert Search Keyword Select table
 
PHP CODE. 0) { echo "\n"; while($row = mysql_fetch_assoc($result)) { $results[] = $row; } mysql_close($con) ?>
Open in New Window Select All

Answer : php and mysql search

My bet is that cxr has it right about constructing this query, but I would recommend that before you plug that solution into the script, you take a basic step toward understanding data dependent programming issues.  Print the data out so you can see what you have created in there.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
while($row = mysql_fetch_assoc($result)) {
        $columns[] = $row["Field"] + " LIKE '%" . $search . "%'";
}
 
 
// DATA VISUALIZATION
// LET US SEE IF WE ARE GETTING WHAT WE WANT
var_dump($columns); die();
// END OF VISUALIZATION 
 
 
$sql = "SELECT * FROM " .$table;
Open in New Window Select All
Random Solutions  
 
programming4us programming4us