Jump to content

MySQL Query????


tuxbuddy

Recommended Posts

Can yu tell me how gonna I write the code now:

Should I try like this:

 

$sql1 = mysql_query("SELECT id from users where loginname ='".$myusername."'",$link);

 

$row = mysql_fetch_row($sql1);

echo "$row[0]";

 

#while($result=mysql_fetch_row($sql1 ))

#{

#echo $result;

#$uid=$result["id"];

#echo "$uid";

 

}

 

$result2 = mysql_query("SELECT incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users WHERE (incidents.owner_id = users.id) OR (incidents.contact_id = '".$row[0]."')", $link);

 

 

But it is not working

Link to comment
https://forums.phpfreaks.com/topic/101337-mysql-query/page/2/#findComment-519418
Share on other sites

now assign variable....


$uid=$row[0];
echo $uid;

$result2 = mysql_query("SELECT incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users WHERE (incidents.owner_id = users.id) OR (incidents.contact_id = '".$uid."')", $link);
echo ("SELECT incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users WHERE (incidents.owner_id = users.id) OR (incidents.contact_id = '".$uid."')";
echo $result2 ;


if echo $result2 ; displays some resource then query is running ..if not query has some problem...in it..

Link to comment
https://forums.phpfreaks.com/topic/101337-mysql-query/page/2/#findComment-520075
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.