jeff5656 Posted December 9, 2008 Share Posted December 9, 2008 Thnkx for all help so far. I have this error message can someone help me? Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1, dos 2 WHERE 1.id_incr = 2.pt_id and id_incr = '8'' at line 1 $consultsq1 = "SELECT 1.id_incr, 2.pt_id, 1.rm_loc FROM icu 1, dos 2 WHERE 1.id_incr = 2.pt_id and id_incr = '" . $_GET['id'] . "'"; Link to comment https://forums.phpfreaks.com/topic/136264-invalid-query-syntrax-error/ Share on other sites More sharing options...
amclean Posted December 9, 2008 Share Posted December 9, 2008 it could be that the icu 1, dos 2 need to be quoted, otherwise the database will interpret the space as a delimiter instead of just a space. $consultsq1 = "SELECT 1.id_incr, 2.pt_id, 1.rm_loc FROM 'icu 1', 'dos 2' WHERE 1.id_incr = 2.pt_id and id_incr = '" . $_GET['id'] . "'"; Link to comment https://forums.phpfreaks.com/topic/136264-invalid-query-syntrax-error/#findComment-710880 Share on other sites More sharing options...
revraz Posted December 9, 2008 Share Posted December 9, 2008 Because you can't use Numbers as Aliases. Link to comment https://forums.phpfreaks.com/topic/136264-invalid-query-syntrax-error/#findComment-710884 Share on other sites More sharing options...
amclean Posted December 9, 2008 Share Posted December 9, 2008 ah, yes, right. Missed that. Read the first half and assumed the tables were simply named icu 1 and dos 2. I'll read more carefully next time. Link to comment https://forums.phpfreaks.com/topic/136264-invalid-query-syntrax-error/#findComment-710888 Share on other sites More sharing options...
revraz Posted December 9, 2008 Share Posted December 9, 2008 Can't have spaces in table names either Link to comment https://forums.phpfreaks.com/topic/136264-invalid-query-syntrax-error/#findComment-710893 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.