denoteone Posted April 6, 2009 Share Posted April 6, 2009 I am trying to add the variable $visitor_page to the field "v_page" where the field "visitor_ip" is equal to $visitor_ip and field "visitor_day" is equal to $visitor_day this is what I think would work but I it not working and I am not getting any php errors. $sql_con = concat(v_page,'$visitor_page') WHERE visitor_ip = '$visitor_ip' AND visitor_date = '$visitor_day'; $result = mysql_query($sql_con) or trigger_error(mysql_error(),E_USER_ERROR); Quote Link to comment https://forums.phpfreaks.com/topic/152853-solved-concat/ Share on other sites More sharing options...
Maq Posted April 6, 2009 Share Posted April 6, 2009 You need SELECT, UPDATE etc... prior to the concat function. Quote Link to comment https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-802743 Share on other sites More sharing options...
irvieto Posted April 6, 2009 Share Posted April 6, 2009 Are tryin to assign the value of $visitor_page to the column "v_page" where visitor_ip = '$visitor_ip' AND visitor_date = '$visitor_day' or just read the data from the table? In case of assign. Use an update $sql_con = "update 'my_table' set v_page='$visitor_page.' where visitor_ip = '$visitor_ip' AND visitor_date = '$visitor_day'; Quote Link to comment https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-802747 Share on other sites More sharing options...
denoteone Posted April 6, 2009 Author Share Posted April 6, 2009 there is already data in v_page I am trying to add the value of $visitor_page to that data. which means I have to use concat(); Quote Link to comment https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-802750 Share on other sites More sharing options...
irvieto Posted April 6, 2009 Share Posted April 6, 2009 Change in the previous statement for: " set v_page = concat(v_page,'$visitor_page') " Quote Link to comment https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-802764 Share on other sites More sharing options...
denoteone Posted April 7, 2009 Author Share Posted April 7, 2009 I am still not there. I know this is where the issue is can anyone see what I am doing wrong? $sql_con = "UPDATE 'visitor_list' SET visitor_page = CONCAT(visitor_page,'$visitor_page') WHERE visitor_ip = '$visitor_ip' AND visitor_day = '$visitor_day'"; $result = mysql_query($sql_con) or trigger_error(mysql_error(),E_USER_ERROR); Quote Link to comment https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-803746 Share on other sites More sharing options...
irvieto Posted April 7, 2009 Share Posted April 7, 2009 Post the mysql_error(). Quote Link to comment https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-803778 Share on other sites More sharing options...
denoteone Posted April 8, 2009 Author Share Posted April 8, 2009 I got it working it was the sql statement. $sql_con = "UPDATE visitor_list SET visitor_page = CONCAT(visitor_page,'$visitor_page') WHERE visitor_ip = '$visitor_ip' AND visitor_day = '$visitor_day'"; thanks everyone for your help Quote Link to comment https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-804807 Share on other sites More sharing options...
Maq Posted April 8, 2009 Share Posted April 8, 2009 Hmm, looks the same as before... At least it works now Quote Link to comment https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-804813 Share on other sites More sharing options...
denoteone Posted April 8, 2009 Author Share Posted April 8, 2009 i had quotes around my table name. LOL I didn't need them there. I wasn't getting the mysql error because I didn't know I had to have php errors on to see them. Quote Link to comment https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-804817 Share on other sites More sharing options...
Maq Posted April 8, 2009 Share Posted April 8, 2009 i had quotes around my table name. LOL I didn't need them there. I wasn't getting the mysql error because I didn't know I had to have php errors on to see them. Oh I see. Many people tend to use backticks ` but they are only needed when you're using a reserved word for a table name or field. Quote Link to comment https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-804821 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.