mysql

could not retrieve field name from database...

$result = mysql_query("INSERT INTO project (clientname, salesperson, prospect) VALUES ('$clientName','$salesPer','$prospectVal')"); while ($row = mysql_fetch_assoc($result)) { $projectID = $row['projectid']; return $projectID; } I am not getting the projectID from the database. The fi...

Not returning the entire values from the table....

$result = mysql_query("SELECT * FROM project ORDER BY projectid"); while($row = mysql_fetch_array($result)) { return(array($row['projectid'], $row['clientname'], $row['salesperson'], $row['prospect'])); } I get only the first set of values from the fields. I need all the values. ...

For innodb table in MySQL, which is faster: varchar(255) or tinytext?

I am optimizing some innodb tables in MySQL, so I ran procedure analsye() to see what the recommendations were. The results recommended tinytext instead of varchar(255) for all the fields that were previously set up as varchar(255) Is there a performance gain to be had by using tinytext? I am only concerned about speed here, not size. ...

Keep code in separate file

topic.php $id = isset($_GET['id']) ? intval($_GET['id']) : 0; $query = mysql_query("SELECT * FROM topics WHERE id = $id"); $row = mysql_fetch_assoc($query); $title = htmlspecialchars($row['title']); $text = bbcode($row['text']); view/topic.php <h1><?=$title?></h1> <p><?=$text?></p> <h1>Replies</h1> $q = mysql_query("SELECT * FRO...

MySQL PHP mysql_real_escape_string() - is this value not a string?

I am trying to update a record with the info from a multiple select box, I had it working fine when I was using INSERT INTO to add a new row, but now that I am trying to add it to this code that is using mysql_real_escape_string() it is returning the error message at the bottom of this post. I presume it has something wrong with the val...

Left and right joining in a query

A friend asked me for help on building a query that would show how many pieces of each model were sold on each day of the month, showing zeros when no pieces were sold for a particular model on a particular day, even if no items of any model are sold on that day. I came up with the query below, but it isn't working as expected. I'm only ...

ODBC vs. newer methods for database management over the internet...

I am taking on a legacy project in which database management was handled over the internet using an ODBC connection. The legacy program has recently been rewritten in C#. We are currently discussing how to improve the program and I am a bit uncomfortable with using ODBC to connect to the database. I have written routines to connect to...

Trouble with join query

Hello overflowers ;) I'm implementing home brew ACL system in web app and it gives me hard time. I believe this is trivial, just can't get my head around it. I have 3 tables in one to many relationship: resource, perms_group, perms_users where perms_group is a key table while perms_users allowes me to fine tune access per user basis if...

dynamically hiding a portion of a HTML table

I have a table of data from mysql rendered on page via PHP into a HTML table. Within this table of data, I have a row of data that should be focussed on (let's call it) row X. I want the 2 rows above and below row X to be shown but all others hidden, as row X moves up and down, this would change (obviously) what was hidden, when row X...

How can I select from a derived table in Propel?

I'm using v1.3 of the Propel PHP framework for an application, and I can't find a way to select from a derived table using the Criteria object. Part of the SQL I want is: SELECT unioned_table.foo, quux.stuff, baz.more_stuff... FROM quux INNER JOIN (SELECT foo, bar FROM table1 UNION SELECT foo, bar FROM table2 ) AS union...

SQL join over five tables

I have five tables: models: id, name, specification models_networks: id, model_id, network_id networks: id, name, description countries_networks: id, country_id, network_id countries: id, countryName, etc, etc the models table is connected to the networks table via models_networks with a many to man...

SubSonic 2 Migrations Addon: Create a MySQL specific ForeignKey Migrationstep

I use migrations a lot (only MySQL) and since SubSonic Migrations only allows to define the parent and the master column in CreateForeignKey, I cannot define the update/delete actions in a FK Relation. However there a quite a number of scenarios where I, for instance, need to define a FK relation where, if I delete the parent record, al...

Are these generation times acceptable for php-mysql? Where can I improve? Where should I improve?

I'm in the process of developing my first major project. It's a light-weight content management system. I have developed all of my own framework for the project. I'm sure that will attract many flames, and a few 'tut-tut's, but it seems to be doing quite well so far. I'm seeing page generation times of anywhere from 5-15 milliseconds. ...

PHP login class

I'm looking for a good PHP login class via MySQL, and I'm not yet completely satisfied with anything I've found. This prior SO question doesn't really address my needs, as I'd prefer to stay away from PEAR and CodeIgniter, and just have a simple and small PHP class to do the job. There's a TalkPHP forum that has several to choose from, ...

Distributed Lock Service over MySql/GigaSpaces/Netapp

Disclaimer: I already asked this question, but without the deployment requirement. I got an answer that got 3 upvotes, and when I edited the question to include the deployment requirement the answer then became irrelevant. The reason I'm resubmitting is because SO considers the original question 'answered', even though I...

MySQL fulltext search isn't matching as expected.

I have a pretty simple query that doesn't seem to be giving me the results I'd like. I'm trying to allow the user to search for a resturant by its name, address, or city using a fulltext search. here is my query: SELECT ESTAB_NAME, ESTAB_ADDRESS, ESTAB_CITY FROM restaurant_restaurants rr WHERE MATCH (rr.ESTAB_NAME, rr.ESTAB_ADDRESS...

MySql Trigger, before insert delete a row in the same table

Is this possible? Before a row is inserted into tableA, I need to delete any rows in tableA containing duplicate data.The trigger below does not generate an error but doesn't work either. CREATE TRIGGER remove_old_user BEFORE INSERT ON userStatus FOR EACH ROW DELETE FROM userStatus WHERE username = NEW.username Any ideas? ...

How do I use MySQL C++ Connector for storing binary data?

I have a block of binary data defined as: void* address, size_t binarySize; that I want to store to a MySQL database using MySQL C++ Connector. The function setBlob() takes istream. The question: How can I convert from a raw void* address, size_t binarySize to either an istream object or istringstream? Is it possible to do this with...

Is the primary key automatically indexed in MySQL?

Do you need to explicitly create this or is it implicit when define the primary key? Is the answer the same for MyISAM and InnoDB? ...

AIR: sync gui with data-base?

I am going to be building an AIR application that shows a list (about 1-25 rows of data) from a data-base. The data-base is on the web. I want the list to be as accurate as possible, meaning as soon as the data-base data changes, the list displayed in the app should update asap. I do not know of anyway that the air application could be n...