Jump to content

jcbones

Staff Alumni
  • Posts

    2,653
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by jcbones

  1. Will the code make the test directory in `xxxxxxx`? Which is the directory above `project_data`?
  2. Try this: <?php if (is_array($order->products)) { $context = array( 'revision' => 'formatted', 'type' => 'order_product', 'subject' => array( 'order' => $order, ), ); foreach ($order->products as $product) { $price_info = array( 'price' => $product->price, 'qty' => $product->qty, ); $context['subject']['order_product'] = $product; $context['subject']['node'] = node_load($product->nid); ?> <?php echo '<table border="0" cellspacing="5" cellpadding="5">'; $i = 0; foreach(explode('<br />',$product->model) as $value) { echo ($i == 0) ? '<tr>' : NULL; echo '<td>' . str_replace('<br />','',$value) . '</td>'; if(++$i == 4) { echo '</tr>'; $i = 0; } } echo ($i != 0 && $i < 4) ? '</tr></table>' : '</table>'; ?><br /> <?php } }?> This is assuming that $product->model produces sku's separated by line breaks. If it produces an un-ordered list, it will have to be done differently. Your source code will be the place to look to find that info out.
  3. Make sure `project_data` exists, and is spelled correctly.
  4. foreach($arr as $k => $v) { $output[] = $v['value']; } echo implode(', ',$output); There may be a native function to handle this, but none came to mind, and I didn't bother searching.
  5. I don't follow the logic, 2 loops through the same data? Then updating a static row? By your logic, you would update product_id 1242 if 00006 was found in any of the arrays.
  6. if you have to trim the results, you can use array_map(). $student = array_map('trim',fgetcsv($fh));
  7. For adding the `th to the end of the numbers, you will have 1st, 2nd, 3rd, everything else is th. So a simple switch would fix this. switch(substr($pos,-1)) { case 1: $position = $pos . 'st'; break; case 2: $position = $pos . 'nd'; break; case 3: $position = $pos . 'rd'; break; default: $position = $pos . 'th'; } As for the ordering the queries. I could help you more if I knew what all the letters were. With a shared site, and a mid/large database(30,000/60,000+ rows), these calculations would possibly end in your site being suspended for memory hogging.
  8. Try: SUM(HW) + SUM(PW) AS W Which will add each column, then add them together.
  9. Headers will not re-direct in Chrome, unless you send a Status: 200 with it.
  10. Try this query. SELECT a.incidentNumber, b.job FROM incidents AS a JOIN jobs AS b ON a.code1 = b.code2 This query selects incident numbers from incidents table, only if incidents code1 is equal to jobs code2. It will also return the job (name?).
  11. <?php $con = mysqli_connect('localhost', 'root', 'root', 'games')or die(mysqli_error($con)); if(isset($_GET['cat'])){ $query_var = $_GET['type']; // force it to be an integer $query=" SELECT * FROM games WHERE category = '$query_var' ORDER BY title"; $result = mysqli_query($con, $query)or die(mysqli_error($con)); } } ?> <html> <head> <title> Test </title> </head> <body> <?php if(mysql_num_rows($result) >0) { while($r = mysql_fetch_assoc($result)) { echo '<a href="http://url.com/play.php?cat=true&type=' . $query_var . '&id=' . $r['id'] . '" title="' . $r['description'] . '">' . $r['title'] . '</a><br />'; } } else { echo 'No games exist in this category!'; } ?> </body> </html> Try this, it may need some tweaking.
  12. What is the problem?
  13. Change your while statement to: while($arr = mysql_fetch_array($result, MYSQL_NUM)) { $table .= "\t\t<tr>\n"; $table .= "\t\t\t".'<td>'.$arr[0].'</td>'."\n \t\t\t".'<td>'.$arr[1].'</td> </tr> <tr>'. "\n\t\t\t".'<td colspan="2">'.$arr[2].'</td>'."\n"; $table .= "\t\t</tr>\n"; }
  14. public function loadLang ($file){ if( file_exists( $_SERVER['DOCUMENT_ROOT'].'/lang/'.$this->chosen_lang.'/'.$file.'.php' ) ) { //if the file exists include( $_SERVER['DOCUMENT_ROOT'].'/lang/'.$this->chosen_lang.'/'.$file.'.php' ); //include the file. $this->lang[$file] = array(); //create a new entry into the existing class array $lang. foreach ($lang as $k => $v) { //$lang is NOT set inside this function, it must come from the included file, and it MUST be an array. $this->lang[$file][$k] = $v; //Appends the $lang array, to the class $lang array. } } unset($lang, $file, $k, $v); //destroy the $lang array, and the current $k and $v. } Like I asked, do you have the $lang array created in the included file?
  15. Did you set the variable $lang in your included file?
  16. I would try something along the lines of: <?php if(isset($_POST['submit'])) { include('config.php'); $sql="SELECT t3.id as mID, t3.emp_name as manager, t2.id as tID, t2.emp_name as teamleader, t1.id, t1.emp_name FROM employees as t1 LEFT JOIN employees as t2 ON (t2.id = t1.report_to) LEFT JOIN employees as t3 ON (t3.id = t2.report_to) WHERE t2.id='" . mysql_real_escape_string($_POST['text']) . "'"; $data=mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($data) == 0) { $sql = str_replace('WHERE t2.id','WHERE t1.id',$sql); $data = mysql_query($sql) or die(mysql_error()); } if(mysql_num_rows($data) > 0) { echo "<table border='2'>"; $headers = false; while ($rec=mysql_fetch_assoc($data)) { foreach($rec as $k => $v) { if(empty($v)) { unset($rec[$k]); } } if(!$headers) { echo '<tr><th>'; echo (isset($rec['mID']) || isset($rec['tID'])) ? 'MID</th><th>Manager</th><th>' : NULL; echo (isset($rec['tID']) && isset($rec['mID'])) ? 'TLID</th><th>TeamLeader</th><th>' : NULL; echo 'EmpID</th><th>Employee</th></tr>'; $headers = true; } echo '<tr><td>'; echo (isset($rec['mID'])) ? $rec['mID'] . '</td><td>' . $rec['manager'] . '</td><td>' : NULL; echo (isset($rec['tID'])) ? $rec['tID'] . '</td><td>' . $rec['teamleader'] . '</td><td>' : NULL; echo $rec['id'] . '</td><td>' . $rec['emp_name'] . '</td></tr>'; } echo '</table>'; } else { echo 'Data not found!'; } } ?> <br /> <form method="post" action=""> Username:<input type="text" name="text" /> <input type="submit" name="submit" value="Submit" /> </form>
  17. Consider using array_chunk(), and it will sort them into a multi-dimensional array for you. This will give you flights[0] - flights[9], re-indexing the keys so your values will reside in flights[0][0] - flights[0][7]. $flights = array_chunk($ten_pireps,; echo '<pre>'; print_r($flights[0]); print_r($flights[1]); print_r($flights[2]); print_r($flights[3]); print_r($flights[4]); print_r($flights[5]); print_r($flights[6]); print_r($flights[7]); print_r($flights[8]); print_r($flights[9]); echo '</pre>';
  18. You are trying to put an echo in the middle of a variable. You should make the variable, then echo it. $lside_content2 .= "<tr><td> <a class=\"bl\" href = \"quiz_int3.php?id=$row[id]&pagenum=$pagenum\" target='_self'> $row[title]</a> ". ThumbsUp::item($row['id']) ."</p></td></tr>"; }
  19. <?php //<-Make sure there is no whitespace before the opening tag, or (HEADERS ALREADY SENT ERROR); $connection = mysql_connect("localhost","####","#####"); if (!$connection){ echo mysql_errno().": ".mysql_error()."<br/>"; //<-if the connection fails. OUTPUT SENT (HEADERS ALREADY SENT ERROR). exit; } if(!mysql_select_db("prixaurora")){ echo("Database not found<br>"); //<-If the connection fails. OUTPUT sent (HEADERS ALREADY SENT ERROR); }
  20. You mean that you get a blank screen, or you get 'error'?
  21. There is nothing inside of your div that you are hiding. So it will not show either way, as you cannot see an empty div (unless it has a border).
  22. You didn't even try it did you? Nowhere in that query does it say that we know the name of the department. It says: "Return the department name to me, and a count of how many times it exist in this table".
  23. Most Mobile phone providers will let you send sms through email, which can be accomplished with PHP using the mail() function. Take a look here Other than that, you will need a SMS gateway, which usually charges per message sent. These also require you to jump a few hoops to user their service, including un-subscribe links in every message <- and it must work.
  24. The correct CSS to hide an element is "display:none;"
  25. Change the query: //from $result = mysql_query("SELECT scm_mem_id FROM sc_member WHERE (scm_lastlogin < '$maxtime') ORDER BY scm_lastlogin") ; //to $result = mysql_query("SELECT scm_mem_id, scm_points FROM sc_member WHERE (scm_lastlogin < '$maxtime') ORDER BY scm_lastlogin") ; //change: $points = ?; // need to pull existing points (field: scm_points) from the above SELECT statement and deduct 10% (rounded) //to $points = $row[1] - round($row[1] * .10); //Find 10% of scm_points, and subtract it from points. Rounded of course.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.