Jump to content

jairathnem

Members
  • Posts

    93
  • Joined

  • Last visited

Everything posted by jairathnem

  1. you could just echo the name foreach($images as $image) { Echo '<img src="'.$image.'"/> <br />'; echo $image; }
  2. use mysql_fetch_assoc() to get the data. But instead, look into PDO instead of mysql.
  3. you basically want to import all data in CSV file to the DB right? if so, $csvFile = "test.csv"; $csvSeparator = ","; $csvFileLength = filesize($csvFile); $handle = fopen($csvFile, "r"); $csvData = fread($handle, $csvFileLength); fclose($handle); var_dump($csvData); $data = explode("\n",$csvData); This will seperate the data to seperate arrays, which you can append to a variable and execute it.
  4. post your code.
  5. use textarea HTML tag. get entered query via GET or POST and process it. but if you want highlighting you may have to write your own js for that.
  6. From which page is data POST'ed to this page called? You will have to check there to see if it is calling this page with blank data.
  7. EDIT to prev. post : change query to "SELECT * FROM `course_selection` order by `difficulty`, `spaces` desc"
  8. <?php require_once 'connection.php'; $res = mysqli_query($con,"SELECT * FROM `course_selection` order by `difficulty`"); while($row=mysqli_fetch_assoc($res)){ $data[] = $row; } mysqli_close($con); echo "Before preocessing: <br />"; var_dump($data); $space = 120; $space_needed = $space; $space_filled = 0; $i= 0; $count = 0; foreach($data as $value){ $count = $value['spaces'] + $count; } echo "count $count <br />"; if($count < $space) { echo "Too may space requested, less available";die; } while($space_filled != $space) { if($data[$i]['spaces'] <= ($space_needed - $space_filled)){ $space_filled = $data[$i]['spaces'] + $space_filled; $data[$i]['spaces'] = 0; } else{ $data[$i]['spaces'] = $data[$i]['spaces'] - ($space_needed - $space_filled); $space_filled = ($space_needed - $space_filled) + $space_filled; } $i++; } echo "<br/>after processing: <br />"; var_dump($data); echo "<br /> $space_needed <br /> $space_filled"; ?> Personally I like these type of challeges as a programmer the code doesnt update the DB but the changes are done to the array, which can be used to make change to DB.
  9. have you tried permalinks? http://codex.wordpress.org/Using_Permalinks
  10. I'd suggest you learn the basics first. The above 3 lines donot add a key of 'passwd'.
  11. <html> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript"> $(function() { $('#txt1').on('click', function() { $('#txt2').show(); }); }); </script> <input type="text" id = "txt1" /> <input type="text" id="txt2" style="display:none;" /> </html> may not be the best optimized. refine it.
  12. if($check_passwd == md5($salt['passwd'])) in your code $salt is never assigned a value with key 'passwd'. It will never validate.
  13. == (double equals) is equals operator i.e it matches both and returns true or false(Boolean). =(single equal) - this is assignment i.e you assign values to something. like to a variable,array..etc. you have misplaced both in your code.
  14. what do you mean by least number of courses?
  15. Javascript will get this done. set the diplay : none for the text box on page load...when onfocus of the password field change the display property to block or something.
  16. you could echo the message directly. echo "Thank you.";
  17. if($server_data['port'] != 1234){ echo gethostbyname($server_data['ip']) . ":" . $server_data['port']; } else return null;
  18. I dont know what use that is. But if you want to acheive that add it all to a single line and use escape sequence like \n,\t. But not sure why you want to do this.
  19. I see the following errors : 1. $new_message is a variable - on line 33 it is missing the end semi-colon. 2. no need to open php tag inside another php - you can just echo the HTML stuff.
  20. I think the error is because of the backslash in line 36. try this if($_SESSION['USERNAME'] == 'TEP') {
  21. <?php $string = "123,456,123"; $split = explode(',',$string); $split = array_unique($split); $string = implode(',',$split); echo $string; ?>
×
×
  • 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.