2
votes
4answers
29 views

How does PHP/MySQL know to fetch the next row when using mysqli_fetch_array in a while loop?

Here is the code: <?php $q = 'SELECT * FROM categories ORDER BY category'; $r = mysqli_query($dbc,$q); while (list($id,$category) = mysqli_fetch_array($r,MYSQLI_NUM)) { echo ...
0
votes
2answers
27 views

Adding objects to an array - overwrites instead of adds

I'm working on a way to add recipients from a contact list to an array so that that the contacts of the array can be used as recipients in message. I understand arrays well enough for basic use but ...
1
vote
2answers
16 views

Multidimential array in php to save mysqli output

Here is a piece of my code: if($all_pages) foreach ($all_pages as $page) { $all_hokms = $mysqli->query("SELECT * FROM qm_hokm WHERE page_id = ".$page['page_id'].""); if($all_hokms) ...
-1
votes
1answer
20 views

Storing an array in MySQL table [on hold]

I'm designing two tables in MySQL: user: personal details, team[10], points players: personal details, points, value team[10] means an array of ten players. How can I store this array in my table? ...
0
votes
2answers
43 views

How to add this array to MySQL (very confused)

I have been trying to find answer to this question for a while but I was not able to... So I have to ask a question... To make it short, I will not post any code that I have but ask straight forward ...
0
votes
1answer
22 views

Checkboxes refine search from mysql table stored with comma seperated fields

I am implementing a refine search for mysql query based on checked check boxes value and matching value stored in Mysql database table. Check box fields are as below: <input type="checkbox" ...
0
votes
1answer
20 views

mysql result in javascript global array

I need to have a MySQL table result in JS array so that i can search through the names when typed in a text box. I mean, lets say i have a table with some names, now when the page is requested, it ...
-3
votes
1answer
53 views

Create HTML table from PHP array from mysql [on hold]

This is my current code, I have a separate script for making the connection to MySQL, and I have another script containing my MySQL functions. Using this I have managed to get my database into an ...
0
votes
1answer
19 views

Return information schema column comments into a php array

The follwing shows how to output an individual table column comment. $db = mysql_connect("localhost","root","xyz") or die(mysql_error()); mysql_select_db("database",$db) or die(mysql_error()); ...
0
votes
1answer
24 views

Initialize array to use mysql output outside loop

Why the print_r don't output any data? $host = array(); while($row = mysqli_fetch_array($result)) { $host = parse_url($row['url'], PHP_URL_HOST); //echo $host; echo "<br>"; } ...
1
vote
3answers
31 views

php to display table; column one with mysql column comments and column two transposed row results

Apologies for the perhaps poor title - It is best to display my goal visually: I want something like this to show on the page when user goes to SomeURL.com/test.php?id=101 | Questions | Answers ...
0
votes
0answers
28 views

How to query a database with each loop of a Multidimensional Array

I am not sure my title properly explains what I am trying to do. I successfully completed the first part of my script. It is the following two parts that I am having trouble with. First of, the system ...
0
votes
4answers
68 views

PHP, how to check if a MySQL table has a name

I am trying to connect to the MySQL database to check a table (builditblocks) to see if there is data the user gave in the "name" column. Here is what I have so far: <?php ...
0
votes
5answers
47 views

How can $_POST pass input variables to MySQL query as integers, not 1?

I have a table of numbers where the user should be able to edit the values and have the database updated on submit. So far, my faulty code is updating every field with the value 1 on submit, ...
0
votes
2answers
34 views

PHP opendir and readdir with array directories (not one)

I have this problem, I want to use opendir with this array of directories, it is possible? with a fixed url I can read files with readdir. But I dont know what to do with multiple directories... ...
0
votes
3answers
39 views

assigning mysql array result to php variable

I am trying to send sms to all the members in a mysql table using API. I am able to send the sms. But only first row in the table is being used, whereas I want that the sms is sent to all the ...
0
votes
1answer
40 views

Insert multiple rows from array saved in a session into table?

I'm passing multiple state values that are stored in a session variable, into a MySQL table via php using one insert command and I'm wondering if its possible to insert each state value into a ...
0
votes
1answer
37 views

Is a foreach array the best choice to change sql column names on my web page? [closed]

Okay so I am currently building a website using php and mysql. Here is my issue: Some of my columns in my database are such things as US, Darke, and year2010. Many of these column names are placed in ...
2
votes
1answer
192 views
+50

MySQL comma seperated values

I currently have a sql and php problem where i use this statement to get everything form services as well as its associated tables: $db = $this->getDbo(); $query = $db->getQuery(true); // ...
-2
votes
1answer
53 views

How to identify array key with value

I have a table like below : and using below way to calculate result as array while($Br_ROWS = mysql_fetch_assoc($Bracket_Query)){ $Bracket_Result[] = $Br_ROWS; } Array result like below : ...
0
votes
2answers
34 views

Quick way to turn single-value array into variable in PHP?

Say I have an array which fetched a single row from my database via the PDO::FETCH_ASSOC method, which I would then assign to a variable like so: $result = $stmt->fetch(PDO::FETCH_ASSOC); ...
0
votes
1answer
16 views

Storing data in global/session variables vs. MySQL queries

A general PHP question about organizing a website: for efficiency purposes, is it better to store data from MySQL queries into global arrays, or to make a new query every time data is needed? I am ...
0
votes
2answers
46 views

how to get output of this code. sometimes it shows output and sometime it doesnot?

<?php include 'config.php'; $tid = $_GET['tid']; $sql="SELECT FROM topics where tid='$tid'"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ ?> <div ...
-1
votes
1answer
38 views

Build Mysql query with forearch loop php

Values are inside a multidimenssional array like: Array ( [0] => Array ( [fname] => CollectiveAccess [lname] => Administrator [username] => administrator ...
1
vote
1answer
27 views

Just cant get the for loop to produce needed array in Php

I need my for loop to return an array that looks like this $nullArray =array( 0 => array("id" => 1, "label" => "test 1", "type" => "folder"), array("id" => 2, "label" => ...
0
votes
2answers
48 views

SQL statement with joining 4 tables and foreach loops

Hello from Bulgaria, it is my very first post here so excuse me if I do not explain everything very well. I'm doing admin panel in website(PHP, MYSQL) for Online Language Courses. I have to see: A ...
1
vote
2answers
39 views

Storing db value into php array with while loop?

I am wanting to search through AdvInfo table and store the primary keys if Unit = Child. $result = mysqli_query($conn, "SELECT * FROM AdvInfo WHERE Unit = Child"); while ($row = ...
0
votes
2answers
26 views

What is this of datatype, parameters

If i read data from a db table (Mysql) i get this as return: [{"name":"Mobile Groups","value":1,"target":null,"alias":"mb_group","required":1,"showNull":0}, {"name":"Beta ...
0
votes
1answer
57 views

Two foreach loops to be used in one SQL query

I have two arrays: $armortype = array(5,8); and $slotarray = array(1,2,3,5,6,7,8,9,10,11,11,12,16); How do I combine these two in one foreach loop? Here's the code at the moment: ...
0
votes
2answers
80 views

I would like to insert comma separated values into a single row using php

I would like to insert array into a single row with different fields. e.g I want to insert into table platform with fields idusr, brower, os, year with array values 1,chrome,ms,2013 where $customid ...
0
votes
4answers
75 views

SELECTING WHERE from array in a mysql query

I'm trying to SELECT from an array inside a mysql query result = mysql_query(" SELECT * FROM fruit_db WHERE fruit='".$url."' ") $url has been created by $_GET and exploded into an array. It can be ...
0
votes
2answers
67 views

How to Convert Array into String in HTML Form? [Notice: Array to string conversion?]

I am trying to take FILES in Array from HTML form, and store them in database. I have written the following code and it is giving me many error messages. It looks like that the main problem is that it ...
0
votes
1answer
23 views

Is there a way to get joined tables as array?

I have a user table, education table and work experience table: users id first_name last_name education user_id name start_year end_year workexperience user_id name start_year end_year ...
1
vote
2answers
34 views

insert the array into the database

I am getting this result when I am using graph api . it is in array format { "id": "216805086", "name": "raj sharma", "first_name": "raj ", "last_name": "sharma", "link": ...
-1
votes
2answers
22 views

Undefined Offset Notice With Update Query

I have a form that displays a Selection ID, Selection, and Definition pairing from a database. The form is dynamic...depending on the user, there could be any number of these pairings. Here is an ...
0
votes
1answer
38 views

Inserting multiple rows into table

So I basically have 2 arrays with a lot of numbers in them, I implode them: $array1 = implode(", ", $array1); $array2 = implode(", ", $array2); When I echo $array1 and $array2 it looks okay, ...
0
votes
2answers
122 views

What is the best way to store multiple checkbox values in the database and work with it later on

I am working on a website and i want to add a new section to it that will contain an advanced form for storing that data. There will be about 20-30 fields and few of them will be represented by ...
0
votes
1answer
24 views

Efficient way to query database from an array

I have an array containing about 400 10-20 character, single string number items. I want to query my database from this array in the most efficient way (on server load and load time) possible. Here is ...
0
votes
2answers
57 views

PHP MySQL fetch result and display

Trying to learn some more PHP and MySQL here now, and I'm having problems understanding how this works. I do know other languages, so I'm hoping I will understand PHP much better if I just can get ...
3
votes
2answers
34 views

Model returning null values

I'm a new bee to web development. I need to get data (some columns) from the job table and filter it according to the user name in the session and a status value (status is a TINYINT there for ...
0
votes
1answer
26 views

Finding specific key and return value in a multidimentional array

Consider the array below: //$allmembers Array ( [0] => Array ( [id] => 7 [name] => John Smith ) [1] => Array ( [id] ...
0
votes
1answer
31 views

PHP - Displaying one array based on another array

Ultimately I'm just trying to build a page that imports a csv file into a mysql db. I've imported the csv successfully. And I've set up the page so the user selects from a dropdown what field from ...
0
votes
1answer
67 views

MySql empty result set returns different formats

I am trying to execute two simple select queries on two different tables in mysql server. This I am doing this by running a php script. Both the queries are supposed to return an empty result set. But ...
0
votes
1answer
42 views

Getting Array with MySQL

I have a form with the fields Name, Email, and City. City is an autocomplete field that calls 3 separate tables (Cities, Regions, Countries). What I'd like to do is to have these explode into an ...
-5
votes
1answer
56 views

Function expects array to be string, convert?

Before downvoting you can atleast write what is bothering you, jesus christ this arogance I get "Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in bla bla..." ...
0
votes
1answer
51 views

PHP - MYSQL Query multiple values from an array

I want to run an insert query in a loop until all the elements from an array pass. Ex: $signs = array("aries", "taurus", "gemini", "cancer", "leo", "virgo", "libra", "scorpio", "sagittarius", ...
1
vote
2answers
38 views

Arrays in MySQL? [duplicate]

I have a database that's formatted like this: URLID USERNAME URL 0 jake abc.com 1 jake 123.com 2 po google.com 3 po googl3.com 4 po ...
0
votes
2answers
59 views

automatically generate update form with array

$resultUpdate = Nemesis::select("*", $table, "id = '{$id}'"); if (!$resultUpdate) { self::show_error(QUERY_ERROR); } elseif ($resultUpdate->num_rows > 0) { $out .= '<div ...
1
vote
3answers
49 views

Best practices of dealing with very large arrays? DB?

In another question, I stated that I was running a php script that grabbed 150 rows of data from a mysql database, then did some calculations on that data, which it put into an array (120 elements ...
0
votes
2answers
54 views

get a previous array value

I am making a php chat system and I would like to add a header for each day. In order to achieve this I need a way to get both the current message date and the previous messgage date from my ...

1 2 3 4 5 42
15 30 50 per page