Alias for table – wrong result
-
I have the impression that aliasses for tables give a strange result. See code under.
Both statements are valid in Mysql, but not in PHP CodeThe first statement gives a result:
35 KameroenAnd the second:
Travelid Travelwhich are the headers.
Thanks,
Herman<?php
global $wpdb;
$sql = “SELECT TravelId, Travel
FROM tr_Travel
WHERE tr_Travel.TravelId = 35″;Echo “
</BR>”.$sql;$r = $wpdb->get_row($sql);
Echo “
</BR>”.$r->TravelId.” “.$r->Travel;$sql = “SELECT t.TravelId, t.Travel
FROM tr_Travel t
WHERE t.TravelId = 35″;Echo “
</BR>”.$sql;$r = $wpdb->get_row($sql);
Echo “
</BR>”.$r->t.TravelId.” “.$r->t.Travel;?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Alias for table – wrong result’ is closed to new replies.