php,mysql,arrays,codeigniter,foreachRelated issues-Collection of common programming errors


  • Matt Ball
    php computer-algebra-systems
    I’m creating a CAS (Computer Algebra System) in PHP, but I’m stuck right now. I am using this website.Now I wrote a tokenizer. It will convert an equation like this:1+2x-3*(4-5*(3x))to this:NUMBER PLUS_OPERATOR NUMBER VAR[X] MINUS_OPERATOR NUMBER MULTIPLY_OPERATOR GROUP(where group is another set of tokens). How can I simplify this equation? Yeah, I know what you can do: adding X-vars, but they are in the sub-group. What is the best method I can use for handling those tokens?

  • iainjames88
    php ubuntu-12.04 error-reporting internal-server-error
    I’ve set up a fresh install of Ubuntu Server 12.04 LTS on Amazon AWS with *Apache2/MySQL/PHP5. When I run a PHP script and it encounters an error I don’t see any error reporting from PHP, all I see isHTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfil the request.I have checked my /etc/php5/apache2/php.ini file and as far as I can tell error reporting should be set up. The contents of the file (regarding errors) are:; displ

  • Charles
    php oop
    Using PHP 5.3 I’m experiencing weird / non-intuitive behavior when applying empty() to dynamic object properties fetched via the __get() overload function. Consider the following code snippet:<?phpclass Test {protected $_data= array(‘id’=> 23,’name’=> ‘my string’);function __get($k) {return $this->_data[$k];}}$test= new Test(); var_dump(“Accessing directly:”); var_dump($test->name); var_dump($test->id); var_dump(empty($test->name)); var_dump(empty($test->id));var_dump(“Ac

  • codaddict
    php operators ternary-operator
    This is what I wrote :$Myprovince = ( ($province == 6) ? “city-1” : ($province == 7) ? “city-2” : ($province == 8) ? “city-3” : ($province == 30) ? “city-4” : “out of borders” );But for every field I got the value city-4. I want to use ternary operators instead of switch/if because I want to experiment and see how it would be done.What’s the problem with this code?

  • Jess Telford
    php unit-testing phpunit
    When running a PHPUnit test, I would like to be able to dump output so I can debug one or two things.I have tried the following (similar to the PHPUnit Manual example);class theTest extends PHPUnit_Framework_TestCase {/*** @outputBuffering disabled*/public function testOutput() {print_r(“Hello World”);print “Ping”;echo “Pong”;$out = “Foo”;var_dump($out);} }With the following result:PHPUnit @package_version@ by Sebastian Bergmann..Time: 0 seconds, Memory: 3.00MbOK (1 test, 0 assertions)Notice

  • user456885
    php multibyte
    Given certain multibyte character sets, am I correct in assuming that the following doesn’t do what it was intended to do?$string = str_replace(‘”‘, ‘\\”‘, $string);In particular, if the input was in a character set that might have a valid character like 0xbf5c, so an attacker can inject 0xbf22 to get 0xbf5c22, leaving a valid character followed by an unquoted double quote (“).Is there an easy way to mitigate this problem, or am I misunderstanding the issue in the first place?(In my case, the st

  • testwork
    php facebook facebook-graph-api facebook-php-sdk
    I have a problem with posting image in more than one facebook pages. I am creating an image using GD Library.I am using facebook api to post in the pages with pageid and page access token. When a submit button is clicked for the first time the image is not uploaded and gives the error – **OAuthException: An unexpected error has occurred. Please retry your request later.Fatal error: Uncaught OAuthException: An unexpected error has occurred. Please retry your request later thrown in /sdk/base_fac

  • apaul34208
    php class codeigniter
    Basically I have a helper file with several function. I auto load the helper in the config file so theoretically reloading it is not required.However when I try to use the function that I created(from this helper) within a new library that I am working on it will through this error:”Parse error: syntax error, unexpected ‘(‘, expecting ‘,’ or ‘;’ in /home/techwork/public_html/giverhub/application/libraries/Udetails.php on line 7″Whenever I use that function anywhere else(module,controller,views)

  • khellang
    php javascript jquery ajax
    Basically I am trying to post a comment via AJAX and then load the new comment into the HTML. I am having a problem with what I think is my AJAX success function. The data gets added to the database fine, but I still get an error “Sorry, unexpected error. Please try again later.” as set inside the success function itself.JS:function newComment(event) { event.preventDefault();//Get the data from all the fieldsvar comment = $(‘textarea’);var product_id = $(‘input[name=product_id]’);var form

  • Zack Morris
    php bash cli shell-exec suppress
    If you create a simple php script with this code:shell_exec(‘”‘);And run it with:php myscript.phpIt gives the following error in bash on my Mac:sh: -c: line 0: unexpected EOF while looking for matching `”‘ sh: -c: line 1: syntax error: unexpected end of fileI’ve tried everything I can think of:ob_start(); @shell_exec(‘”‘); ob_end_clean();@shell_exec(‘” 2> /dev/null’);But no matter what I try, I can’t suppress the message. The problem is that I’m creating a unit test to stress test $argc, $ar

  • kehinde
    mysql sql hibernate jsp batch-file
    I have been on this for a couple of days, no solution. I pray somebody gives an adequate answer to get this resolved. It’ll really be an accomplishment. What I want to achieve There are only three (3) controls on the interface – a dropdown, an input, and a submit button. The dropdown gets its values from a column (ownerName) in a table in the database. To perform a transaction from the interface, a value is selected from the dropdown, a value is inputted into the input box (textbox) which is t

  • user2646712
    mysql hibernate grails hql
    I attempting to convert the following mysql query to hql. The problem is it keeps throwing errors on my case statement any help would be greatly appreciated — thanks in advance.mysql querySELECT emisupport_dev.vm_profile.vmp_name, emisupport_dev.virtual_machine.vm_profile_id FROM emisupport_dev.virtual_machine INNER JOIN emisupport_dev.vm_profile ON emisupport_dev.virtual_machine.vm_profile_id=emisupport_dev.vm_profile.id GROUP BY emisupport_dev.virtual_machine.vm_profile_id HAVING COUNT(CASE

  • abbood
    mysql windows powershell escaping windows-server-2012
    I’m following the instructions from the mysql site on resetting the mysql server’s password on a windows machine.. copying the command verbatim:C:\> “C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt.exe”–defaults-file=”C:\\Program Files\\MySQL\\MySQL Server 5.0\\my.ini”–init-file=C:\\mysql-init.txtgives me this error (abbreviated):Unexpected token ‘defaults-file=”C:\Program Files\MySql\Mysql Server 5.0\my.ini”‘ in expression or statement.The ‘–‘ operator works only on variables or on

  • nIx..
    mysql sql hibernate select insert
    This might be basic question, I am trying to execute insert select query using Hibernate, insert into A(col1, col2) select xxx, yyy from (select b.col1 as xxx, c.col1 as yyy from B b,C c where someCondition1UNIONselect b.col1 as xxx, c.col1 as yyy from B b,C c where someCondition2 ) as ZHibernate is giving syntax error: Unexpected Token ( at <br/> xxx, yyy from (…While same query works when executed as SQL.Full stack trace is org.hibernate.hql.ast.QuerySyntaxException: unexpected token:

  • Yuriah
    php mysql
    [FIXED] I fixed my problem. As suggested by Fred -ii- I visited this Q&A on SO. I saw he used checkboxes which to seems much more useful than buttons since you can take multiple objects out at a time. Also he attached the id of the object to the button like so just like Subin suggested as well.<form action=”” method=’POST’><input style=’display:block; margin:0 auto;’type=’submit’ name=’delete_button’ value='<?php echo row[‘id’]; ?>’/> </form>Here is the fixed code. I

  • hakre
    php mysql http-status-code-500
    I am trying to import a CSV into a MySQL table with a PHP script. This SQL command successfully imports the CSV file into the SQL table: mysql> LOAD DATA LOCAL INFILE ‘property_re_1.csv’ -> REPLACE INTO TABLE `markers` -> FIELDS TERMINATED BY ‘,’ OPTIONALLY ENCLOSED BY ‘”‘ ESCAPED BY ‘\\’ -> LINES TERMINATED BY ‘\n’ IGNORE 1 LINES; Query OK, 315 rows affected (0.01 sec) Records: 315 Deleted: 0 Skipped: 0 Warnings: 0Now I want to convert this SQL command into a PHP script. Here’s

  • eggyal
    mysql index group-by
    I have an issue in one of mySql query. Issue is not reproducible on any of our local machines. I have a simple querySELECT ID FROM TABLE_NAME WHERE ID IN (15920,15921) GROUP BY ID returns result – ID 15920Which is unexpected result since there is data for both the ids in database.Using explain command returned the following result for this query +—-+————-+————+——-+——————–+——————–+———+—–+——+—————————————+

  • DaveG
    mysql ruby-on-rails ruby csv
    Not sure how to change a date in my csv file when importing into MySQL that is in 12/1/2011(mm/dd/yyyy) format. MySQL is in yyyy/mm/dd. How can I do this?My rake filerequire ‘csv’ require ‘date’desc “Import gac from csv file” task :import => [:environment] doDir.chdir(“#{Rails.root}/lib/assets”)csv_file = “file.csv” CSV.foreach(csv_file, :headers => true) do |row|Institution.create({:company => row[0],:solveid => row[2],:phone => row[5],:other => row[6],:clientdate => (DateT

  • GMBrian
    mysql sql-order-by
    I’ve been having some unexpected results with a MySQL query. I want to order naturally by the title of my posts (I’m running WordPress but I don’t think this is related).Here’s an example of some occurring title to give an idea:1-1-1a 1-13-5j 7-1 9-1-2 12-13-2aI did quite some research and the closest to the result I wanted I got using ORDER BY (posts.post_title+0) ASCI’m still getting a weird result on one page of results. The full query is as follows.SELECT rlt13_posts.post_title FROM rlt13_p

  • infinity
    php javascript jquery mysql
    I’m building a website to learn coding and I have an autocomplete that is based on Jquery ui’s that I’m populating by three mysql tables.Here’s my code on index.php (the page where my search box is and autocomplete should be on)<script src=”./public/js/jquery.js”></script><script src=”public/js/jquery-ui-1.8.22.custom.min.js” type=”text/javascript” charset=”utf-8″></script><script>$(function() {$(“#search”).autocomplete({source: “suggest.php”,minLength = 2,select:

  • daxim
    arrays perl
    I have been studying array slices and frankly do not see the difference between choosing @array[1] and $array[1]. Is there a difference? #!/usr/bin/perl @array = (1,3); print “\nPrinting out full array..\@array\n”; print “@array\n”; print “\n”; print “Printing out \@array[1]\n”; print “@array[1]\n”; print “Printing out \$array[1]\n”; print “$array[1]\n”; print “\n\n”;

  • user3035769
    ruby arrays duplicates
    I need to count the number of duplicates in an array, find out how many times they appear and then put it into a document.. this is what I’ve done, and I am now clueless of how to proceed…. The data is from another txt file. I apologize if its a bit messy, but I am so confused right now. class Ticketattr_accessor :ticknum attr_accessor :serialnumdef initialize(ticknum,serialnum)@ticknum = ticknum@serialnum = serialnumend endclass Ticketbookdef initialize@ticketbook = Array.newenddef newticket(

  • Wilduck
    python arrays indices
    I am trying to write a mathematical program in a program called pyomo (a python library). Below, model is an object I declared already, BRANCH is a set; model.branch_scpt, model.M, model.branch_tbus, and model.branch_fbus are all parameter lists that are loaded as input when the code executes (They all have dimension = BRANCH). Additionally, model.bus_angle, model.line_flow, and model.z_line are lists of decision variables (all also of dimension BRANCH). This is the definition of one of my const

  • ??????? ???????????
    python arrays
    This question already has an answer here:Having trouble making a list of lists of a designated size [duplicate]1 answerIn relation to the question: How to initialize a two-dimensional array in Python?While working with a two dimentional array, I found that initializing it in a certain way would produce unexpected results. I would like to understand the difference between initializing an 8×8 grid in these two ways:>>> a = [[1]*8]*8 >>> a [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1,

  • kgrote
    php arrays variable-variables
    Is it possible to use a variable variable as an array prefix? I have a set of arrays with the format $x_settings, and I want to output the values of just one depending on which prefix matches a condition.This is an extremely stripped-down version of much more complex code, so thanks for your indulgence:$current_env = ‘local’;$local_settings = array (‘debug’ => TRUE,’cake’ => TRUE,’death’ => FALSE );$environments = array (‘local’,’dev’,’prod’ );foreach( $environments as $env ) {if( $cur

  • Limbo Exile
    java arrays hashtable
    I am limited to using legacy collections in Java. I created a Hashtableprivate Hashtable dataStock = new Hashtable();and one of the entries of this hashtable is a Float arraydataStock.put(“someArray”, new Float[24]);When I want to retrieve this entry from the hashtable like this:Float[] anotherArray = (Float[]) dataStock.get(“someArray”);I get the following cast exception:Exception in thread “main” java.lang.ClassCastException at java.lang.Throwable.fillInStackTrace(<unknown source file>:1

  • jnhwkim
    javascript jquery arrays customization
    i wrote jquery custom fn extension script to remove the given element in an array, but it works unexpected way so i want to figure out how to make it do reference manipulation without using return reference way.$.fn.removeElement=function(e){var l=this.length;while(l–){if(this[l]==e){console.log(this);this.splice(l,1);console.log(this);break; } } } var x=[‘a’,’b’,’c’,’d’,’e’]; console.log(x); $(x).removeElement(‘c’); console.log(x);result is like the below,> [“a”, “b”, “c”, “d”, “e”] >

  • wim
    python arrays list numpy slice
    While I find the negative number wraparound (i.e. A[-2] indexing the second-to-last element) extremely useful in many cases, when it happens inside a slice it is usually more of an annoyance than a helpful feature, and I often wish for a way to disable that particular behaviour.Here is a canned 2D example below, but I have had the same peeve a few times with other data structures and in other numbers of dimensions. import numpy as np A = np.random.randint(0, 2, (5, 10))def foo(i, j, r=2):”’sum

  • makerofthings7
    c# arrays biginteger bit-shift twos-complement
    Suppose I have an array that ends with the most signifiant bit of the most significant byte equaling 1. My understanding is that if this is the case, BigInteger will treat this as a negative number, by design.BigInteger numberToShorten = new BigInteger(toEncode);if (numberToShorten.Sign == -1){// problem with twos compliment or the last bit of the last byte is equal to 1throw new Exception(“Unexpected negative number”);}To solve this problem, I think I need to add a dummy zero bit to the array,

  • Ilya Rubnich
    php arrays sorting
    Possible Duplicate:Sorting an array based on its value I want to sort an array by a value inside of it. I tried usort but it leads to some unexpected results in actually changing the value of the output instead of just shifting elements in the array.Below is the array I want to sort:Array ( [element1] => Array([Total] => 1[paTotal] => 0[totalPreregistrations] => 7[totalPreregistrationsToDate] => 26[pas] => Array([0] => Array([id] => 119)))[element2] => Array([Total] =

  • apaul34208
    php class codeigniter
    Basically I have a helper file with several function. I auto load the helper in the config file so theoretically reloading it is not required.However when I try to use the function that I created(from this helper) within a new library that I am working on it will through this error:”Parse error: syntax error, unexpected ‘(‘, expecting ‘,’ or ‘;’ in /home/techwork/public_html/giverhub/application/libraries/Udetails.php on line 7″Whenever I use that function anywhere else(module,controller,views)

  • Rocket Hazmat
    php codeigniter namespaces propel
    I’m using Propel together with CodeIgniter. I made a MY_Model class (which extends CI_Model) that uses its constructor to load Propel.In case you’re curious:class MY_Model extends CI_Model{public function __construct(){parent::__construct();require_once ‘/propel/runtime/lib/Propel.php’;Propel::init(‘/build/conf/project-conf.php’);set_include_path(‘/build/classes’.PATH_SEPARATOR.get_include_path());} }So, now when I make a new CodeIgniter model, it will load up Propel for me. Thing is, I added

  • emkay
    php codeigniter zend-framework amazon internal-server-error
    I am having a really frustrating problem with my Zend Service Amazon package integrated into my codeigniter framework. The library works perfectly fine in my localhost but when I try it from the live site it doesn’t work, it gives me an internal server error. Why could this be?The error in the PHP log is:[22-Nov-2012 21:29:02] PHP Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in /home5/tradejun/public_html/application/controllers/dev.php on line 30[22-Nov-2012 21:29:02] PHP Pa

  • Matt
    apache codeigniter logging error-handling codeigniter-2
    I’m attempting to build an error handling service for my CodeIgniter apps, and everything is logged as expected except parse errors. For example,Parse error: syntax error, unexpected T_VARIABLE in /var/www/foo/web/app/controllers/foo.php… will output and get logged by Apache under E_ALL. All other (non-parse) errors get passed to the log_exception extension I’ve written in /core/MY_Exceptions.php, and show up in CI’s logs with PHP 5.2.17 and 5.3.6 (MAMP). Parse errors will display in Apache’s

  • Jamie Fearon
    codeigniter
    Im trying to get up an asset helper in Codeigniter. I have created the following file in application/helpers:asset_helper.php<?phpfunction asset_url(){return base_url().’assets/’; }?>I then inport this helper into my controller like so:$this->load->helper(‘asset’);When I want to use an asses in my ‘html’ I do the following:<link href=”<?=asset_url()?>/css/bootstrap.css” rel=”stylesheet” media=”screen”>My directory structure is:application system assets — js — imgs — cs

  • user1488895
    php codeigniter codeigniter-2 tankauth
    I use Codeigniter framework + Tank_Auth registiration library. They work great but I just need to change register form a bit.I want to generate username from email address instead of getting it from registeration form. I added a simple function to libraries/Tank_auth.php file. Here is my username generator function:function _create_username_from_email($email) { $user = strstr($email, ‘@’, true); // As of PHP 5.3.0 return $user; }Please let me know where I need to run my function and write it to

  • Jamie Fearon
    php codeigniter
    I’m trying to echo base_url() like so:editor_header.php<link href=”<?php echo base_url(); ?>/css/bootstrap.css” rel=”stylesheet” media=”screen”>The controller for editor_header.php looks like so:<?php class Pages extends CI_Controller {public function view($page = ‘home’){if ( ! file_exists(‘application/views/pages/’.$page.’.php’)){// Whoops, we don’t have a page for that!show_404();}$data[‘title’] = ucfirst($page); // Capitalize the first letter$this->load->view(‘head&f

  • Permana
    codeigniter odbc openedge
    I am using Codeigniter Database Active Record (ODBC Driver). The application run well. But starting this day, there are error when trying to fetch data from Progress database (connected via odbc). The error message:Severity: Warning –> odbc_exec() [function.odbc-exec]: SQL error:[DataDirect][ODBC Progress OpenEdge Wire Protocol driver]UnexpectedNetwork Error. ErrNum = 10054, SQL state 08S01 in SQLExecDirectD:\xampp\htdocs\wavinet2-permana\system\database\drivers\odbc\odbc_driver.php153Error i

  • Ashish
    php codeigniter syntax godaddy
    Can someone tell me why this code would work on my local server but not with godaddy? I get the following error on godaddy…Parse error: syntax error, unexpected ‘[‘ in /home/content/20/10592020/html/foodport/application/controllers/register.php on line 41Here is the get_userId function from my user_model.public function get_userId(){$results = $this->obtain_user_info(‘users’, array(‘username’=>$this->username), true);if(count($results) > 0){return $results;}else{return array(“user_

  • hakre
    codeigniter xampp php
    I am trying to use Google-API-PHP-Client and its base class is throwing following error:Severity: WarningMessage: array_merge() [function.array-merge]: Argument #1 is not an arrayFilename: libraries/Google_Client.phpLine Number: 107Code around like 107 is something like:public function __construct($config = array()) {global $apiConfig;$apiConfig = array_merge($apiConfig, $config);self::$cache = new $apiConfig[‘cacheClass’]();self::$auth = new $apiConfig[‘authClass’]();self::$io = new $apiConfig[

  • pvorb
    javascript node.js foreach v8
    I wanted to use for each … in with Node.js (v0.4.11).I use it like this:var conf = {index: {path: {first: “index.html”,pattern: “index/{num}.html”},template: “index.tpl”,limit: 8},feed: {path: “feed.xml”,template: “atom.tpl”,limit: 8} }for each (var index in conf) {console.log(index.path); }I get the following error:for each (var index in conf) {^^^^node.js:134throw e; // process.nextTick error, or ‘error’ event on first tick^ SyntaxError: Unexpected identifierat Module._compile (module.js:397

  • Benjamin
    php function foreach return syntax-error
    I have a simple function:function name() {extract( myfunction_atts( array(‘one’ => ”, ‘two’ => ”, ), $atts ) ); /* CODE */return $output; /* return dataName(); in second case */ }Now, I want the return to output this code:$output .= include_once(ADDRESS_CONST.”/script.php”);$output .= $data = data($one); $output .= foreach($data->do($two) as $e) {;$output .= $e->info;$output .= } ; Gives syntax error, unexpected T_FOREACH.So I need a function, the point is:function dataName()

  • hakre
    php foreach simplexml
    I’ve been pulling my hair out over this, I really hope I can get some help. Thanks in advance!I have a SimpleXML object, which goes something like this:Object ( | SomeStuff Object | ( | ) | Entries Object | ( | | Entry Object | | ( | | | SomeMoreStuff Object | | | ( | | | ) | | | ImportantStuff Object | | | ( | | | | W1 Object | | | | ( | | | | | D1 Object | | | | | ( |

  • iwj145
    cakephp foreach cakephp-2.2
    I’m new to cakephp and I’m trying to write a for each loop that will get each event that is less than or equal to (<=) today’s date.First of all I’m not really sure if a for each loop is the best way to go about this, I have also been considering a while loop or an if statement but I don’t know how else to get each entry from the database.So here’s where I’ve got to so far.DATABASE HEADINGS<?php foreach ($events[‘Event’][‘startDate’] <= $date): ?>DATABASE RESULTS Unfortunately I rece

  • user1026438
    foreach make call eval gnu
    So I am having trouble trying to condense a bunch of repeated lines in a makefile of the form:dir := XXX include dir/Makefile VAR_1 += $(VAR2) # where VAR2 and VAR4 are defined in the included makefile VAR_3 += $(VAR4) To a form like:dir:= XXX1 XXX2 XXX3 … $(foreach elements,$(dir),$(eval $(call function,$(elements))))define function $(eval include $(1)/Makefile) $(eval VAR_1+=$$(VAR2)) $(eval VAR_3+=$$(VAR4)) endefHowever I am getting errors in that it seems that the mak

  • Scott Bilas
    c# lambda foreach
    I just came across the most unexpected behavior. I’m sure there is a good reason it works this way. Can someone help explain this?Consider this code:var nums = new int[] { 1, 2, 3, 4 }; var actions = new List<Func<int>>();foreach (var num in nums) {actions.Add(() => num); }foreach (var num in nums) {var x = num;actions.Add(() => x); }foreach (var action in actions) {Debug.Write(action() + ” “); }The output is a bit surprising for me:4 4 4 4 1 2 3 4 Obviously there’s something g

  • Neeraj T
    python django foreach knockout.js
    In views:posts = Posts.objects.filter(…)template = loader.get_template(‘…’)context = Context({‘comments’: comments,})return HttpResponseForbidden(template.render(RequestContext(request, context)))In template:<script type=”text/javascript”>head.js(‘…’);head.ready(function() {$(document).ready(function() {postModel = new postModel({posts: ‘{{ posts }}’});ko.applyBindings(commentModel, $(‘#posts’)[0]); });});</script> <ul data-bind=”foreach: comments”> …. </ul>In pos

  • dfsq
    javascript arrays multidimensional-array foreach
    As I am fairly new to javascript, I can’t create and fill my array ‘data’ the way I’d like to :var data = new Array(); var i = 0;results.forEach(function(lake) {var data[i] = [{name: lake.name,fishs: lake.fisheryType,dist: lake.distance,lat: lake.latitude,long: lake.longitude}, ];i++; });Here is the console.log of result:[Object, Object] 0: Object 1: Object length: 2 __proto__: Array[0]When executing this code, I get unexpected ] at line var data [i] = …Thanks for your help.

  • Fred -ii-
    php if-statement foreach
    I have this pseudo-code that I’ve been trying to create the correct PHP syntax for and I am getting absolutely nowhere. I continue to get a Parse error on the function group_job_items.Parse error: syntax error, unexpected ‘{‘ on line 17What’s wrong here? Any help would be greatly appreciated.function group_job_items () {$jobs_by_category = array();foreach ($category_name as $category_id => $name){foreach ($job_item as $item){// skip job items that do not match the current categoryif ($item[“c

  • user896692
    php json foreach
    I´ve got the following errormessage: Parse error: syntax error, unexpected T_DOUBLE_ARROW, expecting T_PAAMAYIM_NEKUDOTAYIM in /var/www/createRecipeIng.php on line 60Don´t know how to handle that, never had before. Here´s the code: $ings = array(); $ings = json_decode($incr_arr, true); print_r($ings); $reid = 5;foreach ($ings[‘Data’][‘Recipes’][‘Recipe_’ . $reid] as key => $shIng){echo $shIng[‘NAME’]; }Line 60 is the line with the foreach loop. I know that the error must be there because the

Web site is in building