의이문자열이 이미 있는지 확인하고 끝에 +1을 추가하는 방법은 무엇입니까?
$strig = "red-hot-chili-peppers-californication";
이미 내 데이터베이스에있는 경우 내가 확인한다고 가정 해 봅시다 :
$query = dbquery("SELECT * FROM `videos` WHERE `slug` = '".$strig."';");
$checkvideo = dbrows($query);
if($checkvideo == 1){
// the code to be executed to rename $strig
// to "red-hot-chili-peppers-californication-2"
// it would be great to work even if $string is defined as
// "red-hot-chili-peppers-californication-2" and
// rename $string to "red-hot-chili-peppers-californication-3" and so on...
}
내가 더 친화적 인 URL 구조에 대해 고유 한 슬러그를 만드는이 작업을 수행 할 수 있습니다.
감사합니다.
여기서 'dbrows ($ query)'는 무엇을합니까? –
이것은 단지 mysql_num_rows 함수입니다. – m3tsys