StirCrazy Posted July 24, 2006 Share Posted July 24, 2006 Hi Folks,I'm back to pick your brains again (or bug the hell outa you with my constant novice questions).This is the current sql query i'm using:- $sql = my_query("select g.name, o.date from orders o, gifts g where o.user_id = '" . mysql_real_escape_string($_SESSION['offers_user']) . "' and g.id=o.gift_id");I now want it to only pick out the data from the orders tbl where site='$site_prefix' (simply adding it on the end doesn't work) $sql = my_query("select g.name, o.date from orders o, gifts g where o.user_id = '" . mysql_real_escape_string($_SESSION['offers_user']) . "' and g.id=o.gift_id [b]and site='$site_prefix'[/b]");while (list....blah blah blahAny ideas?Thanks guys :) Quote Link to comment Share on other sites More sharing options...
cunoodle2 Posted July 24, 2006 Share Posted July 24, 2006 Try this..."' and g.id=o.gift_id and site='".$site_prefix."'); Quote Link to comment Share on other sites More sharing options...
Barand Posted July 24, 2006 Share Posted July 24, 2006 TIPInstead of $sql = mysql_query ("SELECT blah "), use[code]$query = "SELECT blah";$sql = mysql_query($query);[/code]Then if you have problems you canecho $query;to see if the submitted query looks OK. Quote Link to comment Share on other sites More sharing options...
StirCrazy Posted July 24, 2006 Author Share Posted July 24, 2006 cheers guys ~ it always turns out to be summit real simple doesn't it :Djust forgot the [b][color=red]o.[/color][/b]site='$site_prefix'");DOH!W.> 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.