Scripts and functions that I have written or found useful

Archive for September, 2007

Shorten string length

Wednesday, September 26th, 2007 Posted in PHP | No Comments »

$query = substr($query,0,-1); Shortens the string by one character. Change the second value to remove more or see php.net/substr for more information

mysql error codes

Monday, September 24th, 2007 Posted in MYSQL | No Comments »

#1046-No database Selected. You are trying to query without choosing a database #1054 - Unknown Column #1109 - Unknown Table #1136 - Column count doesn't match the value count

Find and replace in mysql

Monday, September 10th, 2007 Posted in PHP | No Comments »

To find certain characters or strings and replace them with another value, execute the following query... update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]'); This is quite useful for finding strange characters that appear instead of letters with accents over them. I usually replace ...

Pressing enter does not submit form

Thursday, September 6th, 2007 Posted in PHP | No Comments »

Problem: pressing enter on form just refreshes page/ Pressing enter in textbox refreshes page All forms submit one of two ways... By clicking submit By pressing the 'enter' key Sometimes you may find that pressing enter only resubmits the form or appears to just ...