Jump to content

SELECTing data from MySql


billli

Recommended Posts

Hi:

 

question 1:

suppose that I have the following table:

 

table1 with the columns:

id

name

age

email

address

company

... and 20 other fields.

 

 

and i need to select the data from this table, but say i only need 5, which one would be faster?

SELECT * FROM table1

 

or

 

SELECT id, name, age, address, company FROM table1

 

same situation, but what if i need to select only certain fields from multi tables that are joined together?

 

 

question 2:

$query="SELECT * FROM table1"
$result=mysql_result($query);
while($data=mysql_fetch_array($result,MYSQL_ASSOC)){ // If I add MYSQL_ASSOC, would this also speed up the performance of my code?

}

 

thanks

 

Link to comment
https://forums.phpfreaks.com/topic/108467-selecting-data-from-mysql/
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.