mysql

PHP Filter for special characters before passing to sql database.

How can I have my code replace the body text rather than just "returning": if($body == "Garçon") return; Also, since == is looking for exact string of text, how do I make it look for the body containing "Garçon"? Essentially, I'm trying to build in a filter to change "Garçon" to "Garcon" since the special "ç" character comes up ...

FIRST ORDER BY ... THEN GROUP BY ...

I have two tables, one stores the users, the other stores the users' email addresses. table users: (userId, username, etc) table userEmail: (emailId, userId, email) I would like to do a query that allows me to fetch the latest email address along with the user record. I'm basically looking for a query that says FIRST ORDER BY userEm...

Please, help me get $randomQ and $matchinA, then have jQuery refresh if $matchinA is typed?

Please, show me how to get a random question, '$randomQuestion'(i.e., "What color is the sky?"), and matching answer, $matchingAnswer, from the quizID section of my SQL database, and then use jQuery to refresh the form, only? I started by creating the form and some JavaScript that may work. FORM: <form name="$quizID" action="http://as...

Check if user exists in database (form)

Hi, I have a script which allows users to sign up, which imports data into a MySQL table. user_availability.php http://pastebin.com/PSRndXbq number.js http://pastebin.com/iYAPuwN7 This script will tell the user if that number is present in the table. However it continually says its not in the table despite it being in there (looking...

mysql fetch_array error

I'm trying to make a simple mysql_fetch_array but for some reasons I get the error "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\get.php on line 5" $sql = mysql_query("SELECT * FROM mxc WHERE exp_year > 2009 AND status=0 GROUP BY c_number"); while($row = mysql_fetch_array($s...

Utilizing the power of clusters in the context of databases?

I have a 22 machine cluster with a common NFS mount. On each machine, I am able to start a new MySQL instance. I finished creating a table with about 71 million entries and started an ADD INDEX operation. It's been more than 12 hours and the operation is still going on. So what I logged onto one of my other machines in the cluster, start...

How to get a highest field value in a table in MySQL?

If a table "people" contains "name" (varchar) and "birthdate" (date) columns, how to find the oldest/youngest buddy? ...

Apostrophe replaced by ’ in mySQL table

I'm a complete mySQL & PHP noob, and in my table, whenever there is an apostrophe, it gets replaced by ’. I've searched and found that it could be because my table is not UTF-8, but I changed all the collation settings in phpMyAdmin to utf8_unicode_ci, and I still get the ’. To be clear, I am sending the data to a PHP script from a...

Table with 80 million records and adding an index takes more than 18 hours (or forever)! Now what?

A short recap of what happened. I am working with 71 million records (not much compared to billions of records processed by others). On a different thread, someone suggested that the current setup of my cluster is not suitable for my need. My table structure is: CREATE TABLE `IPAddresses` ( `id` int(11) unsigned NOT NULL auto_incremen...

Please, help me prepare the php and use jQuery to check the DB and submit a form when the correct string is typed?

Please, show me how to get my a random question, $randomQuestion (i.e., "What color is the sky?"), and matching answer, $matchingAnswer (i.e., "BLUE"), from the $quizID's table's list of questions in my SQL database. Then, please help me use jQuery to refresh the $randomQuestion and $matchingAnswer, without refreshing the whole page. I...

PHP MYSQL question

I am trying to do a simple login with PHP and mysql, and using Sessions as well. I have the code, which should work in theory, however it keeps redirecting me to the login page (refreshing it) instead of taking me to the profile. $username = $_POST['username']; $query = "SELECT `confirmcode` FROM `fb_network` WHERE `username` = '$user...

Search in array query result in php/mysql

I have the mysql results ($date_options) as below Array ( [0] => stdClass Object ( [id] => 4 [start_date] => 2010-09-29 ) [1] => stdClass Object ( [id] => 13 [start_date] => 2010-10-06 ) ) I need to be able to search in the "id" field if some value existed. I tried this and it didn't wor...

mysql , bigint or decimal for storing > 32 bit values but less than 64 bits

We're needing to store integer values of up to 2^38 . Are there any reasons to use decimal(12,0) or should we use bigint ? ...

Populate mysql timezone info from mysql data set, not from system without restart

I'd like to populate the mysql timezone tables with the database provided by mysql. I am using a cloud DB and can't overwrite DB tables and restart the server. Can someone help me understand how to load these files manually? Rational: I loaded the tz tables from the OS, but the OS has a ton of timezone names. I'd like a more concise set...

MySQL Table inserts empty records before data

I'm a beginner at this. Basically I have a form that has the correct names set up, and it sends the data to the MySQL table correctly, but it always inserts an additional 4 blank rows/ID's whenever I execute the form. Here's the result every time: http://i.imgur.com/bnx5D.png I'm not sure whether if there's something wrong with the cod...

Should the following queries not produce the same result? (MySQL)

Assuming the following MySQL table structure, why do the two following queries produce different results? games(id) (464 records) members(id) (1 record, id=351) gameslists(id,memberid,gameid) -- (2 records, (1,351,1) and (2,351,2)) This produces null SELECT games.* FROM games INNER JOIN gameslists ON gameslists.gameid = games.id W...

Create table fail in mysql when using CURDATE() as default.

Hello, I'm trying to create the following table using phpmyadmin sql console: CREATE TABLE dates ( id int NOT NULL, id_date datetime NOT NULL DEFAULT CURDATE(), PRIMARY KEY (id) ) However I get the following error: It shows "CURDATE()" in red, so I guess that's the problem. Could anyone help me out here ? ...

PHP code to update MySQL table

I want to update a MySQL table with information from two other tables. I'll set up a cron job, but I don't know what PHP code to use. Every time the cron job runs, I want the 'VideoNumber' column from the 'Profiles' table to be updated with the amount of videos they've uploaded to the site. Video information is stored in a table called...

SQL query a new thread in vBulletin

Hello. How to make a query to the database(mysql) to create a thread? I need to create a thread from a non-registered user, if not, then from the present .. Simply query the database with the subject "Test", the text "test text" and any nickname Sorry for bad english, thank you! ...

dealing with large amounts of data

I'm building the front end of a website that'll be holding data for users. Type of data is name, email, ethnicity, income, pets etc etc. Each person can have a partner (with the same questions) and an infinite number of children (names, dob, gender etc). The user can sign up, and then must be able to log in in the future to update their ...