Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select Help..rowname1 = $var1 and rowname1 = $var2

Author  Topic 

pjb2u
Starting Member

1 Post

Posted - 2013-05-13 : 09:40:15
Currently I am using:

$query_rsSearchOrigin = "SELECT * FROM holidays WHERE country = '$origin'";
$rsSearchOrigin = mysql_query($query_rsSearchOrigin) or die(mysql_error());
$row_rsSearchOrigin = mysql_fetch_assoc($rsSearchOrigin);
$totalRows_rsSearchOrigin = mysql_num_rows($rsSearchOrigin);

$query_rsSearchDestination = "SELECT * FROM holidays WHERE country = '$destination'";
$rsSearchDestination = mysql_query($query_rsSearchDestination) or die(mysql_error());
$row_rsSearchDestination = mysql_fetch_assoc($rsSearchDestination);
$totalRows_rsSearchDestination = mysql_num_rows($rsSearchDestination);


I want this to happen ideally:

$query_rsSearchOrigin = "SELECT * FROM holidays WHERE country = '$origin' AND country = '$destination'";


Please help?

Thanks!

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-05-13 : 10:26:40
If you are using MySQL, this may not be the appropriate forum - this forum is for Microsoft SQL Server. You would likely get faster and better responses at a MySQL forum.

My guess is that you need an OR condition rather than AND if you are looking for holidays in the origin country or the destination country
$query_rsSearchOrigin = "SELECT * FROM holidays WHERE country = '$origin' OR country = '$destination'";
Go to Top of Page
   

- Advertisement -