This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sql="SELECT * FROM wp_postmeta WHERE `meta_key` LIKE '_thumbnail_id'" ; | |
$result=mysql_query($sql) or die (mysql_error()); | |
while ($var = mysql_fetch_array($result) ) { | |
$post_id = $var['post_id']; | |
$meta_id = $var['meta_id']; | |
print 'post_id : '.$post_id.'<p></p>'; | |
$sql2="SELECT * FROM wp_posts WHERE `post_parent` = '$post_id' AND post_type = 'attachment' LIMIT 1" ; | |
$result2=mysql_query($sql2) or die (mysql_error()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT prenom, COUNT(*) AS nbpre | |
FROM tablemembres | |
GROUP BY prenom; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$num_rows = mysql_num_rows($result); | |
LTRIM pour virer le white space de gauche | |
mb_strtoupper (majuscule accent eb minuscule) | |
mysql_real_escape_string | |
htmlspecialchars | |
htmlentities | |
ucwords(strtolower($bar)) | |
ucfirst(strtolower($bar)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sql2="SELECT *, ( 6371 * acos( cos( radians('$var[latitude]') ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians('$var[longitude]') ) + sin( radians('$var[latitude]') ) * sin( radians( latitude ) ) ) ) AS distance | |
FROM cm_gps HAVING distance > 0.01 AND distance < 25 ORDER BY distance LIMIT 0 , 20;"; | |
Fonction mysql de calcul en live : | |
$sql="SELECT *, get_distance_metres('46', '5.416667', latitude, longitude) | |
AS proximite | |
FROM cm_CAF | |
HAVING proximite < 50000 ORDER BY proximite ASC | |
LIMIT 10"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE ma_table MODIFY COLUMN ma_colonne type_de_ma_colonne AFTER autre_colonne |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT *FROM `cm_datas` ORDER BY cast(`densite` as decimal) DESC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
en sql | |
SET @rank := 0; | |
SELECT nom_ville,CODGEO,nbr_habitants,@rank := @rank + 1 AS rank | |
FROM cm_datas | |
ORDER BY cast(`nbr_habitants` as decimal) DESC | |
en php | |
mysql_query("SET @rank:=0;"); | |
$sql=" | |
SELECT nom_ville,CODGEO,nbr_habitants,@rank := @rank + 1 AS rank |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update table_name set field_name = replace(field_name,'string_to_find','string_to_replace'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DISTINCT ID FROM wp_posts WHERE ID NOT IN (SELECT post_id FROM wp_postmeta WHERE wp_postmeta.meta_key='descriptionspin') AND post_status= 'publish' AND post_type='post' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER IGNORE TABLE membre ADD UNIQUE INDEX(nom,prenom); |
OlderNewer