Jump to content

[SOLVED] Check mysql database for data


monkeybidz

Recommended Posts

<?php ///if uid not equal sblist and set to yes
if($softbiz_sbid_listz!=$uid || $sb_private == 'Yes'){
    header("Location: gen_confirm.php?errmsg=".urlencode
("This user has profile set to private. Only friends can view this page.
<BR><a href=addme_request.php? >Click here to request to be added.</a>"));
die();
}

///if set to no and it matches to display the profile
elseif ($softbiz_sbid_listz=$uid || $sb_private == 'No'){ other code here ;}
?>

Link to comment
Share on other sites

switch it around then

 

 

<?php

///if set to no and it matches to display the profile
if ($softbiz_sbid_listz=$uid || $sb_private == 'No'){ }


elseif($softbiz_sbid_listz!=$uid || $sb_private == 'Yes'){
    header("Location: gen_confirm.php?errmsg=".urlencode
("This user has profile set to private. Only friends can view this page.
<BR><a href=addme_request.php? >Click here to request to be added.</a>"));
die();
}

?>

Link to comment
Share on other sites

Yes,  we are asking for sd_id to = $idsoftbiz which would give us the id for the owner of the page. This would be found in Table sbdtng_members. In sbdtng_favorites, sb_id = a row or line number which will vary depending on the number of friends created by users. it is a whole entirely diffrent deal. So the code we used at first would probably have worked without selecting sb_id.

Link to comment
Share on other sites

OK, the creators of the script will take too long to customize it for me. I tried this query directly in the Mysql and it works. What i don't know how to do is get the rows for this query. I now know that the number of rows have to be 2 for this query. How do i change this code to where -- if sql rows are less than 2 && sb_private =='Yes' return the error. Lets use $ret & $row.  ??? This should be easy for you guys.

 

$uid=$_SESSION["sbdtng_userid"];

$sql='SELECT * FROM `sbdtng_favorites` WHERE `sb_uid`=$idsoftbiz AND `sb_offer_id`=$uid';

if(--SQL-ROWS-DO-NOT-EQUAL-2 && $sb_private == 'Yes'){
    header("Location: gen_confirm.php?errmsg=".urlencode("This user has profile set to private. Only friends can view this page.<BR><a href=addme_request.php? >Click here to request to be added.</a>"));
die();
}else{
     $sb_private == 'No';
}

   

Link to comment
Share on other sites

oh i remember why you need to also have a connection so like

 

 

<?php

$link = mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db("database", $link);

$result = mysql_query("SELECT * FROM table1", $link);
$num_rows = mysql_num_rows($result);

echo "$num_rows Rows\n";

?> 

Link to comment
Share on other sites

I got it! It's about time.

 

$uid=$_SESSION["sbdtng_userid"];

$sql="SELECT * FROM `sbdtng_favorites` WHERE `sb_uid`=$idsoftbiz AND `sb_offer_id`=sb_offer_id";
$sql2="SELECT * FROM `sbdtng_members` WHERE `sb_id`=$idsoftbiz AND `sb_private`=`sb_private`";
$row=mysql_fetch_array(mysql_query($sql));
$row2=mysql_fetch_array(mysql_query($sql2));

$sb_offer_id=$row["sb_offer_id"];
$sb_private=$row2["sb_private"];

if($sb_offer_id != $uid && $sb_private == 'Yes'){
    header("Location: gen_confirm.php?errmsg=".urlencode("This user has profile set to private. Only friends can view this page.<BR><a href=addme_request.php? >Click here to request to be added.</a>"));
die();
}

:D

 

Thanks for the help guys. Could not have done it without you.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.