Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. I think this has something to do with it: if(isset($_POST["submit"])){ }
  2. foreach ($arr_tower as $key=>$tower) gives: foreach ('$uni' as $key => $tower) which gives you: Warning: Invalid argument supplied for foreach() in C:\wamp\www\ProdBoard\pb_job_update.php on line 245 use the next technique instead (http://us3.php.net/manual/en/language.variables.variable.php): if ($FOLDER == "101") $arr_name = 'kba'; if ($FOLDER == "201") $arr_name = 'kba'; if ($FOLDER == "301") $arr_name = 'uni'; if ($FOLDER == "401") $arr_name = 'uni'; $kba = array(0=>"U1/2", 2=>"T2A", 3=>"U3", 4=>"U5/6", 5=>"T7"); $uni = array(0=>"T1", 1=>"T2", 2=>"T3", 3=>"T4", 4=>"T5", 5=>"T6", 6=>"T7", 7=>"T8", 8=>"T9", 9=>"T10"); $arr_tower = ${$arr_name}; foreach ($arr_tower as $key => $tower) { ..
  3. <input type="hidden" name="checkboxName" value="0"> <input type="checkbox" name="checkboxName" value="1"> Now if the checkbox is checked it returns the value 1 otherwise it will return 0 because of the hidden field with the same name and a value
  4. Could someone help me with this? Sure. Could someone provide a detailed, beginner tutorial on how to do this (But in different parts. Ex. The accounts one part, the adding/removing pets another, etc.) http://blog.code-purity.com/archives/2009/7/3/planning_your_php_project_the/ Could this be added to this site? http://www.000webhost.com/ It should be. Bottom-line you are planning out a project which isn't an easy task + you are working for THE most difficult client: Yourself! Well, good luck you can always contact me if you need some help planning it out and you have got us if you have some php questions.
  5. $loops = 2; for ($i = 0; $i < $loops; ++$i) { $sizeOf = sizeof($array); for ($j = 0; $j < $sizeOf; ++$j) { // ..logic.. } } increase $loops if you need to loop over more or use some algorithm to decide how many times it needs to loop over the array
  6. $add_master = 'insert into master_name values (NULL, now(), now(), ' . $_POST['f_name'] . ', ' . $_POST['l_name'] . ')'; you can't use a ' between ' (the same applies for ") it breaks your code. This error occurs when php tries to parse everything in "
  7. if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST)) { ..variables.. $query = 'INSERT INTO tabel (column(n), column(n+1), ..) VALUES ($_POST[n], $_POST[n+1], ..)'; mysql_query($query); }
  8. Your query is wrong you'll get: SELECT * FROM objects WHERE zupanija = "obiteljske"{$val} ORDER BY id DESC{$val} ORDER BY id DESC{$val} ORDER BY id DESC{$val} ORDER BY id DESC while this should be: SELECT * FROM objects WHERE zupanija = "obiteljske" AND column(n)={$val(n)} AND column(n+1)={$val(n+1)} .. ORDER BY id DESC
  9. This 5 lines of code do the same thing your 15 lines of code do <select name="gender"> <option>-</option> <option value="1"<?php $gender === 1 ? ' selected="selected"' : '' ?>>Male</option> <option value="2"<?php $gender === 2 ? ' selected="selected"' : '' ?>>Female</option> </select>
  10. If you only have a category and a subcategory and nothing deeper then use: [categories](1)---(*)[subcategories] This has the advantage that no products can be coupled to a parent category
  11. What is the format you are gettin' them in? And what is your local time?
  12. do your subcategories have sub-subcategories? if not then you need to alter your db design to: [categories](1)---(*)[subcategories] if these subcategories can have subcategories then you need to add a column (parent_id) to your categories table to allow recursion +---------------+ | categories | +---------------+ | id INT | | parent_id INT | +---------------+ Now if you add a subcategory you set the id of the parent category in the parent_id INSERT INTO categories (id, parent_id) VALUES (1, 0); // parent category INSERT INTO categories (id, parent_id) VALUES (2, 1); // child category INSERT INTO categories (id, parent_id) VALUES (3, 2); // child-child category INSERT INTO categories (id, parent_id) VALUES (4, 3); // child-child-child category ..
  13. Dutch: Waarom zijn alle belgen toch zo lui? $months = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'November', 'December'); $years = array(); $currentYear = (int) date('Y'); for ($i = $currentYear; $i > $currentYear - 100; --$i) { // sorry 100+ shouldn't surf the web $years[] = $i; }
  14. You are referring to Ajax if you are using extjs.com script.js var jsonStore = new Ext.data.JsonStore({ autoLoad: true, autoSave: false, url: "ajax.db-info.php" }); // do something with jsonStore ajax.db-info.php $query = 'SELECT * FROM tabel'; $result = mysql_query($query); $rows = array(); if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { $rows[] = $row; } } print json_encode($rows);
  15. Read this: http://us2.php.net/manual/en/features.file-upload.post-method.php "i hate ajax": Do you even know what ajax is? And no, Ajax wouldn't be able to help you in determing the filesize as it would just like your form upload it to the server and then the server would evaluate it and return that size in JSON or some other format.
  16. <?php class UserManager { protected $_simpleXml; public function __construct($dataSource { $this->_simpleXml = simplexml_load_file($dataSource); if (!isset($this->_simpleXml->user)) { throw new Exception('Incorrect data source given.'); } } public function addUser($details) { $this->_simpleXml->addChild('key', $details['key']); $this->_simpleXml->addChild('string', $details['string']); } public function deleteUser($username) { for ($i = 0; $i < $this->_simpleXml->user; $i++) { if ($this->_simpleXml->user[$i]->key === $username) { unset($this->_simpleXml->user[$i]); break; } } } public function __toString() { return $this->_simpleXml->asXml(); } } $userManager = new UserManager('/path/to/file.xml'); $userManager->deleteUser('User1'); print $userManager; ?>
  17. <table> <tr> <th>Column Heading 1</th> <th>Column Heading 2</th> <th>Column Heading 3</th> <th>Column Heading 4</th> </tr> <?php if (mysql_num_rows($searchResult)) { while ($row = mysql_fetch_assoc($searchResult)) { print '<tr>'; print "\t<td>" . $row['column1'] . '</td>'; print "\t<td>" . $row['column2'] . '</td>'; print "\t<td>" . $row['column3'] . '</td>'; print "\t<td>" . $row['column4'] . '</td>'; print '</tr>'; } } else { print '<tr><td colspan="4">Search returned no results</td></tr>'; } ?> </table>
  18. are you sure allow_url_fopen is on?
  19. all sdk_*() functions are located under a directory you specify and is present in the include_path this works even in safe_mode or open_basedir
  20. Your index.php has some severe errors, here is the corrected version: <?php $sitestyle = isset($_COOKIE['sitestyle']) ? $_COOKIE['sitestyle'] : 'orange'; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Switcher test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" media="screen" href="<?php print $sitestyle ?>.css"> </head> <body> <a href="switcher.php?set=red">red</a><br> <a href="switcher.php?set=green">green</a><br> <a href="switcher.php?set=blue">blue</a><br> <a href="switcher.php?set=orange">orange</a><br> </body> </html>
  21. <?php print $_SERVER['HTTP_ACCEPT_LANGUAGE']; ?> or consider my content negotiation class: http://pastebin.com/fee1ffde For more information google: http accept headers (http://en.wikipedia.org/wiki/List_of_HTTP_headers)
  22. You have actually 2 options: 1) disable the function you do not want the user to use and create a counterpart which provides this functionality under controlled circumstances, for example: sdk_fopen(..) which would add additional control structures to verify the user is opening a file they are authorized to open 2) enable all functions and set open_basedir (http://be.php.net/manual/en/ini.sect.safe-mode.php#ini.open-basedir) or set safe_mode (http://be.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode) to on if you only want to disable including remote files consider disabling allow_url_fopen
  23. somebody told me to put in the formula "session_start();" session_start() is not a formula it's a function. "but here my knowledge ends." strange way of putting it.. Anyway upload your code so that we can investigate and provide a solution
×
×
  • 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.