NitroXy/import-test — Issue #163: krasch om användare försöker köpa biljett men inte är medlem
Author: ext
Created: 2012-01-28 21:22:24+00:00
State: open

```
Automatically imported from Trac.
Originally reported by 'ext' as #161.
```

**Steps to reproduce**
1. logga in som användare som inte är medlem
2. 'Biljetthantering'
3. 'Boka biljetter'

**Expected result**
Ett meddelande om att man inte är medlem

**Actual result**
Krash

```
MySQLi error: 1064 (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 'AND status >= ?' at line 7).
The attempted query was

SELECT
COUNT(*)
FROM
tickets JOIN
orders ON (tickets.order_id=orders.order_id)
WHERE
AND status >= ?

The error was encountered in :

#0 UltimateDatabaseConnection->prepare_full(
SELECT
COUNT(*)
FROM
tickets JOIN
orders ON (tickets.order_id=orders.order_id)
WHERE
AND status >= ?, Array ([0] => ), i, 0)
#7 call_user_func_array(Array ([0] => UltimateDatabaseConnection Object ([] => testing.mysql.nitroxy.com,[] => 3306,[] => nitroxy_unstable,[] => utf8,[] => ,[] => 13,[] => 0.436997652054,[] => 1267837897.03,[] => 1),[1] => prepare_full), Array ([0] =>
SELECT
COUNT(*)
FROM
tickets JOIN
orders ON (tickets.order_id=orders.order_id)
WHERE
AND status >= ?,[1] => Array ([0] => ),[2] => i,[3] => 0)) called at [/home/svn/exports/nitroxy-unstable/trunk/classes/UltimateDatabaseConnection.php:176]
#8 UltimateDatabaseConnection->prepare_fetch(
SELECT
COUNT(*)
FROM
tickets JOIN
orders ON (tickets.order_id=orders.order_id)
WHERE
AND status >= ?, Array ([0] => ), i, 0) called at [/home/svn/exports/nitroxy-unstable/trunk/classes/Event.php:25]
#7 Event::seats_in_use() called at [/home/svn/exports/nitroxy-unstable/trunk/classes/Event.php:30]
#8 Event::free_seats() called at [/home/svn/exports/nitroxy-unstable/trunk/content/main/ticket_buy.php:38]
#7 require(/home/svn/exports/nitroxy-unstable/trunk/content/main/ticket_buy.php) called at [/home/svn/exports/nitroxy-unstable/trunk/content/mainpage.php:19]
#8 require_once(/home/svn/exports/nitroxy-unstable/trunk/content/mainpage.php) called at [/home/svn/exports/nitroxy-unstable/trunk/public/index.php:31]
```