Tagged Questions
-5
votes
1answer
27 views
Using PHP a regular expression to TEXT date,time,nmbr insert into mysql
I have a text,using php a regular expression ,read the "date","time","nmbr" into array,add current year 2013
array(
[datetime]=2013-07-03 17:22
[nmbr]=13332415858
)
array(
...
0
votes
0answers
33 views
mySQL group by value depending on another value
I have some videos I upload to server for online viewing. Sometimes they are too long and I have to cut them into pieces.
I have these table in MySQL http://img842.imageshack.us/img842/3317/k7ro.png
...
0
votes
3answers
37 views
Why the query is returning only a single record instead of many?
I'm using PHP and MySql. Following is my code:
$con=mysql_connect("localhost","XYZ","pqr") or die("Failed to connect with database!!!!");
mysql_select_db("LMN", $con);
$sql =" SELECT ...
0
votes
0answers
18 views
Shuffle array() then Update to Database mysql/php without duplicating a number which is taken
$sql5="SELECT * FROM periodeight where available='0' ";
$result5=mysql_query($sql5);
if ($result5 === false) { echo "No Spaces Available!"; }
$types = array();
while(($row = ...
-4
votes
0answers
23 views
Read table into array, sorting and counting similar items [on hold]
I would like to program using PHP next idea:
Imagine that you have 7 numbers, on the beginning
create an array
store this first set of numbers in array (1,2,3,4,5,6,7) at position 1
And then for ...
0
votes
2answers
31 views
Putting array containing multiple arrays into mysql table
What I have:
An array with 30 keys, some keys contain only one value, while others contain several (one key contains 28 values). So firstly I don't even know if this will work. But I have tried using ...
1
vote
1answer
31 views
Search through JSON to build MySQL Insert?
I am attempting to integrate an OpenID login system on my website. I've used the provided code and the login system does properly return my data and it is being stored successfully in PHP.
Data ...
0
votes
1answer
53 views
How to insert array of custom objects into mysql database
I'm building an iOS app in which I allow the user to navigate through products and order them. When the user taps order, I want to save his/her username, email, address, date of delivery and of course ...
1
vote
1answer
31 views
Multidimensional array output
So I have this array data which i want to be coded somewhat like [lojas, raparacoes, valor],[nome_1, count_1, val_1],[nome_2, count_2, val_2], etc, etc...
lojas, reparacoes and valor are like headers
...
0
votes
2answers
28 views
Adding and updating Mysql child table with multiple number of entries
I have two tables in mysql: a master table called "grants" and a child table called "goals". Grants has an id field as well as a bunch of others and goals has a goal name and a grant_id to link it to ...
-1
votes
0answers
23 views
PHP Phone cost ideas [on hold]
I am developing a way to calculate the call cost depending on the destination.
I have a database with numberprefixes such as:
46 local
467 mobile
4677 free phone
4620 free phone
These are stored in ...
-1
votes
2answers
32 views
PHP order by clause with array as order by statement
I got a array with a query
This array is ordered by criteria.
Now I want to make a new query
Sample
$array = (987, 2661, 12, 789, 54);
And I want in this order by array selecting articles
...
0
votes
2answers
27 views
Error: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean give [duplicate]
can you help me with this code please,
<link rel="shortcut icon" href="<?php echo URL_GLOBAL; ?>graficos/logoIcon.jpg" />
<?php
$listaAJ = mysql_query("SELECT * FROM ajuste LIMIT ...
0
votes
2answers
72 views
How to create an SQL query for the scenario given below? [closed]
I'm having an array named $arrResult. I've received this array from complex JOIN SQL query. For your reference I'm printing the array here:
Array
(
[21e86b3ebf6a8af2a9fcf136c4f8e88a] => 1
...
1
vote
1answer
25 views
Wordpress Loop - Only Unique Values for Meta_Key
I have a Problem with grouping meta_values.
The Query looks for posts with the metakey "company". I want a unique listing of the colors like: blue red yellow
array_unique was not successful and also ...
-2
votes
0answers
42 views
Display Array as tree structure in php [closed]
I have array like this
Array
(
[0] => Array
(
[lev1] => Root
[lev2] => Test2
[lev3] => sub test2
[lev4] =>
)
...
0
votes
1answer
40 views
Using foreach to submit a dynamically generated form
I've created a dynamically generated form for the purpose of allowing users to record project milestones. Users can input the date and a description of the milestone, and then gives an option to add a ...
0
votes
1answer
39 views
PHP insert into mysql from array
I'm having a heck of a time trying to figure out how to loop through my posted form data and inserting to mysql. My database table contains two columns "name" and "age"
My form:
<form ...
0
votes
3answers
25 views
Output from imploded array not returning first instance (PHP)
So, I have an array which I am combining to create an INSERT command. (No sanitizing done yet, just a proof of concept).
$namedata is the data for the "Name" field (for example "This Name")
$refdata ...
-2
votes
3answers
35 views
Check my code for a multi-dimensional JSON array in PHP?
Now, before you all mark this as a duplicate question, please hear me out. I've done ample research on PHP JSON arrays, json_encode and json_decode, yet it's using these functions that have presented ...
0
votes
2answers
38 views
Grabbing All of MYSQL Rows Using Array
Hi I'm trying to output all of the rows and information from my table :
id,Symbol,entry,exit,openclosed,entrydate,longshort,target_one,target_two,target_three,notes
This is through this script I'm ...
0
votes
1answer
39 views
If array contains text values add them to the database MYSQL
So I have an array which usually contains ID numbers (which link up in a database) but if a user adds a new value on the form submission page, the new value is added to the array without an ID number.
...
-1
votes
1answer
101 views
Getting SQL result into an array
i'm trying to get a MySQL result like "SELECT * FROM sales"
into an array that looks like this:
$data = array(
array('Date', 'Sales'),
array('June 25', 12.25),
...
1
vote
1answer
38 views
Inserting multiple arrays into different rows
I'm collecting input fields as an array to be inserted into the different rows in the database. However it only inserts the first row of the array.
Please kindly assist. I have some issues handling ...
0
votes
3answers
39 views
remove integer index an array
I am working on a website where we need to remove the index of an array where type is integer.
Have you any idea or suggestion regarding.
My array looks like this :
Array
(
[0] => first
...
1
vote
3answers
124 views
PHP arrays and objects together - Bad / Good Practice?
I'm fetching data from a MySQL Database. The results are returned in an object.
I can then access the data like so:
$db_data->row
In a foreach loop I alter the $db_data by adding an array, for ...
0
votes
1answer
30 views
adding multiple rows in mysql table based on an array
I have a form which allows people to message each other, a user can select multiple people to message, when i submit a form it gives me the name and id of people selected to message in an array. uptil ...
0
votes
1answer
41 views
How i can get the array ID from a page to another redirect page
This is my first post. I have searched a lot but I couldn't find what I was looking for. So I have this file that break the content of the post and has a read more:
<?php
...
-7
votes
0answers
33 views
Fetch value from DB using Array php [closed]
I have a question id in 1 table like ,1,2,3, , then i am doing explode each value by comma, now i want to fetch related data from DB using exploded array value.
how should i do?
0
votes
4answers
31 views
Foreach loop still execute after the last array is updated
I get an error "Error: Query was empty" after completing the task instead of the echo result. I suspect that the FOREACH still attempt to execute the query even the last array is updated. Am I right?
...
0
votes
3answers
26 views
How to convert an array to string with index
I would like to convert an Array like this:
array ( [1_1] => 1 [1_2] => 2 [1_3] => 3 [1_4] => 4 [1_5] => 5 )
to an string like this:
"1_1-1/1_2-2/1_3-3/1_4-4/1_5-5"
how can I do ...
0
votes
2answers
49 views
foreach loop to populate multiple radio buttons from a database in a php string
UPDATE:
Thanks to the answers provided by SeanWM and Styphon, I offer the full, working code to those who are looking for a similar answer:
<?
if (isset($_GET['id'])) {
include ...
-1
votes
1answer
57 views
How to post array data from a form to mysql DB
please forgive naivety and innocence...I am not a programmer! I have spent the best part of 4 days on this and I am ready for a PHP lesson or intense therapy.
Scenario: DB built in mySQL. Table with ...
0
votes
1answer
34 views
How do I get an variable outside of an array in PHP for MySQL?
I have a large foreach loop that has other loops and conditionals inside it. At the top of the code I am modifying I wish to a value out of the option_data array - how is this done?
foreach ...
-2
votes
4answers
41 views
mySQL - Show recommended store first then the rest - ignoring the recommended [closed]
Building a "store" finder as such and want a recommended feature where a recommended store is shown at the top then the rest. The method I have come up with so far does a mysql query for ...
0
votes
4answers
28 views
how do I fetch and combine data from MySQL then insert into array in PHP
This question is quite specific for my needs, hence I can't find the best way to do this.
What I would like to do is fetch name and surname from the table people and combine both into an array to end ...
0
votes
4answers
61 views
Not getting array values when posting them in a form
I have gone through various posts but can't find a solution to this problem:
I have a form with several rows of fields to insert in a database table with one Click of the submit button. This is the ...
0
votes
1answer
28 views
accessing DB array key/value outside switch
I have a mysql table with questions IDs (q_ID) and answers (a_answer). I want to use this data to populate some html later in the doc. Some of the data is separated by '|' and I want to use switch ...
0
votes
1answer
38 views
PHP Array - Odd data when saving to MySQL
I have a PHP array that I am saving to a MySQL Database:
$q35list = serialize($_POST["q35list"]);
Using mysqli_prepare I am saving successfully to the database.
What is odd is that I have a mix ...
1
vote
2answers
73 views
How do I create a MySQL query using an array?
I need to take an array and use it for a MySQL query.
I tried looking for methods but all of them seem to be related to PHP arrays and not Ruby.
For example, I have terms = ['genetics', 'elderly', ...
0
votes
2answers
42 views
Codeigniter group by array
HELP!
I am trying to generate a "past events" page for my CI website, using a MySQL database table called "events". There are 100+ rows of data, some duplicate, that range across 5 major countries - ...
2
votes
2answers
32 views
merge search results of tables with different colums and sort by date
I'm trying to build a search result of three differend log tables with one output. This output has to be sorted by "time" and echoed in a foreach loop.
table
id | record-id | user_id | time | ...
0
votes
2answers
28 views
Create array from form and update mysql
This is my first attempt to post multiple records for a single table column and would need some help.
First, how can I post these records in an array?
<?php
<form action="set_order.php" ...
-6
votes
0answers
27 views
List objects on html tables with MySQL [closed]
I'm trying to make a table in html that show multiple results.
Like this image http://i.imgur.com/B6ss12t.png with more than one results.
How i can list the results in the table like that?
0
votes
3answers
36 views
base64 decode 2 items in array and still output for json?
So I have this
$result = mysqli_query($con,"SELECT ID, category, tag, title, titleImage, thumbImage, pubDate, shortCopy, fullCopy FROM articles WHERE ID=$IDparam");
while($row = ...
1
vote
2answers
32 views
How to insert array into sqlitedatabase column and how to show in Uitableview cell
How to insert array into sqlitedatabase column and how to show in Uitableview cell.
Here iam showing data in tableview in that selected cell data saving in one array(selectedDataArray) . How to store ...
0
votes
0answers
33 views
Multidimensional array output by mysql show tables
I will start to get te existing tables whit this query:
<?php
$tblArray = array($cvsShop01, $cvsShop02, $cvsShop03, $cvsShop04, $cvsShop05);
$dbh = new ...
1
vote
3answers
35 views
Each row of a MySQL-database stored in an object via PDO query?
I try to get something like this from a MySQL-database via PHP and PDO query:
return array(
"Jungle Book" => new Book("Jungle Book", "R. Kipling", "A classic book."),
"Moonwalker" => ...
0
votes
1answer
46 views
Saving an array of strings in a mysql table [closed]
I want to save an array of strings that I have in my java program to a mysql table field or column. What is the best way to save this array knowing that you can't save an array as a one column in the ...
-2
votes
4answers
49 views
How to use PHP Array in MySQL Select statement with IN? [closed]
I have an array and I wrote this code which does not work. Could someone help me with this query? Thanks a lot!
$sql = "SELECT * FROM `product` WHERE `product`.`Productcode` IN (".$array.") ";
...