Jump to content

dennismonsewicz

Members
  • Posts

    1,136
  • Joined

  • Last visited

Everything posted by dennismonsewicz

  1. I have a script that looks up a particular Q&A depending upon the message id being passed in the URL, but one of them is breaking. I have a privacy policy that for reason only returns 255 characters and will not display anything past that. The DB column is set for a text field so it should be grabbing everything in that row... any ideas on what could be wrong?
  2. Thanks! This makes a lot of sense! I am going to give your suggestion a try and see what happens! Thanks again for all of your help!
  3. Thanks for your help! I just tried your suggestion this morning and it was the fix I was looking for <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_URI} !-d RewriteRule ^admin(.*)$ index.php?/admin/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?/welcome/$1 [L] </IfModule> <IfModule !mod_rewrite.c> # If we don't have mod_rewrite installed, all 404's # can be sent to index.php, and everything works as normal. # Submitted by: ElliotHaughin ErrorDocument 404 /index.php </IfModule> The question I have is, can you explain a particular line for me? I am still trying to understand writing htaccess files and am having a little bit of a hard time. RewriteRule ^admin(.*)$ index.php?/admin/$1 [L] Can you explain the above to me? I understand what it does all around but anyway you can break it down for me? Thanks!
  4. I am using the Multiple File Upload Plugin for jQuery and am having a weird problem in IE6. I have a File Queue div where all of the files a user selects are appended to and they show up immediately in all other broswers, but IE6. You have to click on the page somewhere before they show up. Any way to fix this? After doing some research it seems as if its an IE6 issue, but if someone has found a work around, I would be very grateful Thanks! Dennis
  5. Does anyone know of a php script out there that will convert a multipage pdf to a multipage tif file? Thanks in advance!
  6. I am working with the CodeIgniter framework to build my site. Well recently I have been converting my admin section over to using the CI framework. I introduced an admin directory in my controllers folder and now cannot access anything inside that folder without going to myurl.com/index.php?/admin/controller_name Here is my .htaccess file <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?/welcome/$1 [L] #RewriteCond %{REQUEST_URI} !-d #RewriteRule ^admin(.*)$ index.php?/admin/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !-d RewriteRule ^(.*)$ index.php?/admin/$1 [L] </IfModule> <IfModule !mod_rewrite.c> # If we don't have mod_rewrite installed, all 404's # can be sent to index.php, and everything works as normal. # Submitted by: ElliotHaughin ErrorDocument 404 /index.php </IfModule> Thanks in advance for any help!
  7. nevermind fixed my problem... <?php function selectOption($ck_opt) { $arr = array('1' => 'YES', '0' => 'NO'); $s = ''; echo '<select name="maintenance">'; foreach($arr as $key=>$val) { if($key == $ck_opt) { $s = 'selected="selected"'; } echo '<option value="' . $key , '" ' . $s . '>' . $val . '</option>'; } echo '</select>'; } foreach($ck_results as $row) { echo selectOption($row->turned_on); } ?>
  8. I am trying to ck my database and if the result runs and finds a particular answer that matches in the select option then it is supposed to select it, but I can't figure it out.. <?php foreach($ck_results as $row) { if($row->turned_on == 1) { $s = 'SELECTED=SELECTED'; } elseif($row->turned_on == 0) { $s = 'SELECTED=SELECTED'; } else { $s = ''; } } ?> <select name="maintenance"> <option value="1" <?=$s;?>>YES</option> <option value="0" <?=$s;?>>NO</option> </select> Thanks for any and all help!
  9. I solved my problem... I used the function file_get_contents and it works perfectly!
  10. I just inserted this statement into my phpmyadmin and everything worked... I figured I would post this in the PHP Help since I am trying to load the SQL statement from a .txt file first
  11. I am trying to load a text file that contains a create table script but keep getting a weird error. function create_tbl($file) { $report = mysql_query($file)or die(mysql_error()); if(!mysql_error()) { return TRUE; } else { return FALSE; } } $create_file = readfile($xml->create->name); create_tbl($create_file) Text File contents CREATE TABLE coxdeductible ( rowid int(11) NOT NULL AUTO_INCREMENT, make varchar(400) NOT NULL, model varchar(400) NOT NULL, deductible varchar(255) NOT NULL, published int(1) NOT NULL, PRIMARY KEY (rowid) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11; I keep getting this error: CREATE TABLE coxdeductible ( rowid int(11) NOT NULL AUTO_INCREMENT, make varchar(400) NOT NULL, model varchar(400) NOT NULL, deductible varchar(255) NOT NULL, published int(1) NOT NULL, PRIMARY KEY (rowid) )You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '207' at line 1
  12. Is there anyway to overwrite a value in an XML document? <?xml version="1.0"?> <files> <create> <name>coxdeductible.create.csv</name> </create> <insert> <name>coxdeductible.insert.csv</name> </insert> <check> <installed>no</installed> </check> </files> I want to rewrite the check value to be yes in my php program
  13. I am sorry I meant to give you the array_merge function not the array_combine http://php.net/manual/en/function.array-merge.php I am working on a little something now
  14. Hmmm You could loop through the array and then combine all of them using the implode function http://php.net/manual/en/function.implode.php
  15. look into the array_combine function http://php.net/manual/en/function.array-combine.php
  16. I figured out my problem =) <?php function split_into_parts($text,$length=64) { $text = trim($text); $array = array(); if(strlen($text) > $length) { for($i=0;$text[$length+$i]!=" ";$i++) { if(!$text[$length+$i]) { return $text; } } $array['firstHalf'] = trim(substr($text,0,$length+$i)); $array['secondHalf'] = trim(substr($text,$length+$i)); } return $array; } $a = 'It blew up. It blew up. It blew up. It blew up.'; echo '<div style="width: 500px; margin: 10px; background: #eee; padding: 6px; border: 1px solid #dfdfdf">'; echo '<p><strong>SplitIntoParts()</strong></p>'; echo '<pre>'; print_r(split_into_parts($a, 45)); echo '</pre>'; echo '</div>'; ?> I basically took a function on the php.net website called snippetgreedy and modified it to meet my needs Original Code function snippetgreedy($text,$length=64,$tail="...") { $text = trim($text); if(strlen($text) > $length) { for($i=0;$text[$length+$i]!=" ";$i++) { if(!$text[$length+$i]) { return $text; } } $text = substr($text,0,$length+$i) . $tail; } return $text; }
  17. Do this in CSS using image files http://www.devwebpro.com/25-rounded-corners-techniques-with-css/
  18. One more question and I will leave you along =) I have a character limit I am passing to the function to try to break the string at the limit, but have no idea to modify your script to break the string at the limit and if the break is in the middle of a word wait to after the limit to make the break... sorry for the confusion function string_into_parts($a, $limit = 45) { $array = array(); $len = strlen($a); if ( substr($a, $len/2, 1) == ' ' ) { $array['firstHalf'] = substr($a, 0, $limit); $array['secondHalf'] = substr($a, $limit); } else { for ( $i = $len; $i > 0; $i-- ) { if ( substr($a, $i, 1) == ' ' ) { $array['firstHalf'] = substr($a, 0, $i); $array['secondHalf'] = substr($a, $i); break; } } } return $array; } $a = 'It blew up!'; $parts = string_into_parts($a); echo $parts['firstHalf'] . '<br />'; echo $parts['secondHalf']; Thanks for ALL of your help =)
  19. Thank you SOOO much for this piece of code! I just did some testing on it and it is working perfectly! This is why I love PHP and especially this forum! I just changed everything over to a function function string_into_parts($a) { $array = array(); $len = strlen($a); if ( substr($a, $len/2, 1) == ' ' ) { $FirstHalf = substr($a, 0, $len/2); $SecondHalf = substr($a, $len/2); } else { for ( $i = $len/2; $i > 0; $i-- ) { if ( substr($a, $i, 1) == ' ' ) { $array['firstHalf'] = substr($a, 0, $i); $array['secondHalf'] = substr($a, $i); break; } } } return $array; } $a = 'This is a string that is broken up and its awesome! It must be awesome because it is broken up!'; echo '<pre>'; print_r(string_into_parts($a)); echo '</pre>';
  20. To change them to upper use strtoupper http://php.net/manual/en/function.strtoupper.php <TD align="left"><font color="<?=$col?>"><? echo stripslashes(strtoupper($row->fname)); ?></font></TD> <TD align="left"><font color="<?=$col?>"><? echo stripslashes(strtoupper($row->lname)); ?></font></TD>
  21. So I have been battling with this all afternoon on how to write this script and have the following: $limit = 45; $firstpart = substr($array['details'], 0, $limit); $secondpart = substr($array['details'], $limit); Now I tried several solutions before reverting back to the above (the original solution)... the problem with the above solution is that it will break in the middle, beginning or end of a word and place the rest of that word in the $secondpart variable... how could I tell if there is a whole word before breaking? I am completely lost as to how to do this. Thanks in advance! Dennis
  22. I tried the above function but for some reason its not working <?php $str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eros elit, viverra vitae aliquet sed, suscipit aliquet sapien. Vivamus semper augue nec tellus condimentum consectetur dignissim turpis egestas."; $brk = wordwrap($str, 34, "\n"); echo $brk; ?> It should be. If you're viewing it in a browser, it isn't going to make returns with \n. It'll make them with something like <br />. If you look at the output HTML, you should see that the string has been broken up as you've specified, only the line breaks are being ignored by the browser when rendered. OOOO! Its working now! Thanks!
  23. I tried the above function but for some reason its not working <?php $str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eros elit, viverra vitae aliquet sed, suscipit aliquet sapien. Vivamus semper augue nec tellus condimentum consectetur dignissim turpis egestas."; $brk = wordwrap($str, 34, "\n"); echo $brk; ?>
×
×
  • 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.