<?php include 'connect.php';?>
<?php include 'functions.php';?>
<?php include 'header.php';?>
<?php
if(isset($_GET['user']) && !empty($_GET['user'])){
$user=$_GET['user'];
}else{
$user=$_SESSION['user_id'];
}
$my_id = $_SESSION['user_id'];
$username=getuser($user,'username');
?>
<h3> <?php echo $username; ?> </h3>
<?php
if($user != $my_id){
$check_frnd_query=mysql_query("select id from frnds where (user_one='$my_id' and user_two='$user') or (user_one='$user' and user_two='$my_id')");
if(mysql_num_rows($check_frnd_query) == 1){
echo "<a href=''>already frnd</a> | <a href='actions.php?action=unfrnd&user'> Unfrnd $username</a>";
}else {
$from_query = mysql_query("SELECT 'id' FROM 'frnd_req' WHERE 'from'='$user' AND 'to'='$my_id'");
$to_query = mysql_query("SELECT 'id' FROM 'frnd_req' WHERE 'from'='$my_id' AND 'to'='$user'");
if (mysql_num_rows($from_query) == 1)
{
echo "<a href=''>ignore </a> | <a href='actions.php?action?action=accept&user=$user'> accept </a>";
} else if (mysql_num_rows($to_query) == 1)
{
echo "<a href='actions.php?action=cancel1&user=$user'>cancel</a>";
}else{
echo "<a href='actions.php?action=send&user=$user'> send req</a>";
}
}}
?>
//// i have error in two lines is if (mysql_num_rows($from_query) == 1) & else if (mysql_num_rows($to_query) == 1) plz help me
Ambrish_1
0
Newbie Poster
Recommended Answers
Jump to PostWhat are the errors you are gettings?
From a cursory glance, it looks like you are getting a cursor error due to not freeing the resource after your initial query...
Jump to Postaccording to
http://www.php.net/mysql_query
mysql_query will return false if the connection does not have permission to access the table.
It would seem your user for the database may not have correct privilege.
As the …
Jump to PostAs a standard practice you should be testing your queries before you try doing anything with them. Ideally this would be with an if statement so but at the very least you should add a die statement to your query. Add this and see what gets outputted:
All 12 Replies
ryantroop
177
Practically a Master Poster
Ambrish_1
0
Newbie Poster
Ambrish_1
0
Newbie Poster
ryantroop
177
Practically a Master Poster
Ambrish_1
0
Newbie Poster
GliderPilot
33
Posting Whiz
Ambrish_1
0
Newbie Poster
urtrivedi
276
Nearly a Posting Virtuoso
Ambrish_1
0
Newbie Poster
GliderPilot
33
Posting Whiz
Ambrish_1
0
Newbie Poster
GliderPilot
33
Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.