Im trying to do a search function at the moment. I have done it before, but now I have to take the values from a Form in one PHP File and use it in another PHP File.
So I try to save the query in a global variable, but I keep getting errors.
"$GLOBALS['searchquery'] = SELECT Titel, Vorname, Nachname, Unternehmen, Gruppe FROM mitglieder WHERE Titel LIKE '%$GLOBALS['searchq']%' OR Vorname LIKE '%$GLOBALS['searchq']%' OR Nachname LIKE '%$GLOBALS['searchq']%' OR Unternehmen LIKE '%$GLOBALS['searchq']%' OR Gruppe LIKE '%$GLOBALS['searchq']%'";
If I do it like this it says: Unexpected "
$GLOBALS['searchquery'] = "SELECT Titel, Vorname, Nachname, Unternehmen, Gruppe FROM mitglieder WHERE Titel LIKE '".%$GLOBALS['searchq']%."' OR Vorname LIKE '".%$GLOBALS['searchq']%."' OR Nachname LIKE '".%$GLOBALS['searchq']%."' OR Unternehmen LIKE '".%$GLOBALS['searchq']%."' OR Gruppe LIKE '".%$GLOBALS['searchq']%."' ";
If I do it like this it says: Unexpected %
$GLOBALS['searchquery'] = "SELECT Titel, Vorname, Nachname, Unternehmen, Gruppe FROM mitglieder WHERE Titel LIKE '"%.$GLOBALS['searchq'].%"' OR Vorname LIKE '"%.$GLOBALS['searchq'].%"' OR Nachname LIKE '"%.$GLOBALS['searchq'].%"' OR Unternehmen LIKE '"%.$GLOBALS['searchq'].%"' OR Gruppe LIKE '"%.$GLOBALS['searchq'].%"' ";
And If I do it like this it says: Unexpected .
I realize theres alot of similar questions, but I havent found one that uses % so maybe that changes something about how I have to do the query?