mysql

Running a query with PHP/MySQL then reordering the results by another column.

This SQL query gives me the results I want; however, I want the results ordered by a different column: SELECT * FROM post INNER JOIN account ON post.account_id = account.account_id WHERE post_id > neww ORDER BY post_date ASC LIMIT 10; I can not simply change 'ORDER BY post_date ASC' to 'ORDER BY post_id DESC', while that will...

MySQL problem reconnecting (mysqld.exe) keeps giving error...

Need some guidance figuring out what went wrong. I've been using mysql, phpmyadmin for just under a year on my home computer while I develop a webapp. 3 days ago I updated my windows vista with all the "wonderful" microsoft updates, security patches, etc...and now it's broke. I tried uninstalling all the upgrades, but there are 4 of th...

file upload limited at 1MB?

i can't understand why my server isn't accepting files larger than 1MB. i am using cpanel and my host has told me that i can't edit my php.ini file directly. below is my upload code: <?php if (array_key_exists('uploadfile',$_POST)) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['...

hibernate, mysql, glassfish v3, and JTA datasource

I'm attempting to use hibernate entity manager with mysql and glassfish. I'm getting the following error when attempting to use a JTA datasource: Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFact...

Normalizing a table, from one to the other

Hi, I'm trying to normalize a mysql database.... I currently have a table that contains 11 columns for "categories". The first column is a user_id and the other 10 are category_id_1 - category_id_10. Some rows may only contain a category_id up to category_id_1 and the rest might be NULL. I then have a table that has 2 columns, user_i...

Can't get the right characters to display from the database.

Hello, I'm re-designing a Web site and I have a problem with the existing data base: The database collate is set to utf8_unicode_ci and in the table row I'm calling the collate seems to be set to latin1_swedish_ci the characters store in it are Japanese (but even in phpmyadmin) you see other characters (I guess because of the latin1_swed...

Need help converting a script from PDO to Mysql

Im trying to convert this script, in my Zend program. http://github.com/jackmoore/colorrating/raw/master/rating/rating.php <?php class rating{ public $average = 0; public $votes; public $status; public $table; private $path; function __construct($table){ try{ $pathinfo = pathinfo(__FILE__); $this->path = realpath($pathi...

read only property for checkbox

Is there a read only property for a checkbox? Because I can still tick on the checkbox even if I have this code, is the read only property only for text box? What's the code if you want the check box to be read-only? <td><input name="stats1" type="checkbox" id="SSS" readonly="readonly" value="<?php echo $row["STAT"]; ?>" <?php echo $row...

PHP is changing the value of my variable because i bind it as a mysqli paramter?

im tracking down a weird bug where a variable i have is being changed at some point, and this is where I found the problem: echo "2. page is $page<br>"; $h = $page; //Ok everything is done. Now need to update the view counter $query = "UPDATE pages SET views=views+1 WHERE id=? LIMIT 1"; if($stmt = $db -> prepare($query)) { $stmt -> ...

Filter posts by multiple tags to return posts that have all those tags, with good performance

StackOverflow lets you search for posts by tags, and lets you filter by an intersection of tags, e.g. ruby x mysql x tags. But typically it's inefficient to retrieve such lists from MySQL using mulitple joins on the taggings. What's a more performant way to implement filter-by-multiple tag queries? Is there a good NoSQL approach to thi...

Jobs site search engine doubt - Sphinx is the solution??

Hi... im developing a web app to manager jobs, curriculum and etc... For example in my case: I have a CV table which contain some information about... and same fields in my table, is a reference to others tables like (Kind of company, kind of job looking for, education, languages the guy knows... a ordinary cv model) My doubt is ... th...

Why is this query slow? Should I use MyISAM rather than InnoDB here?

I'm getting these about 5 times an hour in my slow query logs: # Query_time: 11.420629 Lock_time: 0.000033 Rows_sent: 0 Rows_examined: 0 SET timestamp=1267487708; INSERT INTO record_lock (record_lock.module_id, record_lock.module_record_id, record_lock.site_id, record_lock.user_id, record_lock.expiration_date_time, record_lock.date_ti...

trying out new file upload method

so i've decided to upload the files onto the web server space rather than the mysql space but each time i try to upload anything i get the following error: Warning: move_uploaded_file() [function.move-uploaded-file]: Filename cannot be empty in /home/speedycm/public_html/manageclient.php on line 240 Warning: move_uploaded_file() [f...

how to generate a gaussian distribution using mysql user-defined function.

I like to use MySQL to do quantitative analysis and statistics. I would like to make a MySQL user-defined function of the form: sample_gaussian(mean, stdev) that returns a single randomized value sampled from a gaussian distribution having mean and standard deviation of the user-entered arguments. MySQL already has a function rand() tha...

Trying to create a mysql injection proof script

I'm just a beginner, What's wrong with my code, I'm trying to experiment on this so that the webpages I'm going to create will not be vulnerable to mysql injections. What's the correct way of doing this: <?php $host="localhost"; $username="root"; $password=""; $db_name="testing"; $tbl="hospital"; $connection=mysql_connect($host, $us...

MySQL Stored Procedures not working with SELECT (basic question)

Hello, I am using a platform (perfectforms) that requires me to use stored procedures for most of my queries, and having never used stored procedures, I can't figure out what I'm doing wrong. The following statement executes without error: DELIMITER // DROP PROCEDURE IF EXISTS test_db.test_proc// CREATE PROCEDURE test_db.test_proc() S...

Make MS SQL 2008 generate XML like MySQL 5.0?

A while ago I wrote an app that relied on XML coming out of a MySQL 5.0 database. It got this XML output by calling the mysql client directly, using the --xml command-line option; this made MySQL output XML that looked kind of like this: <resultset statement="SELECT * FROM tablename " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instan...

how to echo an input type in php

Here's my code, what I want to do is to be able to have a back button in the script, so that the user will not be clicking on the back button on the web browser everytime he forgets to input something that is mandatory: But I get the parse error again,what should be the correct one? if(!isset($_POST['fname'])||trim($_POST['fname'])=...

What's the best way to retrieve this data?

The architecture for this scenario is as follows: I have a table of items and several tables of forms. Rather than having the forms own the items, the items own the forms. This is because one item can be on several forms (although only one of each type, but not necessarily on any). The forms and items are all tied together by a common O...

how to check if the inputted data is string in php

Possible Duplicate: Alphabetic equivalent of PHP is_numeric If you check if the data is a number, we use is_numeric: if(!isset($_POST['rnum'])||trim($_POST['rnum'])==""){echo "Error:Enter Room Number!"; echo '<input type="button" value="Back" onClick="history.go(-1);return true;">'; }else if(!is_numeric(trim($_POST['...