How to seperate results in mysql $query?
-
$k = $_GET ['k']; $terms = explode(" ", $k); $query = "SELECT * FROM mattsdbone WHERE "; foreach ($terms as $each){ $i++; if ($i == 1) $query .= "category_name LIKE '%$each%' "; else $query .= "OR category_name LIKE '%$each%' "; } $query = mysql_query ($query); $numrows = mysql_num_rows ($query); if ($numrows > 0) { while ($row = mysql_fetch_assoc($query)){ $product_name= $row['product_name']; $description= $row['description']; $aw_deep_link= $row['aw_deep_link']; $aw_image_url= $row['aw_image_url']; $display_price= $row['display_price']; echo " <h2><a href='$aw_deep_link'>$product_name</a><h... <a href='$aw_deep_link'><img src='$aw_image_url'/></a> <a href='$aw_deep_link'>$description</a> <a href='$aw_deep_link'>$display_price</a>"... i want to seperate the results, ie to put borders around them, or to put them in tabes or grids, how do i do it? i want to add css to each result
-
Answer:
Add error_reporting(E_ALL), as the first line of your php file, just after the <?php That will show you a few errors to start with. I have seen your query a week ago, and you still have the same mistakes. Your line 6 is your first error (logical and construct)
Joe at Yahoo! Answers Visit the source
Other answers
Add error_reporting(E_ALL), as the first line of your php file, just after the <?php That will show you a few errors to start with. I have seen your query a week ago, and you still have the same mistakes. Your line 6 is your first error (logical and construct)
just "JR"
$result = mysql_query("SELECT * FROM {$table}"); if (!$result) { die("Query to show fields from table failed"); } $fields_num = mysql_num_fields($result); echo "<table><tr>"; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); echo "<td>{$field->name}</td>"; } echo "</tr>"; while($row = mysql_fetch_row($result)) { // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell){ echo "<td>$cell</td>"; } } echo "</tr>\n"; mysql_free_result($result);
Mark O
$result = mysql_query("SELECT * FROM {$table}"); if (!$result) { die("Query to show fields from table failed"); } $fields_num = mysql_num_fields($result); echo "<table><tr>"; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); echo "<td>{$field->name}</td>"; } echo "</tr>"; while($row = mysql_fetch_row($result)) { // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell){ echo "<td>$cell</td>"; } } echo "</tr>\n"; mysql_free_result($result);
Mark O
Related Q & A:
- How to completely backup all mysql databases?Best solution by Server Fault
- How to make only ONE Sql query?Best solution by Stack Overflow
- How do I perform this ActiveRecord query?Best solution by Stack Overflow
- How to make a MySql query faster?Best solution by Stack Overflow
- Is humsurfer.com a socialbookmarking site?? how are its results indexed so fast?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.