php - Display a message if column doesn't exist? -


i'm building app, , creates urls based on id.

for example edit item link opens kind of url website.com/update_item.php?uid=1

if change id in url item id not created me , don't have access edit it, display following message: "you don't have access edit item!"

the question is, how can display same message id's not exist in database? how can check either id or not registered in database?

currently if type in id not exist displays blank page.

here code

$list_id = $_get["uid"]; $l_title = "select * list_items `id`='$list_id'" ; $query = $pdo->prepare($l_title); $query->execute(); $list = $query ->fetchall(); 

the if code

if ($_session['fbid'] == $item['user_id']) {  .... 

where $_session['fbid'] logged in facebook user , $item['user_id'] id of user created list.

check query results, if result empty, display message

$list_id = $_get["uid"]; $l_title = "select * list_items `id`='$list_id'" ; $query = $pdo->prepare($l_title); $query->execute(); $list = $query ->fetchall(); if(!$list || empty($list)){    echo "your message"; } 

the if code

if ($_session['fbid'] == $item['user_id']) {  ................. 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -