php SQL statement to print

Discussion in 'PHP' started by wilburforce, Oct 16, 2006.

  1. #1
    If i want to print a message

    "Has Private Pictures"
    if a member has private images from a SQL table row "catid"

    do i do it in php or SQL?
    I have no idea how to do it

    0 = public
    1 = private
     
    wilburforce, Oct 16, 2006 IP
  2. ketan9

    ketan9 Active Member

    Messages:
    548
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #2
    In short, you need to do it in both PHP and SQL. You need to save '0' or '1' value in MySQL table and during the query check if it is 0 or 1 and show the message or picture accordingly.
     
    ketan9, Oct 16, 2006 IP
  3. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #3
    First I would check the value:

    
    //Connect to mysql database
    
    $check_pms = mysql_fetch_row(mysql_query("SELECT `catid` FROM `tablename` WHERE `user_id`='USERID'"));
    
    if($check_pms[0] == ){ echo 'Private ';}else{ echo 'Public ';}
    echo 'Pictures';
    
    //Disconnect form mysql database
    
    
    PHP:
    Peace,
     
    Barti1987, Oct 16, 2006 IP