mysql

PHP/MySQL OOP: Loading complex objects from SQL

So I'm working on a project for a realtor. I have the following objects/MySQL tables in my design: Complexes Units Amenities Pictures Links Documents Events Agents These are the relationships between the above objects. Complexes have a single Agent. Complexes have multiple Units, Amenities, Pictures, Links, Documents, and Events. Un...

Multiple REST Feeds to MYSQL Database - Using PHP

I've got a number of REST feeds I'd like to store in a MYSQL database, can anyone suggest a solution for this? Something PHP related appreciated.... ...

running 8mb of sql code in wamp?

i have about 8mb of sql code i need to run. it looks like this: /* MySQL Data Transfer Source Host: 10.0.0.5 Source Database: jnetdata Target Host: 10.0.0.5 Target Database: jnetdata Date: 5/26/2009 12:27:33 PM */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for chavrusas -- ---------------------------- ...

How to store a datatime as UTC in php/mysql?

Everywhere I read about converting time to a users timezone time says the best method is to store a date adn time in UTC then just add the users timezone offset to this time. So I am wanting to know, how can I store a date in UTC time, I use mysql's DATETIME field. When adding a new record to mysql in my PHP code I would use NOW() to...

How can I join these two queries?

Here's what I want to accomplish: Select all rows from table "posts" while also fetching linked entities, such as the author (from table "users") and the names of the categories the post belongs to (from table "categories"). These are my two queries so far: This one fetches the posts: SELECT posts.* , users.authorName...

source filename not working

i am trying to run a sql file with this code: source filename.sql and it says failed to open file ...

Mysql change delimiter for better SQL INJECTION handling?

Dear stackoverflowers I am using mysql and trying to block unwanted queries injection of people who will try to use my single query to run several ones. ie, for example when i have the parameter "?id=3", people can try to run it with ="id=3;drop table users" Now, i know that the best way to avoid this is by parsing and checking the par...

Cannot use MySqlConnection after initialization. Why?

I downloaded MySql Connector/NET, and set it as a reference in my project. I added the using MySql.Data.MySqlClient; to my code. Now I tried initializing a connection like this: MySqlConnection test = new MySqlConnection(Utilities.GenerateMySqlConnectionString("localhost", "test", "root", "")); However I cannot use this object later....

Storing checkbox data.

Hello, I am currently writing a script whereby an array of checkboxes are displayed using: <? while($i = mysqli_fetch_array($get_perms)){ $pname = $i[pname]; $id = $i[id]; ?> <div> <input type="checkbox" tabindex="1" name="<? echo("$id");?>" value="1" <? if($permissionid[$id] == '1') {echo ' checked="checked" ';}?> /><?echo...

Easy MySQL question: query with a null value

What am I doing wrong with this query? (Friday afternoon brain freeze...) In WordPress, I used a MySQL query to make an empty custom field called "description" in all posts of a test database, and now I want to add the value "test" to that field. (This is all in the process of teaching myself how to write more complex queries.) But I c...

mySQL sorts underscore last.

Hi, I have a column in my table that stores a string (it is a text column): varchar(16) latin1_swedish_ci The problem is, when I say "ORDER BY name ASC" it returns words starting with an underscore at the end. This is an example it returned: -a -mmddd2 -z -z3 aaa b c t _a ___- I bet I can use php to sort, but is there an easy way to...

Multiple PHP WHILE loops using the same query

$query1 = "SELECT * FROM idevaff_affiliates"; $affiliateID = mysql_query($query1) or die(mysql_error()); This is my query above - I would like to use it for two WHILE loops The first one is in the header section - setting up jquery while($row = mysql_fetch_assoc($affiliateID)){ } The second is used in a while loop in the body ...

Could not delete from tables, operations must use an updateable query?

has anyone gotten these ms-access errors? what do they mean? im connecting access with ODBC to a mysql database ...

PHP & MySQL Input String Escape Problem

Hello, I've a weird string escape problem with my PHP script. I'm trying to get data from iSnare and put them into MySQL table. I'm reading POST data and escaping strings with mysql_real_espace_string() function, also I can insert same data to .txt file without a problem but when I try to insert data into table, it cuts the string from...

MySQL/PHP - Query a result set?

I have a result set that I want to filter. Question is how can I run a query on a result set? Using PHP and MySQL. Thanks ...

PHP ,MySQL memory DB and memcached

I've a site which is running in a shared host without memcached. So, how about make a MySQL memory DB as object cache just like memcached? ...

lamp stack / user input and character encoding

Is there a one stop solution to solving all character encoding issues? I always seem to have issues somewhere along the line between user input, database storage and data retrieval (html forms. I want all my data and web pages to be encoded as utf-8 but it seems I always end up with a invalid utf-8 character somewhere. I don't really u...

rake aborted! closed stream after upgrading to Snow Leopard

Hi all, I just upgraded my Leopard system to Snow. I had a Rails application with a suite of Spec examples running before the upgrade; it used a mysql database. After the upgrade, running rake spec would fail like this: ... ** Invoke db:schema:load (first_time) ** Invoke environment ** Execute db:schema:load rake aborted! closed strea...

How to create a /usr/bin/mysql wrapper program via IO redirection?

Presently, I'm thoroughly dissatisfied by the command-line program /usr/bin/mysql! It does not, e.g., let me leverage: (a) various Unix tools (like, grep, sed...), and (b) Unix concepts such as io-redirection, piping. (Btw, IIRC, a command-line shell for Sybase used to allow piping and sufficiently powerful, Unix-style command-line ...

Subquery returning multiple columns

Hi, I am writing a select subquery that returns a COUNT. However, I need to use a HAVING clause in the subquery and as a result need to specify that column in my subquery SELECT. So the result is that I have 2 columns: COUNT and column_for_having_clause. Is there any way that i can tell SQL to take just the first column. I get an ...