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
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
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
Share on other sites

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

Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.