darkfreaks Posted October 8, 2007 Share Posted October 8, 2007 <?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 ;} ?> Quote Link to comment Share on other sites More sharing options...
monkeybidz Posted October 8, 2007 Author Share Posted October 8, 2007 What would i use there? The user will just see the current page instead of heading to error page. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 8, 2007 Share Posted October 8, 2007 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(); } ?> Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 8, 2007 Share Posted October 8, 2007 leave it blank it would do nothing if it matched if it doesnt match it will error and redirect you to whatever page Quote Link to comment Share on other sites More sharing options...
monkeybidz Posted October 8, 2007 Author Share Posted October 8, 2007 I just noticed sb_id in both tables "sbdtng_members & sbdtng_favorites" is present, but in members is $idsoftbidz and in favorites it represents row number or different id. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 8, 2007 Share Posted October 8, 2007 would that effect the code? ??? Quote Link to comment Share on other sites More sharing options...
monkeybidz Posted October 8, 2007 Author Share Posted October 8, 2007 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. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 8, 2007 Share Posted October 8, 2007 then try that and see if it works? ??? Quote Link to comment Share on other sites More sharing options...
monkeybidz Posted October 10, 2007 Author Share Posted October 10, 2007 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'; } Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 10, 2007 Share Posted October 10, 2007 <?php $num_rows=mysql_num_rows($result); if( $num_rows!=2|| $sb_private == 'Yes'){ ?> Quote Link to comment Share on other sites More sharing options...
monkeybidz Posted October 10, 2007 Author Share Posted October 10, 2007 What do i use for $result? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 10, 2007 Share Posted October 10, 2007 the sql variable Quote Link to comment Share on other sites More sharing options...
monkeybidz Posted October 10, 2007 Author Share Posted October 10, 2007 Is this Ok? $result=mysql_query($sql); Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 10, 2007 Share Posted October 10, 2007 thats fine as long as you dont have mysql_query in your sql variable Quote Link to comment Share on other sites More sharing options...
monkeybidz Posted October 10, 2007 Author Share Posted October 10, 2007 Well, i get this error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 10, 2007 Share Posted October 10, 2007 replace mysql_num_rows with either mysql_fetch_array or mysql_fetch_assoc and let me know what it turns up? Quote Link to comment Share on other sites More sharing options...
monkeybidz Posted October 10, 2007 Author Share Posted October 10, 2007 mysql_fetch_array returned: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource mysql_fetch_assoc returned: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 10, 2007 Share Posted October 10, 2007 Edit: that wont work either your query is wrong! it needs to be like i said earlier <?php $sql=mysql_query('insert stff here'); $num_rows= mysql_num_rows($sql); ?> Quote Link to comment Share on other sites More sharing options...
monkeybidz Posted October 10, 2007 Author Share Posted October 10, 2007 Still get: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 10, 2007 Share Posted October 10, 2007 code and line number? Quote Link to comment Share on other sites More sharing options...
monkeybidz Posted October 10, 2007 Author Share Posted October 10, 2007 Line 33 which is: $num_rows=mysql_num_rows($sql); Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 10, 2007 Share Posted October 10, 2007 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"; ?> Quote Link to comment Share on other sites More sharing options...
monkeybidz Posted October 10, 2007 Author Share Posted October 10, 2007 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(); } Thanks for the help guys. Could not have done it without you. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 10, 2007 Share Posted October 10, 2007 congratz you did something yourself Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.