php-mysql integration script problem with wildcard
Posted on 2004-11-27
I have a forum app which requires its database table(forum_users) be updated with user info and avatars from a table in a separate mysql databse(main site dbase with profile info). The code works fine to update except in one area: the avatars. The reason is that the avatars in the main profile dbase are updated periodically by members and are autoincermented in numeration each time. Therfore, some type of wildcard is required as far as I can tell.
The numeration for the jpg images look like this : 3_0_1.jpg
Upon incrementing, the numbers go up 3_0_2.jpg, 3_0_3.jpg etc etc
All variables from the primary dbase table is called for with a * and it calls for and updates all the other parameters correctly.
As for the avatars, I am trying to configure with a LIKE statement and wildcard. The following combined code as follows for all parameters works fine in this context EXCEPT for the autoincrement problem. It updates only a x_0_1.jpg , where x is the user ID(which is called and transferred correctly). The jpg files are stored in the main site /id_img/ directory.
mysql_query("update forum_users set user_password='".$line["Password"]."', user_joined='".$line["LastReg"]."', user_id='".$line["ID"]."', user_email='".$line["email"]."', user_avatar='/id_img/".$line["ID"]."_0_1.jpg' where user_name='".$line["NickName"]."'");
I am not a programmer, but have pieced this together for the avatar transfer alone, but it does not work.
mysql_query("update forum_users set user_avatar= 'id_img/".$line["ID"].".jpg' where .jpg LIKE '_0_%.jpg' where user_name='".$line["NickName"]."'");