70 Topics

Member Avatar for
Member Avatar for vivosmith

Hello, I was working on some code, when I ran into this: foreach ($products as $product). One problem, it was not defined. How could this be? Here is the book I got it from: http://english-common.googlecode.com/svn-history/r100/trunk/huyliem/01-Murach.PHP.MySQL/Murach.PHP.and.MySQL.Nov.2010.pdf . It is on 161-163. I don't understand where the $product came from. And one …

Member Avatar for vivosmith
0
253
Member Avatar for mmcdonald

Hey all. All I need is to collect every `id` from `servers` where `active ='1'` and then cycle the results in a loop right until the end for each individual id. (I've written this on daniweb, might be typo's or errors. I'm not interested in code errors it's the process …

Member Avatar for cereal
0
206
Member Avatar for HelloJarvis

Hi guys, I'm working on a little script that generates all combinations of a given input string. My problem is, it's generating the combinations perfectly fine (I checked with an echo), but not inserting them in to an array. Here is my code: function check($width, $position, $base_string, $charSet) { $combinations …

Member Avatar for Bachu
0
162
Member Avatar for squeak24

I am working on a open source script at the moment, but I am struggling on one final aspect of the script. I am a bit of a newb to PHP at this level, I have a working knowledge of PHP and MySQL, but this seems to be a little …

Member Avatar for squeak24
0
222
Member Avatar for viktor.jiracek.5

Hello all, I am working on an upload script. This one is taken straight from php.net. I tried to get it to work but can't seem to. Could you help out? This is the code: <?php $uploads_dir = 'file:///PETBookPro09/Users/petuser1/Desktop/'; foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) …

Member Avatar for viktor.jiracek.5
0
187
Member Avatar for DaveyMoyes

Hi Everyone, I have a foreach array that prints out images one per line. How can I print images out so I have 3 per line ? here is the code I am working with. if (count($friendDataRawArray) > 0) { foreach ( $friendDataRawArray as $id => $friend) { //$name = …

Member Avatar for brandonrunyon
0
173
Member Avatar for turpentyne

I can't seem to figure out what I'm missing. After the end user selects one or more classes, they go to a page that runs a foreach statement to determine which discount to use on each class. But it doesn't seem to be adding the resulting total to the array, …

Member Avatar for jmichae3
0
174
Member Avatar for drumichael87

Hi all, I am having trouble figuring out a good way to go about looping my database results. Currently, my code looks something like the following (abbreviated for simplicity): $db_results = $wpdb->get_results("SELECT * FROM table"); echo '<table><thead><th>Name</th><th>Number</th></thead>'; echo '<tbody>'; foreach ($db_results as $result) { echo '<tr>'; echo '<td>' .$result->name. '</td>'; …

Member Avatar for drumichael87
0
102
Member Avatar for DEAD TERMINATOR

I'm trying to write a method that displays the contents of a hashmap on screen. This hashmap contains Strings and an array of int for every String. I've put the String aspects of the hashmap into an arraylist and I'm trying to use another method to print the arrays for …

Member Avatar for JamesCherrill
0
300
Member Avatar for sagarrayudu

This is my xml file [CODE]<CATALOG> <category> <name>Engineering</name> <subject>Civil Works</subject> <subject>Water Supply</subject> <subject>Street Lighting</subject> </category> <category> <name>Public Health</name> <subject>Sanitation</subject> <subject>Dispensaries</subject> <subject>Maternity Services</subject> </category> <category> <name>Town Planing</name> <subject>T.P.S</subject> <subject>T.P.B.O</subject> <subject>Tracer</subject> <subject>Chairmen</subject> </category> <category> <name>Administration</name> <subject>Ministerial Manager</subject> <subject>Revenue R.O.</subject> <subject>Accounts Accountant</subject> </category> </CATALOG>[/CODE] I have to get the all subject names in …

Member Avatar for veedeoo
0
197
Member Avatar for codechrysalis

Basically I have to do this: [B]Write a program that displays the number of students that can still enroll in a given class. Design your solution using parallel arrays.[/B] my problem is what loops should I use for this I dont think [B]for[/B] loops would be useful at all...I think …

Member Avatar for codechrysalis
0
189
Member Avatar for shaynadz

Hi! I'm new here! I have a quick question about an error I found in my script. I'll jump straight into the code and then make my question: [CODE]$description = $_POST['desc'];[/CODE] this is a text description for example "Monthly Tuition". [CODE]$amount = $_POST['amount'];[/CODE] price of tuition [CODE]$dlnumber = $_POST['cedula'];[/CODE] drivers …

Member Avatar for diafol
0
180
Member Avatar for klemme

Hi, I want to get information from each session set, EXCEPT when the session name is 'navigation': So basically: Create an exception for the session called 'navigation'.. [CODE] foreach ($_SESSION as $name => $value) // $name = navn pÃ¥ session: f.eks. 1 eller 2 - $value indeholder antallet der er …

Member Avatar for pritaeas
0
917
Member Avatar for andy106

Hi I am trying to get the active state for my foreach loop for my magento site. I have have tried everything, but it just wont work.. here is my code: ksort($catArr); foreach($catArr as $postion=>$catId){ $_category = Mage::getModel("catalog/category")->load($catId); ?> <?php if($_category->getIsActive() ) { $caturl = $_category->getURL(); $catname = $_category->getName(); ?> …

0
134
Member Avatar for ogsirus

Hey guys. Im try to write a program with 3 major things which are two lists and a random. what i want to do is say whatever values are in those lists then produce so many random value if you get what i mean. so say list one value is …

Member Avatar for thines01
0
179
Member Avatar for andy106

Hi i have a foreach loop, but it is just showing everything in one long line, so I wanted to put it in a table like this <table> <tr> <td>data1</td> <td>data2</td> <td>data3</td> </tr> <tr> <td>data4</td> <td>data5</td> <td>data5</td> </tr> </table> here is my loop: [CODE]<?php foreach( $products as $product ) { …

Member Avatar for pritaeas
0
1K
Member Avatar for reco21

hello. i've created this with help from a friend. |uid || id ||url| i have input fields to add the data. [CODE]<table width="100%"> <tr> <td width="140" style="padding:4px;">url 1:</td> <td ><input type="text" class="edit bk" name="urls[]" style="width:350px"></td> </tr> <tr> <td width="140" style="padding:4px;">link 2:</td> <td ><input type="text" class="edit bk" name="urls[]" style="width:350px"></td> </tr> <tr> …

Member Avatar for cwarn23
0
257
Member Avatar for cjohnweb

I am having trouble with a PHP foreach loop....I know how they work, I think I'm getting unexpected results. A bug perhaps? Am I missing something? [code] if(is_array($array)){ foreach ($array as $k => $v){ echo "<b>#$k</b><br />"; foreach ($v as $kk => $vv){ foreach ($vv as $kkk => $vvv){ if($kkk …

Member Avatar for pritaeas
0
232
Member Avatar for nonshatter

I have a foreach loop, within which I would like to create x number of unique variables. E.g. Upon each iteration I'd like to create a new variable like: $strDisk1 = ... $strDisk2 = ... $strDisk3 = ... I have tried the following but this does not work: [CODE] <?php …

Member Avatar for cjohnweb
0
7K
Member Avatar for jatpatel1

Hi there, Please can someone help me! I have recently been learning oop PHP. I have created a class for my database, which basically makes my life easier when doing queries. I have created a "where" method which basically when used will append to the select statement. For example: //class …

Member Avatar for diafol
0
198
Member Avatar for GreaseJunkie

I hate to post a thread on this since I know this topic has been discussed ad nauseum, but I've been searching for weeks and cannot find exactly the answer I've been looking for. I'm new to arrays and loops - I get the concept, but not the syntax. Here's …

Member Avatar for hielo
0
371
Member Avatar for kandyhyatt

I'm new to java and seriously needing some help..I'm having problems deciding accessor and mutator methods.. and how to create an ArrayList. Write a program that uses an ArrayList of parameter type Contact to store a database of contacts. The Contact class should store the contact's first and last name, …

Member Avatar for kandyhyatt
0
228
Member Avatar for crankyslap

Hey guys, I'm seriously breaking my head over this one. This project should have been finished 10 hours ago but I've been stuck on this for ages. First I set the DataSources / Dataviews of all the things I need; [CODE] Dim dsPubs As New DataSet() dsPubs.ReadXml(pathdone) DataGridView2.DataSource = dsPubs.Tables(0) …

0
107
Member Avatar for theweirdone

Hi, I'm pretty new to CakePHP, and have been managing so far. I've created a scraper that scrapes TV.com for episode information (episode number, airdate, title, description). The scraper works fine, and returns an array such as: [CODE]Array ( [0] => Array ( [name] => Stowaway [number] => 17 [description] …

Member Avatar for jkon
0
323
Member Avatar for AdriftUniform

Hi, I have created a system where users can follow another user, I am currently querying the table to display who is following who. I have two queries as shown below: [code=php] // followers query $query = "SELECT * FROM friends WHERE friFriend='$view'"; $result = queryMysql($query); $num = mysql_num_rows($result); // …

0
109
Member Avatar for Kadafiz

[CODE] class test{ function load($mailID,$message){ echo $mailID; echo $mesage; } function test1($arr,$message){ foreach($arr as $mailID){ $mailID = $mailID.","; $this ->load($mailID,$message); } } }[/CODE] this is my code ... bt this is nt correct.. actually i need is function test1 get mailadresses and message for the mail.. arr is a array. …

Member Avatar for Kadafiz
0
158
Member Avatar for kiran.madke

hi everyone i want a solution for this. i tried to check a all data from datbase table using dataset with a foreach loop. but this logic check only first row not below that so any one help me to solve this problem so i can check all rows from …

Member Avatar for CrappyCoder
0
764
Member Avatar for erum

i have bit tricky kind or problem. i need to get values of each textbox in loop with different names,i have three row (name,telephone,email)and off course three textbox ,can any one help how to get in loop ,i need to insert them in database [CODE] Dim arr() As String Dim …

Member Avatar for shine_jose
0
207
Member Avatar for theG-Scott

Thanks for taking the time to read this. Let me start by saying I'm a php newb so be gentle! I have a form that is used to insert data into my database to display info and images in a portfolio section on my site. In the form, the input …

Member Avatar for theG-Scott
0
262
Member Avatar for MaryAnne19

Hi all! I have a program that runs as a large form (Form1) with smaller forms that open inside of it (PeopleBox). It's for friends/contacts - each person gets their own row in the database (PeopleDB). At runtime I'd like it to open a PeopleBox for each person already existing …

Member Avatar for N4JRY
0
244

The End.