Below is the code:
$result=mysql_query("select * from choices where a_id='$taskid'")or die(mysql_error());
while($row=mysql_fetch_assoc($result))
{ print_r($row); }
Why did I only got []? What's wrong?
More:
It can not be empty. The more complete code is as follows:
$result=mysql_query("select * from choices where a_id='$taskid'")or...
I have a MySQL table where there are two fields that make up the primary key, and a "sort" field. None of these are auto-incrementing.
When you do a query on the table without specifying an ORDER BY clause, it pulls the data out in the order that it was put in -- pretty standard. So whichever rows were inserted first, it pulls those out...
I want to SELECT all rows except for the first 5 rows in a table.
How do I do that?
Why cant I just type
$query = "SELECT *
FROM ages
OFFSET 5
ORDER BY id ASC";
...
im using html SELECT to make 3 dropdown menues. one for a list of countries, one for regions and one for cities.
they all have different tables in the database and they are linked to each other with foreign keys.
i want to force the user to first select a country while the other two menues are locked. when he has selected a country he ...
Hello, I have some code that works, but is clunky and am wondering if there is a better way to do it, first the code, and then i will explain:
// repeat query 10 times
for ($i = 1; $i <= 10; $i++) {
$query = @mysql_query("SELECT fileName FROM images");
while($row = mysql_fetch_assoc($query)){
extract($row);
echo "<img ...
I have a database table with a column where every entry is a regular expression. For example, the rows in my table look like this:
table: email_address_templates
email_address: /*.google.com/
email_address: /*.reddit.com/
email_address: /*.ac.uk/
I want to be able to search through this table, and find if a particular string matches...
Below is the code:
function swap(&$a, &$b)
{
list($a, $b) = array($b, $a);
}
for ($i=0; count($resultset);$i++)
{
for($j=1;$j<5;$j++)
{
$k = rand(1, 4);
swap($resultset[$i]["option".$j],$resultset[$i]["option".$k]);
}
}
It is a two-dimensional array from a MySQL query, I want to shuffle the values ...
Quick MYSQL/PHP question. I'm using a "not-so-strict" search query as a fallback if no results are found with a normal search query, to the tune of:
foreach($find_array as $word) {
clauses[] = "(firstname SOUNDS LIKE '$word%' OR lastname SOUNDS LIKE '$word%')";
}
if (!empty($clauses)) $filter='('.implode(' AND ', $clauses).')';
$quer...
Prepared statements are good to prevent sql injection when the user supplies data and we use that data for db insertion or just even to structure the query. But is really any benefit to PDO when I'm retrieving previously-inserted user-supplied data from the database?
It sounds to me like the answer is no. It's already in. As long as th...
Does anyone know of a simple tuturial for setting up and using Delphi 2010 with MySQL?
...
The following query is pretty simple. It selects the last 20 records from a messages table for use in a paging scenario. The first time this query is run, it takes from 15 to 30 seconds. Subsequent runs take less than a second (I expect some caching is involved). I am trying to determine why the first time takes so long.
Here's the quer...
At Django, a boolean field in MySQL is stored as a TINYINT. When I retrieve it, I get 0 or 1. Shouldn't I get False or True? Is there a way to achieve this behaviour?
...
Hello,
I need to be able to encrypt the MySQL traffic from a web server to a database server. I know how to set MySQL to use SSL based on the server and client settings in my.cnf however, this needs to be done using mysql_connect() in PHP. This may be a 2 part question.
1) Does mysql_connect() use the MySQL client settings that are s...
Hi folks,
I am trying to export some data from two tables bridged by a third table that stores the one (file) to many (keywords) relationship.
Tables are like so:
files
id, url, title
keywords
id, word
bridge
file, word
What I want is to produce an export that has one row per file like this:
files.id, files.url, files.title, keyw...
I have a client who will be selling access to an online service on their website. They would like to integrate a PayPal Buy Now button into the site... no problems there. However, they want their customers to have instant access to the online service that they are selling as soon as the payment is processed. That seems reasonable to me.....
Hi guys, i have a LAPP (linux, apache, postgresql and php) environment, but the question is pretty the same both on Postgres or Mysql.
I have an cms app i developed, that handle clients, documents (estimates, invoices, etc..) and other data, structured in 1 postgres DB with many schemas (one for each our customer using the app); let's a...
I have a table
CREATE TABLE `symbol_details` (
`symbol_header_id` int(11) DEFAULT NULL,
`DATE` datetime DEFAULT NULL,
`ADJ_NAV` double DEFAULT NULL
)
with ~20,000,000 entries. Now I want to find the ADJ_NAV value closest to the end of the quarter for just one symbol_header_id:
SET @quarterend = '2009-3-31';
SELECT symbol_head...
We have an application that has been deployed to 50+ websites. Across these sites we have noticed a piece of strange behaviour, we have now tracked this to one specific query. Very occasionally, once or twice a day usually, one of our debugging scripts reports
2006 : MySQL server has gone away
I know there are a number of reasons this...
Well, here is a small problem.
I am to design a web application database to use what is, basically, one spoken language. However this language has two alphabets (Latin & Cyrillic) and three spoken variants that actually have only some minor differences (I think there is several hundred words that are slightly different). To make matters...
I have a search implemented on my site, it runs the following queries:
SELECT COUNT(mov_id) AS total_things
FROM content
WHERE con_status = 1 AND con_incomplete = 0 AND con_type = 1
AND ((con_title) LIKE ('%search keyword%')
OR soundex(con_title) LIKE soundex('search keyword')
OR MATCH (con_tit...