bnovak Posted May 24, 2010 Share Posted May 24, 2010 Hello! Looking for a little more help on this one. Trying to do this (profile and state_licenses are db tables within the same db) mysql_query("UPDATE profile SET statecount='(LENGTH(stateLicenses) - LENGTH(REPLACE(stateLicenses, '|', ''))+1)' WHERE statecount='empty' "); mysql_query("update profile SET statecount='empty' WHERE statecount='0'"); and keep getting a generic PHP Code error. (I've kept the connection details out for obvious reasons ) I got no red bangs when writing this in ZendStudio but there's probably something really simple in the syntax that I'm goofing up. I've read through a bunch of different tutorials but it's always about adding a specific entry to a table rather than an expression. both mysql operations work fine in phpmyadmin without the php call. I had a similar issue to this before and someone was able to find it really quick (and of course, now I can't find that post!) Any help? Link to comment https://forums.phpfreaks.com/topic/202782-code-error-php-mysql-update-db-tables/ Share on other sites More sharing options...
Bladescope Posted May 24, 2010 Share Posted May 24, 2010 What's the PHP error you're getting? :3 Link to comment https://forums.phpfreaks.com/topic/202782-code-error-php-mysql-update-db-tables/#findComment-1062801 Share on other sites More sharing options...
bnovak Posted May 25, 2010 Author Share Posted May 25, 2010 What's the PHP error you're getting? :3 Would love to tell ya, but it's a generic. There were errors in your event: PHP CODE con = mysql_connect("localhost","xxxx","xxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxxx", $con); mysql_query("UPDATE profile SET statecount='(LENGTH(stateLicenses) - LENGTH(REPLACE(stateLicenses, '|', ''))+1)' WHERE statecount='emtpy' "); Link to comment https://forums.phpfreaks.com/topic/202782-code-error-php-mysql-update-db-tables/#findComment-1062804 Share on other sites More sharing options...
bnovak Posted May 25, 2010 Author Share Posted May 25, 2010 well, it turns out that taking the " characters out of the (" ") from mysql("") solved the problem. Go figure. Link to comment https://forums.phpfreaks.com/topic/202782-code-error-php-mysql-update-db-tables/#findComment-1063193 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.