taichimasta Posted October 30, 2008 Share Posted October 30, 2008 hi again , i just have a question i'm trying to get my query to execute within a function. i don't know whats wrong with it example: (looks like this) <?php function online(){ $change = "UPDATE person SET online='1' WHERE uid='$memeber'"; $status = @mysql_query($change) or die("\n couldn't read if you are online <br/>\n "); ?> } content <?php online(); ?> Doesn't send the query what am i doing wrong? Link to comment https://forums.phpfreaks.com/topic/130662-solved-function-query-not-working/ Share on other sites More sharing options...
jwilliam Posted October 30, 2008 Share Posted October 30, 2008 Try using something like this: mysql_query($change) or die(mysql_error()); That may give you more information about your error. Link to comment https://forums.phpfreaks.com/topic/130662-solved-function-query-not-working/#findComment-678010 Share on other sites More sharing options...
taichimasta Posted October 30, 2008 Author Share Posted October 30, 2008 its not a mysql_error i've checked , its the function it self something isn't reading. what am i doing wrong? i need the function to execute the query and it just does nothing. Link to comment https://forums.phpfreaks.com/topic/130662-solved-function-query-not-working/#findComment-678014 Share on other sites More sharing options...
teng84 Posted October 30, 2008 Share Posted October 30, 2008 <?php function online(){ $change = "UPDATE person SET online='1' WHERE uid='$memeber'"; $status = @mysql_query($change) or die("\n couldn't read if you are online <br/>\n "); ?> }<------ the braise is out side of your php script Link to comment https://forums.phpfreaks.com/topic/130662-solved-function-query-not-working/#findComment-678017 Share on other sites More sharing options...
taichimasta Posted October 30, 2008 Author Share Posted October 30, 2008 uh thats my fault thats not how it really looks its an example the function is inbetween the <?php and ?> i'm not completely brain dead lol Link to comment https://forums.phpfreaks.com/topic/130662-solved-function-query-not-working/#findComment-678020 Share on other sites More sharing options...
jwilliam Posted October 30, 2008 Share Posted October 30, 2008 Are you connecting to the mysql database correctly? Why don't you post the code that you use to do this? Link to comment https://forums.phpfreaks.com/topic/130662-solved-function-query-not-working/#findComment-678024 Share on other sites More sharing options...
teng84 Posted October 30, 2008 Share Posted October 30, 2008 '$memeber'<----------------- is not set you are inside the function Link to comment https://forums.phpfreaks.com/topic/130662-solved-function-query-not-working/#findComment-678026 Share on other sites More sharing options...
taichimasta Posted October 30, 2008 Author Share Posted October 30, 2008 here is the page , what is looks like. <?php // i hate leaving my something not finished up Link to comment https://forums.phpfreaks.com/topic/130662-solved-function-query-not-working/#findComment-678035 Share on other sites More sharing options...
teng84 Posted October 30, 2008 Share Posted October 30, 2008 but where is the function there. i think u dont get my point on the last post but here <?php function online($member){ $change = "UPDATE person SET online='1' WHERE uid='$member'"; $status = @mysql_query($change) or die("\n couldn't read if you are online <br/>\n "); } online($member); ?> Link to comment https://forums.phpfreaks.com/topic/130662-solved-function-query-not-working/#findComment-678042 Share on other sites More sharing options...
taichimasta Posted October 30, 2008 Author Share Posted October 30, 2008 oh i think i see Thanks works Link to comment https://forums.phpfreaks.com/topic/130662-solved-function-query-not-working/#findComment-678045 Share on other sites More sharing options...
teng84 Posted October 30, 2008 Share Posted October 30, 2008 welcome Link to comment https://forums.phpfreaks.com/topic/130662-solved-function-query-not-working/#findComment-678052 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.