61
votes
6answers
104k views

PHP/MYSQL using an array in WHERE clause

given an array $galleries = array ( [0] => 1 [1] => 2 [2] => 5 ) I want to have a sql query that uses the values of the array in its ...
6
votes
5answers
3k views

I have an array of integers, how do I use each one in a mysql query (in php)?

I have an array full of random content item ids. I need to run a mysql query (id in the array goes in the WHERE clause), using each ID that's in the array, in the order that they appear in the said ...
28
votes
12answers
37k views

Save PHP array to MySQL?

What is a good way to save an array of data to a single mysql field? Also once I query for that array in the mysql table, what is a good way to get it back into array form? Is serialize and ...
4
votes
4answers
20k views

Why do I get “Resource id #4” when I apply print_r() to an array in PHP? [duplicate]

Possible Duplicate: How do i “echo” a “Resource id #6” from a MySql response in PHP? Below is the code: $result=mysql_query("select * from choices where a_id='$taskid'")or ...
0
votes
2answers
3k views

mysql fetch array if no results display message

I am trying to get a database call to show a statement saying no results found if there are no results returned. How would I go about doing this to my code:- $getFixtures = mysql_query("SELECT ...
0
votes
4answers
4k views

MySQL query using an array

I'm trying to query a MySQL database using an array but I'm having trouble! I have a table called clients, I want to be able to select 'name' from all rows whose 'sector' column is equal to ...
12
votes
4answers
4k views

BLOB vs. VARCHAR for storing arrays in a MySQL table

I've got a design decision to make and am looking for some best practice advice. I have a java program which needs to store a large number (few hundred a day) of floating point arrays in a MySQL ...
5
votes
3answers
2k views

mysql_fetch_array, mysql_fetch_assoc, mysql_fetch_object

The functions are all very similar: mysql_fetch_array(), mysql_fetch_assoc(), mysql_fetch_object() I have recently started using mysql_fetch_object as I am doing alot more OOP with PHP. But what ...
0
votes
4answers
2k views

PHP/MySQL - an array filter for bots

I'm making a hit counter. I have a database and I store the IP and $_SERVER['HTTP_USER_AGENT']; of the visitors. Now I need to add a filter, so I can put away the hits, that are made by bots. I found ...
3
votes
5answers
17k views

PHP/MySQL - building a nav menu hierarchy

So the final menu will look something like this: Item B Item B-1 Item B-1-2 Item B-1-1 Item A SubItem A-1 SubItem A-2 Item C Based on the following DB records: id ...
1
vote
3answers
2k views

PHP - reformat multidimensional array to insert into MYSQL?

how can I parse php array like this: $cars= array( ...
6
votes
7answers
11k views

mysql select query within a serialized array

I'm storing a list of items in a serialized array within a field in my database (I'm using PHP/MySQL). I want to have a query that will select all the records that contain a specific one of these ...
3
votes
3answers
630 views

An efficient way to save an Array and its Keys to a database

I am trying to save lots of variables to a database and its getting ridiculous now. I am using PHP and MySQL. Is there a way, I can get the array value and the array keys (array keys are exactly ...
0
votes
6answers
7k views

Insert array into MySQL database with PHP

I have the following array I want to store in my database... $insData = array( 'uid' => $fbme['id'], 'first_name' => $fbme['first_name'], 'last_name' => $fbme['last_name'], ...
0
votes
3answers
2k views

Codeigniter Select_Sum returns “array” not numerical value?

I needed to add up all the rows for a result. Using the select_sum as follows Here is the model function Dues_Paid_Tot($date) { $query = $this->db->select_sum('Dues_Paid', ...

1 2 3 4 5 9
15 30 50 per page