[phplib] ct_sql weirdness From: Greg Speed (gspeed <email protected>)
Date: 05/07/01

I had a site up and working great at http://www.concordantrater.com. Then I
moved it to a different, but identical server, with the identical software
installations. Now, on the new server, when I login, I got the following
message at the bottom of the login page:

Database error: Invalid SQL: insert into active_sessions ( sid, name, val,
changed ) values ('1ea1df6396a5ee8dbb9d75741288a70d', 'CRS_Session',
'Q1JTX1Nlc3Npb246JHRoaXMtPmluID0gJyc7ICR0aGlzLT5wdCA9IGFycmF5KCk7ICR0aGlzLT5
wdFsnYXV0aCddID0gJzEnOyAkR0xPQkFMU1snYXV0aCddID0gbmV3IENSU19EZWZhdWx0X0F1dGg
7ICRHTE9CQUxTWydhdXRoJ10tPmF1dGggPSBhcnJheSgpOyAkR0xPQkFMU1snYXV0aCddLT5hdXR
oWydwZXJtJ10gPSAnYWRtaW4nOyAkR0xPQkFMU1snYXV0aCddLT5hdXRoWydleHAnXSA9ICc5ODk
yNTE2NDcnOyAkR0xPQkFMU1snYXV0aCddLT5hdXRoWydyZWZyZXNoJ10gPSAnOTg5MjA4NDQ3Jzs
gJEdMT0JBTFNbJ2F1dGgnXS0+YXV0aFsndW5hbWUnXSA9ICdncmVnJzsgJEdMT0JBTFNbJ2F1dGg
nXS0+YXV0aFsndGl0bGUnXSA9ICdNci4nOyAkR0xPQkFMU1snYXV0aCddLT5hdXRoWydsYXN0X25
hbWUnXSA9ICdTcGVlZCc7ICRHTE9CQUxTWydhdXRoJ10tPmF1dGhbJ2ZpcnN0X25hbWUnXSA9ICd
HcmVnJzsgJEdMT0JBTFNbJ2F1dGgnXS0+YXV0aFsnZW1haWwnXSA9ICdncmVnQHNwZWVkc29mdC5
jb20nOyAkR0xPQkFMU1snYXV0aCddLT5hdXRoWyd1c2VyX2lkJ10gPSAnMGFiYTFhOGIyODIwMDk
1ZDliZTA3MWE0YTM4YzAxNzQnOyA=', '20010506220727')
MySQL Error: 1062 (Duplicate entry
'CRS_Session-1ea1df6396a5ee8dbb9d75741288a70d' for key 1)
Session halted.

The way I fixed this was to edit ct_sql.inc and change the following line:

    $iquery = sprintf("insert into %s ( sid, name, val, changed ) values
('%s', '%s', '%s', '%s')",

to:

    $iquery = sprintf("replace into %s ( sid, name, val, changed ) values
('%s', '%s', '%s', '%s')",

This fixed the error message. But I'm worried that I've changed something
that 1) shouldn't have had to have been changed and 2) might mess something
else up down the road.

Anyone have any insight into why this happened and what the implications of
this fix might be?

Thanks.

Greg Speed
Speedsoft.com

"The Most Affordable Hosting on the 'Net!"

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>