like statement for user_login ?>
I have a mysql query the gets data based on the user_login. We’ve recently upgraged to allow multiple users from a company to access the site. The main login is 5 characters and additional users would get a 3 char suffix. So now I need to figure out how to use a like statement with the login:
WHERE CustomerID like '<?php $current_user->user_login ?>%'
which gives me an error:
Error: 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 ‘MainLogin’%’ order by InvoiceDate desc’ at line 1
IF there is a better way of doing this I would also like to know that as well.
The original working query looks like this:
select SalesOrderNumber , InvoiceNumber , JobName , InvoiceDate , NetAmount, Freight FROM `Invoice` where InvoiceDate BETWEEN DATE(NOW()) - INTERVAL 180 DAY AND DATE(NOW()) and CustomerID = <?php $current_user->user_login ?> order by InvoiceDate desc