Skip to content

Tag: mysql

PHP PDO: charset, set names?

I had this previously in my normal mysql_* connection: Do I need it for the PDO? And where should I have it? Answer You’ll have it in your connection string like: HOWEVER, prior to PHP 5.3.6, the charset option was ignored. If you’re running an older version of PHP, you must do it like this:

Setting up scripting and mysql database on separate servers

I have a unique setup for a web application that I need to get my head around. I have two servers that will need to talk to each other. Server A will host the actual PHP-based application; Server B will host the MySQL database and the server connection details. Server B will also be within a closed network, s…

MySQL sorting single field in multi orders

hi i am trying to sort a field with multiple orders for example here is my table 1st rule is to sort by Status. in following order: Active, Inactive, Merged, Promo A, Promo B, Promo C, Promo D, Defunct Once they are sorted like this within each of these categories the 2nd rule in following Order: Traditional,…

Slow MySQL full text search

I’m using this query to perform a full text search on a MySQL database: The results are very relevant, but the search is really slow and is getting slower and slower as the tables grow. Table stats: questions – 400 records indexes PRIMARY BTREE – id BTREE – uniquecode BTREE – que…

CodeIgniter without a Database?

Sorry if this is a simple question, is it possible to load codeigniter without a db setup? I have sess_use_db set to false in the config, I tried renaming database.php to something else but it still wants to load it, I turned active records off also. I tried commenting everything out in the database.php and i…

How do I increment a value with mysql update query (php)

I have a query that looks like this: I want to increment the value as easily as possible. I have tried: I don’t get error messages, but the value in my db does not increase either. Answer If you use the single quotes ‘, you’re telling the enclosed value to be interpreted as a string You were…