Use COUNT, internally the server will process the request differently.
When doing COUNT, the server will only allocate memory to store the result of the count.
When using mysql_num_rows, the server will process the entire result set, allocate memory for all those results, and put the server in fetching mode, which involves a lot of different details, such as locking.
Think of it like the following pseudo scenario:
1) Hey Bob, how many people are in the class room? (count)
2) Hey Bob, get me a list of all the people in the classroom, ... I'll calculate the number of people myself (mysql_num_rows)

Different Count and Mysql_num_rows in MYSQL

Unknown Reply 7:25 AM

Use  COUNT , internally the server will process the request differently. When doing  COUNT , the server will only allocate memory to stor...

he innodb storage engine supports foreign keys in Mysql.


To create foreign keys in phpmyadmin :
1. Convert both tables into innodb, if they are not already.
2. View the structure of the table which will have a foreign key. Make the referencing field an INDEX.
3. Now come back to structure view and click Relation view.
Phpmyadmin Relation View Link
Phpmyadmin Relation View Link
In the Relation view page the field (which was made an INDEX) can be made a foreign key referencing to some other field in another table.
Phpmyadmin Foreign Key
Phpmyadmin Foreign Key
That should do it.

source : http://www.binarytides.com/create-foreign-key-phpmyadmin/

How to add foreign key PHPMYADMIN or MYSQL

Unknown Reply 3:25 PM

he innodb storage engine supports foreign keys in Mysql. To create foreign keys in phpmyadmin : 1. Convert both tables into innodb, i...

First you must create a file. with everything. i assume my filename is bigdump.php. and write this code:

<?php
mysql_connect('servername','username','password');

mysql_select_db('databasename');

$sql = "LOAD DATA LOCAL

INFILE 'data.csv'

INTO TABLE data

FIELDS

       TERMINATED BY ','

       OPTIONALLY ENCLOSED BY '\"'";

$insert = mysql_query($sql);

if($insert)

  echo 'success';

else

  die('error : ' . mysql_error());

?>

and now put in htdocs. and dont forget to move your csv file to htdocs too. and run it. TARAAA.. you got you want :)

How to import large CSV file to your Mysql or PHPMYADMIN

Unknown Reply 3:24 PM

First you must create a file. with everything. i assume my filename is bigdump.php. and write this code: <?php mysql_connect('serv...

Search

Ikuti Channel Youtube Aku Yaa.. Jangan Lupa di subscribe. Terima kasih.

Popular Posts

Translate