Jump to content

[SOLVED] Concat();


denoteone

Recommended Posts

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);

Link to comment
https://forums.phpfreaks.com/topic/152853-solved-concat/
Share on other sites

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';

 

Link to comment
https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-802747
Share on other sites

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);

Link to comment
https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-803746
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/152853-solved-concat/#findComment-804821
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.