Function in query.

Gestart doorMarvinn7 reacties51 weergaven

8 berichten · pagina 1 van 1

Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hai.

Ik heb weer eens een probleempje... ik heb deze function:

[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]( ![/COLOR][URL="http://www.php.net/function_exists"]function_exists[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]mobile_user_agent_switch[/COLOR][COLOR= #007700]) ){
    function[/COLOR] mobile_user_agent_switch[COLOR= #007700](){[/COLOR]
        [COLOR= #0000BB]$device[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]
 
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR] [URL="http://www.php.net/stristr"]stristr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]HTTP_USER_AGENT[/COLOR][COLOR= #007700]],[/COLOR][COLOR= #DD0000]ipad[/COLOR][COLOR= #007700]) ) {[/COLOR]
            [COLOR= #0000BB]$device[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"ipad"[/COLOR][COLOR= #007700];
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR] [URL="http://www.php.net/stristr"]stristr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]HTTP_USER_AGENT[/COLOR][COLOR= #007700]],[/COLOR][COLOR= #DD0000]iphone[/COLOR][COLOR= #007700]) ||[/COLOR] [URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]HTTP_USER_AGENT[/COLOR][COLOR= #007700]],[/COLOR][COLOR= #DD0000]iphone[/COLOR][COLOR= #007700]) ) {[/COLOR]
            [COLOR= #0000BB]$device[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"iphone"[/COLOR][COLOR= #007700];
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR] [URL="http://www.php.net/stristr"]stristr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]HTTP_USER_AGENT[/COLOR][COLOR= #007700]],[/COLOR][COLOR= #DD0000]blackberry[/COLOR][COLOR= #007700]) ) {[/COLOR]
            [COLOR= #0000BB]$device[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"blackberry"[/COLOR][COLOR= #007700];
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR] [URL="http://www.php.net/stristr"]stristr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]HTTP_USER_AGENT[/COLOR][COLOR= #007700]],[/COLOR][COLOR= #DD0000]android[/COLOR][COLOR= #007700]) ) {[/COLOR]
            [COLOR= #0000BB]$device[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"android"[/COLOR][COLOR= #007700];
        }[/COLOR]
 
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR] [COLOR= #0000BB]$device[/COLOR] [COLOR= #007700]) {[/COLOR]
            [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$device[/COLOR][COLOR= #007700]; 
        }[/COLOR] [URL="http://www.php.net/return"]return[/URL] false[COLOR= #007700]; {[/COLOR]
            [URL="http://www.php.net/return"]return[/URL] false[COLOR= #007700];
        }
    }
}[/COLOR] ?>


En deze query:

[COLOR= #0000BB]<?php $viaquery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE leden SET via = .mobile_user_agent_switch WHERE member_id="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$viaquery[/COLOR][COLOR= #007700]) {[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"Gelukt"[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
}[/COLOR] ?>


Alleen hij update die query niet cry ik heb al geprobeerd met ". en met . en met kan iemand me helpen biggrin?

toevoeging op 7 mei 2012, 09:45:39:
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 at line 1
Is de error nu. (Had niet anders verwacht yummie)
0
Berichten
6.201
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php $viaquery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE leden SET via = "[/COLOR][COLOR= #007700].[/COLOR]mobile_user_agent_switch[COLOR= #007700]().[/COLOR][COLOR= #DD0000]" WHERE member_id="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$viaquery[/COLOR][COLOR= #007700]) {[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"Gelukt"[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
}[/COLOR] ?>


Zo lijkt me? Probeer eens
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nu: 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 WHERE member_id=1 at line 1

??

toevoeging op 7 mei 2012, 09:53:14:
En: Unknown column android in field list

Wat houd dat in dan?
0
Berichten
6.201
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php $viaquery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE leden SET via = "[/COLOR][COLOR= #007700].[/COLOR]mobile_user_agent_switch[COLOR= #007700]().[/COLOR][COLOR= #DD0000]" WHERE member_id="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$viaquery[/COLOR][COLOR= #007700]) {[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"Gelukt"[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
}[/COLOR] ?>


Zo dan? Even de user agent tussen en gezet wink
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Tjonge ik ben dom aan het worden vrees ik cry
Tnx emo
0
Berichten
6.201
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Werkt t nu? smile
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja, alleen jammer dat ik de fout zelf niet zag santabaard Maarja tnx biggrin
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je kan beter gwn heel de useragent opslaan in de "via" field.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren