mysql

MySQL functions not working when PHP script is called from exec()

I have a PHP script I execute in the background from an exec call. Everything works except for the MySQL functions (they don't exist). If I call the script directly from the browser it works fine. What's happening here? Any ideas? Thank you for your time ...

how to support many sql queries on a web at the same time?

The question is: if I have a webpage hosted somewhere. The backend environment is LAMP supported. For example: whenever a user opens a new page, it will create a new mysql connection to the MySQL database server and do a corresponding query. We all know that MySQL has a max_connection limit (100 for version <5.1 as default). Of course...

mysql update row if exists

quick mysql php question. i have a a $row['sentence'] and another $row['rank'] i'm tryin to write a thing..that says..if you find ...these certain words in the $row['sentence'].. insert or update the $row['rank'] by anything i specify.. ex. this sentence has badwords.. so the rank row..will become 1. ex2. this sentence is clean so th...

Expiring links and where to store them

I currently have a website setup where unique links are generated every time a person loads a page. When a user follows a link that link should expire. That is, they shouldn't be able to hit back on their browser and click that link again. While I can do this now, I'm not sure where I should be storing the unique link IDs. There are go...

mysql select timestamp as date string

Hi! I have a table with the column "create_time" which is of type 'INTEGER' and represents the time since epoch. I'd like to select all rows & columns while displaying this row as a date/time in UTC format. How do I do that? ...

How can a PHP PDO object figure out if it's already in a MySQL Transaction?

I have two complicated PHP objects, each of which has data in a few MySQL tables. Sometimes, I just need to remove one object A from the database, and that takes 3 SQL statements. Sometimes, I need to remove one object B from the database, which is takes 4 SQL statements, and which also needs to find and remove all of the object A's th...

need help using substr on mysql update record

good evening all, i have been trying to update records but can't seem to code in the substr command to extract certain details from a string. i have a doa (date of accident) text field currently working with kelvinluck's jquery datepicker plugin. originally the single doa textfield was split into three drop downs... namely: doaDay, do...

Java - Communications Link Failure

I just talked to my host that I have my web page at and they say they allow JDBC connections. Anyway, the page you can view this at is http://mystikrpg.com/mysqltest/mysqltry.html Here is my error: **** Looking for database... com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent su...

Php mysql, variable help query help

I have this mysql query: UPDATE `table`.`wp_12_postmeta` SET `meta_value` = 'yyy' WHERE `wp_12_postmeta`.`meta_id` =5 LIMIT 1 ; How do i incorporate this: instead of wp_12_ i want a variable $prefix (variable holds wp_4_, wp_3_, etc) instead of yyy i want a value $perf (variable is a name ) instead of 5 i want a value $meta...

MySQL get row position in ORDER BY

With the following MySQL table: +-----------------------------+ + id INT UNSIGNED + + name VARCHAR(100) + +-----------------------------+ How can I select a single row AND it's position amongst the other rows in the table, when sorted by name ASC. So if the table data looks like this, when sorted by name: +-----...

Rails and getting the amount of days dates overlap

Hi, lets say I have a user, this user has many trips and belongs to a city. Each trip belongs to a city and has a start and an end date. Lets say user X goes to new york between 2010-09-01 and 2010-09-20, now I want to know who else is in new york and for how long their trips overlap with user x. And then there are people already liv...

Setting up Mysql for Ruby on Rails in Windows

I'm on Windows, and I have a working Rails 2.3.8 app on Ruby 1.8.6 with MySQL 5.0 and the mysql gem version 2.8.1. It all works. I just installed Ruby 1.9.1, installed gems for rails(2.3.8) and mysql. BUT NOW when I run ruby script/server: !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and...

Uploadify File Rename

Hello, I'm using the Uploadify jQuery plugin for PHP to upload a file. One thing I am stuck on is that I need to be able to rename the file being uploaded so that I can post that information to my script that inserts data into the mysql database. Can anyone please advise on how to do this? Thanks, Jake ...

How do i get top n records of each category

Hi guys, I am here to get records based on categories. My table foo has fields [id, name, class]. my records can be like: 1, ram, 10 2, hari, 9 3, sita, 10 4, gita, 9 5, rita, 5 6, tina, 7 8, nita, 8 9, bita, 5 10,seta, 7 ...and more... Now i would like to get result with each record from different class.. i.e something like 1, r...

How would i connect from Eclipse to Tomcat to MYSQL?

I would like to know how to establish the link between eclipse - tomcat - MYSQL. And also which version of mysql to download. Thank you. ...

Qt, MySQL server has gone away

Here my code snippet: query.next(); qDebug()<<query.lastError(); qlonglong res=query.value(0).toLongLong(); qDebug()<<query.lastError(); and the corresponding log I have: Debug: QSqlError(2006, "QMYSQL: Unable to execute query", "MySQL server has gone away") Warning: QSqlQuery::value: not positioned on a valid record Debug: QSqlErro...

Auto TimeStamp new entry to DB (phpMyAdmin)

Hi. If I want each new entry into my db to be automatically timestamped, would I set the Field Type to "timestamp" and have the Default value set to "CURRENT_TIMESTAMP"? Is this the correct method? ...

php sample script for pagination

Can anyone suggest a good php script for pagination where one want to display lot of items from database pagewise ...

pack keys and checksum

CREATE TABLE `mytable` ( `attachid` int(15) NOT NULL auto_increment, ... ... ) ENGINE=MyISAM PACK_KEYS=1 CHECKSUM=1 My create table statement looks like as shown above. If I omit PACK_KEYS and checksum will it improve the insert/ update speed. Is this option helping to make selects faster? ...

Why MySQL Full text index doesn't work?

After trying everything I could, I finally created this test table: CREATE TABLE test_table ( id int(11) NOT NULL AUTO_INCREMENT, title text NOT NULL, PRIMARY KEY (id), FULLTEXT KEY title (title) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 With the following test data: INSERT INTO test_table (id, title) VALUES (1, 'Evolving intellig...