Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. gizmola

    NFL Draft

    It's NHL playoff time, I am unable to think about the NFL right now.
  2. I actually wanted you to run the var_dump and paste the results here so we can see what the data array contains.
  3. So what we learned is that what you are getting as input is already being translated to the html entities rather than the utf-8 characters. I'm not sure if that's a good thing or not, but you probably want to explore that further.
  4. Well it seems I'm unable to get the forum to accept these characters. I'll put the script in webspace. It does work fine if you set the format of the source file to be utf-8 and you have the actual utf-8 characters in the source array. http://www.gizmola.com/blog/uploads/testarabic.txt
  5. Let's try this once more: function indicToArabic($str) { $arabic = array('0','1','2','3','4','5','6','7','8','9'); $indic = array('٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'); return (int)str_replace($indic, $arabic, $str); } $str = '١١٢٥'; echo $str . PHP_EOL; echo "Number: " . indicToArabic($str) . PHP_EOL; I get: ١١٢٥ Number: 1125
  6. There's no magic solution. CV has a cool approach. You could also write a quick function like this. Rather than asking for explanations of how these work, try reading about the functions used in the php manual. They are well documented. function getRand() { $x = rand(0, 270); if ($x > 89 && $x $x += 180; return $x; }
  7. Right at the top under the line: while (($data = fgetcsv($handle, 900000, ",")) !== FALSE) { Add var_dump($data); So you can see if the $data array elements match up to what you expect. I'm assuming that if the problem you pointed out above is related to data, it's that when you use itemNumber=, if itemNumber is a numeric data type as defined in your database, then it expects a number. '2X' would not be a number. If it's a character type like a varchar, then you need the quotes around it for the sql to be valid. $result = mysql_query("SELECT * FROM inventory WHERE itemNumber='$data[0]'");
  8. This might be an alternative: function indicToArabic($str) { $arabic = array('0','1','2','3','4','5','6','7','8','9'); $indic = array('\xD9\xA0','\xD9\xA1',...... etc); // Should be D9A0 to D9A9 return (int)str_replace($indic, $arabic, $str); }
  9. Note that the forum went and converted all the characters there to html entities.
  10. Try something like this: function indicToArabic($str) { $arabic = array('0','1','2','3','4','5','6','7','8','9'); $indic = array('०','१','२','३','४','५','६','७','८','९'); return (int)str_replace($indic, $arabic, strrev($str)); } I'm assuming you need to reverse the string, but if that's not an issue remove the strrev() function call. Let me know if this works out.
  11. I editted your post to take out your pw's, and here I reformatted your code a little bit, and changed the mysql_error() call in the loop to echo rather than die in the outer loop. I don't see anything overtly incorrect here. Are you getting any errors? What is the output? session_start(); //db connection $db = mysql_connect("xxx", "xxx", "xxx") or die("Could not connect."); if(!$db) die("no db"); if(!mysql_select_db("db70481_mlkishigo",$db)) die("No database selected."); //$row = 0; if (($handle = fopen('http://mlkishigo.com/sageonline/inventorylist.csv', "r")) !== FALSE) { while (($data = fgetcsv($handle, 900000, ",")) !== FALSE) { $num = count($data); $result = mysql_query("SELECT * FROM inventory WHERE itemNumber=".$data[0]); if ($result) { $recordCount = mysql_num_rows($result); echo "$recordCount Rows\n"; if ($recordCount > 0) { // rest of your current code loop here. $sql1 = "UPDATE inventory SET itemNumber='$data[0]',itemDesc='$data[1]',quantityHand='$data[2]',category='$data[3]',Whse='$data[4]' WHERE itemNumber='$data[0]'"; mysql_query($sql1) or die(mysql_error()); } else { // your current code. $sql="INSERT into inventory(itemNumber,itemDesc,quantityHand,category,Whse) values ('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]')"; mysql_query($sql) or die(mysql_error()); } } else { echo mysql_error(); } } fclose($handle); } ?>
  12. Yes you literally need at least one program that can handle every file format you're talking about, and be able to render them. For a lot of the image files, there are libraries that will let you load and manipulate them, but for word docs, excel spreadsheets and powerpoints. If your focus is these microsoft application formats, then a windows machine has a lot of advantages due to the windows os technologies used. I have my doubts about being able to prtscrn everything, but you definately can have a custom print driver installed like the one that comes with adobe pdf.
  13. Well, your first query can not succeed based on what you have right now, because I don't see anyplace that $data would be getting values from. You used to have: if (($handle = fopen('http://mlkishigo.com/sageonline/inventorylist.csv', "r")) !== FALSE) { while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) { $num = count($data); Did you leave that out? I'd actually like to see your entire script at present rather than a snippet.
  14. If you're really focused on image uploading, then be sure to read the link I provided to the upload page of the php manual. The code snippet you have won't work for images for reasons that are thoroughly explained in that part of the manual. Just focusing on having a form that allows you to upload an image to a directory on the server, and then allowing users to see a table of those images, is a good starter project that is not too big.
  15. Haha. As to this subject, my wife keeps reminding me that the dryer is one of the most common sources of household fires, so we never start the dryer up and leave the house. Our dryer is really old and about a year ago it basically stopped drying. I found some schematics on the internet for it, and figuring I had nothing to lose, decided to take it apart. I bought a new belt for it and set about taking it apart, and I was amazed to find that my perception of what the drum was nothing like the reality. The drum of our dryer is basically a flexible metal tube which is held in place by the two cylinders which can rotate independently from the cylinder pieces, which hold it in place with felt. It's kind of amazing how flimsy the whole thing is once you take it apart. After changing the belt, the dryer would turn, but wouldn't dry, and eventually i found a piece in the heating element that was burned out and fixed that. Both pieces cost me $20 bucks. Having played with it, and seen how the heating works (it's a gas dryer) I'm very aware of the fact that flame is involved now. Of course without the internet I would never have even tried to repair the dryer, nor be able to identify the part numbers of the parts, or known where to order them.
  16. Yes, it's just like any other php file --- you can have markup, queries, php code, etc. Most people make it look just like a normal page on their site, and in the content area, you would typically have some text saying that the Page was not found, and typically suggesting that people go somewhere else.
  17. Let's see the current version of your script.
  18. Oops, yes you need parens around the part you want to capture to the $1 variable. RewriteRule ^([a-zA-Z0-9-]{4,})\.html$ search.php?q=$1 [QSA,L]
  19. We have over 1500 users who have 'php' in their username, and yet you are the first person to pick the handle 'phpchick'. That's amusing to me for some reason. Welcome to phpf.
  20. Yes you got it. My assumption was that if none of these rules match, then you will fall through to a 404 automatically.
  21. Not at all, he probably wanted to do what you originally suggested, so all i could offer was a caveat.
  22. My answer is the same. Your paging links are what you are sending to the client in your html page. If you want them to be of the format http://www.domain.com/portfolio/1 then that is how they should be in the anchor tags you are creating in your script.
  23. You want to take all the code inside the textarea and run it through htmlentities. Otherwise, it's a good solution.
  24. All the code I provided was meant to do was use the same array that is used to validate the tld (com, net, org etc.) does not appear as the host, so no .com.com or .net.com. That's what you originally asked for. It has nothing to do with regex at all. There is a piece of that code that is regex, but that check is done by taking a string and using in_array to check whether or not it is in the $tld_list array. This is not hard to understand even if you don't know regex. Just go through the code looking at the manual for any of the functions being used. You can take these functions or pieces of them, assign them to strings and echo or var_dump their values in order to debug things so you understand better how they work.
  25. It looks like these fall through to the final RewriteRule: RewriteRule ^(.*)\.html$ search.php?q=$1 [QSA,L] So if you use neils suggestion then change that to: RewriteRule ^[a-z]{4,}\.html$ search.php?q=$1 [QSA,L] This rule very specifically will only allow lowercase letters, with no numbers or other characters in there, just so you know.
×
×
  • 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.