When I do:
$q = 'insert into movies values("lion king"); select * from movies;';
$result = $db->query($q);
echo mysqli_num_rows($result);
it says that $result is boolean, not mysqli result.
if I check $result like this:
if(!$result) echo 'fail';
it outputs 'fail'.
Is mysql not capable of handling more than 1 query at a time? How d...
I have a MySQL database with the following table structure:
TransactionType: Transaction_Amount, Transaction_ID, Transaction_Form
Transaction: Transaction_ID, Timestamp
Purchase: Transaction_ID, Item_ID
Items: Item_ID, Client_ID
This is really a two part question (please let me know if i should post these as two separate questions)
1)...
I have around 100thousand rows in a mysql table, where each row has about 8 fields.
I have finally got the hold on how to use Zend Lucene to index and search data from a mysql table.
Before I fully implement this funcionality to my website, I have some questions:
1- Is it possible to determine the size of a index in advance? This beca...
I believe I have been writing some inefficient code here, but can't seem to figure out a more efficient way of writting it.
This often happens with json output, though I've had the issue with some html or xml output as well.
I run a query in my database which brings back an array. Say a persons favorite foods.
php's mysql_fetch_assoc...
Under what conditions do I need to single quote a variable in a Mysql statement in PHP?
...
echo $totalprice;
echo "<br/>";
echo $shortfall;
echo "<br/>";
echo $unitprice;
echo "<br/>";
I got
24 80
0.3
Then the following command was executed.
// update query
However, only
total_price
was changed(became 0.00) while other values like
unit_price
stay unchanged. But other values like
unit_price
sh...
I'm writing a script in php which updates my database with certain xml information every 30 seconds. (I'm not allowed any other scripting language, and I find php an easy language to work with anyway)
However, because this php script can run for several minutes my mysql database tends to fall away. A lot.
So I started to use link ident...
I am having an issue getting my data to return. I have two times without the dates as in 00:00:00 and I am trying to compare them. The current on time is 09:00:00 and the off time is currently 02:00:00. The time being compared against, as in my SQL is 18:21:00 which is between the on and off times but I can't get the results.
Here is my...
If it matters as of now I'm using
MySQL/MyISAM but I'm open to using
PostgreSQL. I'm also open to using memcached.
Consider a table that's used to store forum threads:
id forum_name post_date
1 Hey! 2009-01-01 12:00:00
What's the best practice of storing thread-related entities such as votes, views, and counters?
S...
Hello,
Actually the problem arises since we have named a column "authorization" which is ok on mysql but fails miserably on postgres - "authorization" is a reserved keyword there.
We want to have all schemas in sync even on different databases, so we want to rename "authorization" in the mysql catalogue(s) to something neutral.
It wo...
I have 3 tables:
Vehicle: vehicle_id, vehicle_type
1, motorcycle
2, car
3, van
Owners: person_id, vehicle_id, date_bought
1, 1, 2009
1, 2, 2008
2, 3, 2009
2, 1, 2005
I want to display a list of all vehicle names. If the person_id = 1, date_bought should also be returned.
So I thought I would start with this:
SELECT * FROM vehicles
...
Hello,
the problem is as follows: We're using hibernate with annotations as O/R Mapper.
Some @Column annotations look like:
@Column(columnDefinition = "longblob", name = "binaryData", nullable = true)
or
@Column(columnDefinition = "mediumtext", name = "remark", nullable = true)
with the columnDefinition attributes being mysql speci...
I'm having two arrays in PHP as follows:
Array1 ( [1] => Array ( [0] => 16 )
[2] => Array ( [0] => 17 [1] => 29 )
[3] => Array ( [0] => 30 [1] => 31 )
) Total Element Count: 5
Array2 ( [1] => Array ( [0] => 21 )
[2] => Array ( [0] => 22 )
[3] => Array ( [0] => 23 )
[4] =>...
Hello,
We began using Entity Framework with MySQL in our project recently. Now I am writing unit tests for the data access level; for that purpose I have created a database with some test data.
In the test-method for the Delete method I want to first delete a specified record and then insert it again with all the fields holding exactly...
When I run the EXPLAIN command on my MySQL query:
EXPLAIN SELECT colZ FROM table1, table 2
WHERE table1.colA = table2.colA
AND table1.colB = table2.colB
AND table1.colC = X
The EXPLAIN command states that the possible_keys include:
colA, colB, colC
But the actual key used as colA
Question: Does this imply I should make an index o...
Is it illegal to use mysql server 4.x or 5.x with enterprise applications, even though the mysql was installed as part of the SuSE SLES operating system?
...
First the basic facts: Java webapp, Spring, Hibernate, MySQL.
The situation is that I have a complex object model of e.g. a Car. It's
composed of many objects (Engine, Tires, ...) with many-to-one and one-to-many relationships between them.
Now there are many cars, and every now and then someone inspects a car and creates a Report of...
Hi to all,
i am usign concat_ws to search a table (code below)
SELECT * FROM customers WHERE CONCAT_WS('',lastname,firstname) LIKE '%$string%'
My problem is that seperates uppercase and lowercase.
If i search AB i get 10 results BUT if i search ab i get 1 result.
Is there any way to get the same results, meaning not sererate upperc...
I’m building email notification service, requirement is to send an email to user when he is registered.
Currently what I’m thinking of execution of some function defined in trigger, can be a java function, which have to be outside the mysql process, rather monitoring mysql from outside for row addition in database.
Is there any function...
If I have an operation as follows:
begin transaction (auto commit = false)
select * from foo;
iterate above result set:
insert into bar (insert the values from the above result set into bar);
commit
In the above operation will the table foo be locked until all the inserts into bar are done? Also, while the inserts are going ...