I have the following MySQL. I want to pull the data in random order.
Could anyonet teach me how to do it please.
$Q = $this->db->query('SELECT P.*, C.Name AS CatName
FROM products AS P
LEFT JOIN categories C
ON C.id = P.category_id
WHERE C.Name = "Front bottom"
AND p.status = "active"
...
Okay here is what I'm, trying to do I want to escape the period so I can add a .8em font and a 2.5em font into my code for example instead of a plain number font. I tried escaping the period three different ways in this script but I think I was doing it wrong.
Here is my font sizes in the script.
$min_size = 1; //change to .8
$max_size...
I have a table that is similar to the following below:
id | cat | one_above | top_level |
0 'printers' 'hardware' 'computers'
I want to be able to write a query, without using unions, that will return me a result set that transposes this table's columns into rows. What this mean...
Dear All,
Could any body please help me ? I called godaddy several time and still no proper answer.
Problem 1) Hosting Plan :- I asked for Java linux unlimited host plan and initially they gave me Linux Web Hosting - Unlimited - 3 years but My simple Hellowrold JSP not worked(showing the full file contents with JSP tags) so I called ...
I've been reading a lot about Relational Databases using many JOIN statements on every SELECT. However, I've been wondering if there's any performance problem on the long run when abusing this method.
For example, lets say we have a users table. I would usually add the "most used" data, instead of doing any extra JOINs. When I say the "...
Hello, I'm thinking about to store dates on user login in my site, but I don't know what is the most logical solution.
Initially, I though to use server timezone, and then to manage it using difference operations between server machine date and user machine date, but I've also considered to change it direclty using timezone and php clas...
My script was working before but when I changed all the mysql tags to mysqli everything stopped working. Can some please help me make the script work agian.
Here is the script.
<?php
$db_host = "localhost";
$db_user = "root";
$db_pass = "";
$db_name = "sitename";
mysqli_connect($db_host, $db_user, $db_pass) or die(mysqli_error());
my...
My problem:
I got a MySQL database that stores a great amount of meteorological data in chronological order (New data are inserted every 10 min). Unfortunately there have been several blackouts and hence certain rows are missing. I recently managed to obtain certain backup-files from the weather station and now I want to use these to fi...
Given a pretty standard set of related tables like Customers, Invoices and Line Items. I need to make a query like "Select all customers that have invoices that have 5 line items or more" or "Select all customers that have more than 2 invoices" or lastly "Select all customers that have line items totaling more than $100"
I'm doing thi...
Hi all,
I'm pretty sure there is a solution for this but I'm not sure about how to phrase it correctly.
I have a form that needs to be saved in a database, pretty simple done in php and stored in a mysql table. But maintenance is pretty tedious, so I'm wondering if there is (or I should write my own) a solution to write the form's questi...
Hey,
I was wondering if there is a general database structure for the following situation.
In my web app, there are users and projects.
Now, whenever a project is created or modified, all users who have not seen that new / modified project yet have to be notified in some way (e.g. an icon in front of the project title or something)
...
I was wondering how can I correct this warning I keep getting listed below.
I'm using PHP & MySQL
Warning: min() [function.min]: Array must contain at least one element
Here is part of the code I think is causing the problem.
$tags = tag_info($link);
$minimum_count = min(array_values($tags));
$maximum_count = max(array_values($tags...
Hello,
I have in my database a table Articles with Article Name and Article Tags. Article tags is a string column with tags in it like this: "people, life, president". Every article is tagged in this fashion.
Now i would like to get 10 most popular tags for whole population of articles. How to do this?
...
Is there an appreciable performance difference between having one SELECT foo, bar, FROM users query that returns 500 rows, and 500 SELECT foo, bar, FROM users WHERE id = x queries coming all at once?
In a PHP application I'm writing, I'm trying to choose between a writing clear, readable section of code that would produce about 500 SEL...
I built a system 5 years ago. These years, localhost.log in client mysql database has been accumulated to 160G. Can I just delete this log? MySQL version is 4.0.20.
...
Once a day I need to update an MySQL table with a new file downloaded from the Net using ftp and then mysqlimport. However, I want my website to keep running smoothly during the mysqlimport operation, which takes quite some time (it's a big table).
What would be a good way to assure that users do not wait for the import to finish?
I am...
Is this OK ?
$i = 0;
while ($row = mysql_fetch_array($result))
{
$resultset[] = $row;
$columns[] = mysql_fetch_field($result, $i);
}
Then when trying to print
<tr><th><?php echo $columns[0] ?></th><th><?php echo $columns[1] ?></th></tr>
I got an error
Catchable fatal error: Object of class stdClass could not be converted t...
I recently starting playing around with the new features of Python 3.1 and porting one of my 2.6 apps. I was surprised to find that MySQLdb does not yet support any of the 3.x versions of Python. My app uses MySQL extensively, so, as you can imagine, I didn't get too far!
What are my options (if any) for working with MySQL and Python ...
<?php
// query db
$sql = "SELECT category.id as category_pk, category_id, products.* from category, products WHERE products.id = category.category_id AND category.id = category_id"; // from category get id
if ($result = mysql_query($sql)) {
if (mysql_num_rows($result)) {
$row = mysql_fetch_assoc($result);
...
Hello
I have a MySQL database that I replicate from another server. The database contains a table with this columns
ID, FileName and FileSize
In the table there are more than 4'000'000 records. I want to make fast a search in FileName (varchar) column
I found that I can use for this Sphinx search engine. The problem is that I want to...