-
is the syntax right?
Here's my php code, but when I echo $result;, nothing happens. Is this syntax right?
$sql="Select * From COMPANY As C Inner Join ACTIVITY AS A On A.C_NUMBER = C.C_ID
Where C.A_DATE = '$date'";
$result = mysql_query($sql)
-
$sql="Select * From COMPANY As C Inner Join ACTIVITY AS A On A.C_NUMBER = C.C_ID Where C.A_DATE ='".$date."'";
in a single line...
and try to avoid the word "$date" , just put $v_date
-
Ok, I shortened it a lot, Here's my php code.
<?php
$hostname = "10.0.0.127";
$username = "*";
$password = "blues7";
$database = "test";
$connection = mysql_connect($hostname , $username , $password)
or die("cannot make connection");
$db = mysql_selectdb($database , $connection)
or die("cannot find database");
$sql="Select * From COMPANY As C Inner Join ACTIVITY AS A On A.C_NUMBER = C.C_ID Where A.A_DATE ='".$date."'";
$result = mysql_query($sql) or die(mysql_error());
$numofrows = mysql_num_rows($result);
?>
heres some more to display the results of the query in a table..
while ($row = mysql_fetch_object($result)){
print "<TD>".$row->C_NAME."</TD>";
print "<TD>".$row->C_CITY.", ".$row->C_STATE."</TD>";
print "<TD>".$row->C_DESC."</TD>";
print "<TD>".$row->RATIONALE."</TD>";
print "<td>".$row->contact_NAME."</TD>";
print "<td>".$row->contact_PHONE."</td>";
print "<TD>".$row->A_DATE."</TD>";
print "<TD>".$row->A_DESC."</TD>";
print "<td>".$row->NEXT."</TD>";
print "<td>".$row->MEDIVAS."</td>";
print "</TR>\n";
}
for some reason, it returns only the results where C_NUMBER is equal in the ACTIVITY table, not where A_DATEs' are equal. Shouldn't the query return only instances where A_DATE's are equal.
thanks
-
try this:
select a.A_fields, c.C_fields from activity a, company c
where a.A_DATE in (set of date)
and a.C_number=c.C_number
-
I don't want to make you mad, so can you please check my other thread?
-
You can manipulate the date variable as a string field..
Check this out..
(try a date like 6/2/05)
http://www.locatehomes.com/test/activities.php
Any questions about the connection Class will be welcome.
I'll remove it in 2 days.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|