mysql

PHP and MySql trouble

I am having trouble making this seemingly simple MySql query work. Can anyone spot the problem? <?php include "config.php"; $offerid = $_POST["offerid"]; $ip = $_SERVER["REMOTE_ADDR"]; mysql_query("INSERT INTO voted (offerid,ip) VALUES (".$offerid.",".$ip.")"); ?> ...

CakePHP: How can I change this find call to include all records that do not exist in the associated table?

I have a few tables with the following relationships: Company hasMany Jobs, Employees, and Trucks, Users I've got all my foreign keys set up properly, along with the tables' Models, Controllers, and Views. Originally, the Jobs table had a boolean field called "assigned". The following find operation (from the JobsController) successf...

Multiple Scripts With the Same MySQL Query Running At Once => Will There Be Interference?

I want to have multiple scripts running from cron at the same time. They will all update, say, 500 rows with a unique status ID for that particular script to use. If each script grabs the same type of rows to update, and the scripts run at once, will there be interference between the queries run at the same time? For example, using this...

Are these two functions overkill for sanitization?

function sanitizeString($var) { $var = stripslashes($var); $var = htmlentities($var); $var = strip_tags($var); return $var; } function sanitizeMySQL($var) { $var = mysql_real_escape_string($var); $var = sanitizeString($var); return $var; } I got these two functions from a book and the author says that by us...

Handling SEO Friendly URL with Non-English Character

Hi, i have urls like this: ex: .com/topic.php?id=6 then i converted to: .com/topic/5.html it works but i want to convert .com/topic/title.html the "title" is dynamic(for example: "çağdaş") and can contain non english chars like Ş, Ğ or Ü in this case firstly i converter chars to acceptable equivalents like Ş to S or Ü to U. In short of i...

Huge mysql table with Zend Framework

I have a mysql table with over 4 million of data; well the problem is that SOME queries WORK and SOME DON'T it depends on the search term, if the search term has a big volume of data in the table than I get the following error: Fatal error: Allowed memory size of 1048576000 bytes exhausted (tried to allocate 75 bytes) in /home/****/pu...

Multiple LIKE in SQL

I wanted to search through multiple rows and obtain the row that contains a particular item. The table in mySQL is setup so each id has a unique list (comma-delimited) of values per row. Ex: id | order 1 | 1,3,8,19,34,2,38 2 | 4,7,2,190,38 Now if I wanted to pull the row that contained just the number 19 how would I go about doing...

New table for every user?

Hi everyone, I want to crate new table for each new user on the web site and I assume that there will be many users, I am sure that search performance will be good, but what is with maintenance?? It is MySQL which has no limit in number of tables. Thanks a lot. ...

MySQLPython is ignoring my my.cnf file. Where does it get its information?

When I try to use MySQLPython (via SQLAlchemy) I get the error File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MySQL_python-1.2.3c1-py2.6-macosx-10.6-x86_64.egg/MySQLdb/connections.py", line 188, in __init__ super(Connection, self).__init__(*args, **kwargs2) sqlalchemy.exc.OperationalEr...

How should I design my MYSQL table/s?

I built a really basic php/mysql site for an architect that uses one 'projects' table. The website showcases various projects that he has worked on. Each project contained one piece of text and one series of images. Original projects table (create syntax): CREATE TABLE `projects` ( `project_id` int(11) NOT NULL auto_increment, `pr...

Symfony fk issue on insertion

Hi, I posted a similar problem but it could not be resolved. I create a relational database of users and groups but for some reason I cannot insert test data with fixtures properly. Here is a sample of the schema: User: actAs: { Timestampable: ~ } columns: name: { type: string(255), notnull: true } email: { type: string(255...

0.00 decimal fields in MySQL database giving empty value when in a PHP array

The fields read as 0.00 in phpMyAdmin, but when put into an array, the value is blank, is there a way to get it to show just '0'? From my Model: $query = $this->db->query("SELECT t1.numberofbets, t1.profit, t2.seven_profit, t3.28profit, user.user_id, username, PASSWORD , email, balance, user.date_added, activation_code, activated FROM...

Find column that contains a given value in MySQL

Hello all I have a table in a MySQL database. I am given a value that occurs as a cell value in that table but I do not know which cell is it i.e. the row and column of that cell. What is the most efficient way to find the column to which that value belongs? Thanks in advance. Example: Column_1 | Column_2 | Column_3 1 | 2 ...

Sort the $_POST variables

Hello guys Might be an easy for you guys. I am trying to sort the $_POST variables that were sent by a form and update the sorted result in mysql. I am not sure how to do it and appreciate it anyone can help me about it. My main.php //I have a loop here. (omitted) //$k will be increased by 1 every time the loop starts, so I will kn...

VB.Net MySql command parameter MD5

Is it possible to execute a command like this? select * from tbl where col1=somefunction(@param1) or will the parameter throw off the function? I have been unsuccessful in getting the command to work so far. Please let me know if this needs any further explanation and thank you in advance! ...

MySQL create memory leak in Tomcat

I have set a JDBCRealm for web-app inside tomcat, and when I reload it I got this from tomcat: SEVERE: A web application registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. I use tomcat 6.0.24, with ...

Get sum() result in one query in Mysql

Hello, I have a table id name state num 1 x in 10 2 x out 1 3 x in 5 4 x out 2 5 y ... 6 y ... The expected result is to sum the num for 'in' and 'out' in one query and then calculate the difference, like name numin numout diff x 15 3 12 y .... Thanks ...

Coolstack MySQL Crash Unable to Restart

Environment: Solaris 10 This mysql server has been up and running for 6 months now. Today all of a sudden it crashed. When typing 'mysql' as user it gives the error MYSQL" Error 2002 (HY000): Can't Connect to Local MySQL server though socket '/tmp/mysql.sock' The server try to open mysql, it stays open for 9-10 seconds and restarts...

Can I convert Innodb with foreign directly into mysiam?

I want to convert the db with innodb tables into myisam, all of them. How can I do these? there are some foreign keys exist among tables. how can I make this in the best way? ...

MySQL & PHP Use of Undefined Constant

Alright, PHP is throwing this error (only in the logs): Error PHP Notice: Use of undefined constant department - assumed 'department' (line 5) PHP Notice: Use of undefined constant name - assumed 'name' (line 6) PHP Notice: Use of undefined constant email - assumed 'email' (line 7) PHP Notice: Use of undefined constant message - as...