Jump to content

fetch_row


hedonomania

Recommended Posts

Hi guys, I hav question concerning retriving the data from mysql.

I set the following code, but as a result i am getting a single cells in one column. Instead I would like to get the results as the whole rows with the cells i'm looking for. Any help? Thanks in advance!

 

$query_string="SELECT Type FROM $tablename WHERE name like'%$type%'";

$result_id=mysql_query($query_string,$mydb);

$column_count=mysql_num_fields($result_id);

print "<table border=1 align=center>\n";

$row=mysql_fetch_array($result_id);

 

while ($row=mysql_fetch_array($result_id)) {

print "<tr align=left valign=top>";

for ( $column_num=0;
 $column_num<$column_count;
 $column_num++)
 print "<td>$row[$column_num]</td>\n";
 
 print "</tr>\n";
 }

 print "</table>\n";

Link to comment
https://forums.phpfreaks.com/topic/285677-fetch_row/
Share on other sites

I think I didn't put my thoughts clearly :) i am getting my single column as a row now, which is not what i wanted.

I would like to get the results from the searched field plus the associated values from other fields in the database. e.g. when i have the dabase composed of name and surname fields and i search the name field, and i get John, i want to get not only the name but also the surname so i want to see John Muller... thanks!

Link to comment
https://forums.phpfreaks.com/topic/285677-fetch_row/#findComment-1466559
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.