mysql

Developing a web application using php, please give some suggestions.

I am developing a web application which is using php. It will use the mySQL database for storage. But The application may upgrade in future, so I would like to know is there any framework for me to reduce the pain of upgrading database structure. I know that there is a framework called cakePHP. And the application will deploy in more ser...

How do i search for words in my text column? mysql?

Hello, I have a column in my table which is of type text. The user may type any combination of words , it should appear in the result. Eg. Suppose string is :- Addicted to stackoverflow And suppose user types addicted and stackoverflow, then also results should appear. In other words, it is not a simple like operator through which we ...

Python, MySQL and Daemon Problem in Ubuntu 10.04

I have a script which runs inside a while loop and monitors a mysql data source every 2 seconds. If I run if from the command line, it runs and works fine. But If I attach it to a daemon, it throws an error saying "MySQL has gone" or something similar. I checked and found MySQL up and running. I could even execute queries from other tool...

Sql syntax error

Here is my query: $query="Delete b Where Exists ( Select 1 From a Where a.poster_password = '$pass' And a.ad_id = '$id' And a.classified_id = b.classified_id ) Delete a Where a.poster_password = '$pass' And a.ad_id = '$id'"; I get this error: "You have an error in your SQL syntax; chec...

Heavy Wordpress MySQL query, please help me find it and optimise it

I have a wordpress website up and running that is reasonably popular but over the last couple of days my performance has degraded terribly. I have installed Jet Profiler and have been monitoring the MySQL database to see if I can find something wrong and this one query is consistently the worst offender. SELECT SQL_CALC_FOUND_ROWS wp_...

Retrieving PDF stored in blob field please

please can any one help with a PHP/Mysql script that can enable the download of PDF stored in a blob when a link 'DOWNLOAD NOW' is clicked. i have tried but no result. kindly help Thanks ...

PHP Error: mysql_fetch_array() expects parameter 1 to be resource, boolean given

Hi I am trying to select data from table but get this error message: mysql_fetch_array() expects parameter 1 to be resource, boolean given.. This is my code: $username = $_POST['username']; $password = $_POST['password']; $result = mysql_query('SELECT * FROM Users WHERE UserName LIKE $username'); while($row = mysql_fetch_array($re...

mysql error: could not start the service mysql on local computer error 193: oxc1

I was going thru the charset change to utf8 on my local MySQL(5.1) databases, had done some changes only via phpmyadmin to the dbs and straight to my.ini - file. When I booted my pc (win xp pro sp 3), MySQL server is not starting up at all and I can't figure out why. I changed the ini-file back as it was, but no. If I'd re-install the wh...

show result into html table from database

hi all...i have textfield inside html table..i want after i type something like "name" in another cell can show all information or description about people who have that name...that information are take from "member_table"... <tr> <td> <td> <td><input type="text"........></td> </td> </td> </tr> <tr> <td> //i...

Regular SQL/php error

I have been creating a new website and am new to all this. Every so often, I get the following error and after a while, it goes away and the website comes back? Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (11) in /home/gamepla3/public_html/include/d...

Limit MySQL requests

Context: A Java client-side application needs to access a server-side MySQL database. Need: Limit the possible number of requests to the database for each client (based on the client's IP). Question 1: Is it possible to do this just by changing the MySQL database settings? Question 2: Is it a good idea to allow access to the database ...

.NET C# mysql SUBSTRING gives me System.Byte[]?

This this code: SELECT SUBSTRING(posted,1,4) as year FROM styles reader = cmd1.ExecuteReader(CommandBehavior.CloseConnection); reader.Read(); Response.Write(reader[0].ToString()); I only get the string "System.Byte[]" printed out. How come? If I use the software Mysql Query Browser I get the actual string from my database. I underst...

select from rental table in mysql to display items currently rented by user

If you know about sakila sample database, then what is the statement to select items currently rented by a user. If not here is a code explanation: CREATE TABLE IF NOT EXISTS `rentals` ( `item_id` int(10) unsigned NOT NULL, `user_id` int(10) unsigned NOT NULL, `last_change_date` date NOT NULL, PRIMARY KEY (`item_id`,`user_id`,`la...

Time based resource availability for events in mysql/php

For an event system I need to check if there are enough resources available for an event. Events have a a start and end timestamp, and needs a number of resources (for the sake of simplicity we'll assume that there is only 1 type of resource). When a new event is booked, there should be a check if it's possible. All events are doctrine-b...

updating a column with avg data from another table column

hi,i wrote a command like this to update a column in one table with avg of columns from another table.. its giving errors UPDATE college_rating,products set property1_avg = avg(college_rating.rating1), property2_avg = avg(college_rating.rating2), property3_avg = avg(college_rating.rating3), property4_avg = avg(college_rating.rati...

MySql syntax error; Deleting from two tables in one query possible?

Is it not possible to perform two deletes in one query by separating them with a semicolon? Here is my query: $query="DELETE FROM $sql_table WHERE EXISTS ( SELECT 1 FROM classified WHERE classified.poster_password = '$pass' AND classified.ad_id = '$id' AND classified.classified_id = $sql_table.classified_id ...

while ($row = mysql_fetch_array($result)) - how many loops are being performed?

if... $query = "SELECT col1,col2,col3 FROM table WHERE id > 100" $result = mysql_query($query); for this action: while ($row = mysql_fetch_array($result)){ .... } is this doing 1 loop (iterated x times)? and for this one: $row = mysql_fetch_array($result) foreach($row as $r){ ... } is this doing 2 loops (iterated x times)...

MySQL - Dynamic SQL inside stored procedure

Hi, see the procedure InsertHelpQuestion2 below. DROP PROCEDURE InsertHelpQuestion2; CREATE PROCEDURE InsertHelpQuestion2(user_id char(50),scenerio_id char(50),component_id char(50)) BEGIN DECLARE uu_id char(50); SELECT BinToUUID(NewUUID()) INTO uu_id from helpquestion LIMIT 1; SET @fields_part = 'INSERT INTO helpquestion(H...

Database table structure for user settings

Hi guys! I need to add a table to store user settings. For the first time users will have about 10 different settings, but I'm sure there will be more. What scalable structure of database table to store user settings would you suggest? Any help would be greatly appreciated. Thank you! ...

Rewriting query in order to remove FIND_IN_SET?

My mysql query looks like this: SELECT pages.*, showcase.*, project.* FROM pages INNER JOIN showcase ON showcase.pid = pages.uid AND showcase.deleted != 1 INNER JOIN project ON FIND_IN_SET(project.uid, showcase.projects) WHERE pages.deleted != 1 AND pages.pid = 14 AND pages.dokTy...