Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Another table for preview_images which has a 3d_models id as a foreign key would be the best way to do it.
  2. Use the LIKE operator. keywords LIKE '%$keywords%' The % is a wildcard character.
  3. I doubt this will change anything but perhaps try: <Directory "D:\projects\prj1\"> Inside the vhosts file.
  4. Well I am not sure. Something in your Apache configuration is messing up, what I do not know. Check the httpd.conf file and make sure all the values there are correct like they should be. Not sure why it would be randomly adding a /. What is the entry you put into your hosts file? Mind posting that?
  5. You seem to ignore and not read anything I write to you, good luck with this.
  6. <VirtualHost *:80> DocumentRoot D:\projects\prj1 ServerName prj1.localhost ServerAlias www.prj1.localhost DirectoryIndex index.php <Directory D:\projects\prj1\> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> Give that a try and see if it works for you.
  7. What are you trying to do here: $tmp[0] == $Name { $tmp[1] == $Comment { That really does not make any sense as it is not in an if statement and you randomly add braces after it...
  8. This is not possible with PHP what you are trying to do. As PHP will execute the code inside the <noscript> tag since it does not recognize or execute javascript. PHP simply processes code at the server level then gives the display to the browser for interpretting which is where it will be detected if Javascript is off. http://www.inspirationbit.com/php-js-detection-of-javascript-browser-settings/ Is one way of doing it. I am sure there are tons of different ways like that to do it. But using that script I would do as team has suggested and set a session variable once you figure out if JS is on instead of having every page constantly testing by echoing out a form. That is only needed once.
  9. All I can say is...wow. You did contradict yourself, however, which is why I posted the extensive function: "Chop off the rest" generally means the end of the string. Either way glad it was solved.
  10. <?php function is_safari($needle="Safari"){ $userAgent = $_SERVER['HTTP_USER_AGENT']; if (stristr($userAgent, $needle) !== false){ // change the - (strlen($needle) + strlen($needle)) to just + strlen($needle) to include the needle in the output. return substr($userAgent, 0, strpos($userAgent, $needle) - strlen($needle) + strlen($needle)); } return false; } echo is_safari(); ?> Perhaps that is what you are looking for (note the comment before the return statement for modification). Edit: Added a minor fix.
  11. stristr simply tells you the starting position of the word. If you want to return only part of the string you can use strpos for the S and i and then use substr to chop up the string. But what would be the point of that, you already know the word...why chop up a string to get the same word? I think you are mis-informed on what the functions you are using do. I suggest reading the manuals on the ones I listed to see how they work and what they are suppose to do. Also you may also be leaving out exactly what you want the end result to me. My assumption was you simply wanted to see if Safari was in the string if it was return true, which stristr accomplishes.
  12. Not really sure what you are after but some options are: Joomla (CMS) Drupal (CMS) Smarty (template) CMS - Content Management Software maybe what you are looking for. Smarty is a template engine created in PHP. Not sure which you are after but perhaps it will help you on your journey to find out.
  13. You can try this: function is_safari(){ if(stristr($_SERVER['HTTP_USER_AGENT'], "Safari") !== false){ return true; } return false; } Give that a try and see if it works for you. As just a more informative deal: http://www.useragentstring.com/pages/Safari/ may help you better determining the Safari (if it is needed).
  14. If you have syntax correct code you can use eval but that being used in the wrong way can open up security holes in your server (And many hosts have it disabled because of that). An example: $array_string = "\$array_from_string = array(0 => 'Rakel', 1 => 'Dix', 2 => array(0 => 'Barne', 1 => 'Barn'), 3 => array(0 => 'Tisse', 1 => 'Mann'), 4 => 'Julenissen', 5 => 'Nisse', 6 => 'Far');"; // be cautious with the eval function. eval($array_string); Would make that into a valid array. (note I had to modify the string to be formed with correct syntax etc.
  15. On a side note: You have your files with .htm extension. Unless your server is set to parse .htm as .php this will not work. Just an FYI.
  16. That is impossible to get with Thorpes code, post the query you are really trying to run.
  17. It is a tad bit more complicated then that. Here is an example function found at print_r which can reverse the output produced by print_r (but you need the full output from it and not a jumbled mess like is in your code). <?php function print_r_reverse($in) { $lines = explode("\n", trim($in)); if (trim($lines[0]) != 'Array') { // bottomed out to something that isn't an array return $in; } else { // this is an array, lets parse it if (preg_match("/(\s{5,})\(/", $lines[1], $match)) { // this is a tested array/recursive call to this function // take a set of spaces off the beginning $spaces = $match[1]; $spaces_length = strlen($spaces); $lines_total = count($lines); for ($i = 0; $i < $lines_total; $i++) { if (substr($lines[$i], 0, $spaces_length) == $spaces) { $lines[$i] = substr($lines[$i], $spaces_length); } } } array_shift($lines); // Array array_shift($lines); // ( array_pop($lines); // ) $in = implode("\n", $lines); // make sure we only match stuff with 4 preceding spaces (stuff for this array and not a nested one) preg_match_all("/^\s{4}\[(.+?)\] \=\> /m", $in, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); $pos = array(); $previous_key = ''; $in_length = strlen($in); // store the following in $pos: // array with key = key of the parsed array's item // value = array(start position in $in, $end position in $in) foreach ($matches as $match) { $key = $match[1][0]; $start = $match[0][1] + strlen($match[0][0]); $pos[$key] = array($start, $in_length); if ($previous_key != '') $pos[$previous_key][1] = $match[0][1] - 1; $previous_key = $key; } $ret = array(); foreach ($pos as $key => $where) { // recursively see if the parsed out value is an array too $ret[$key] = print_r_reverse(substr($in, $where[0], $where[1] - $where[0])); } return $ret; } } ?> Hopefully that function helps you out. It would take the whole first section of code as the string.
  18. Then it seems you may have the wrong column names. As the only difference in the variation I posted is that I just echoed the data straight from the returned result array.
  19. Because you only echo out that last result: while ($row = mysql_fetch_assoc($get)) { // echo data echo "The user ". $row['username'] ." got a score of ". $row['score'] .""; } Since there are multiple data you have to iterate through the results to print it and or collect them all into a multi-dimensional array and loop / iterate through that.
  20. Your server is using PEAR, which is good. http://www.phpmaniac.net/wiki/index.php/Pear_Mail#Sending_your_first_email See that tutorial for instructions on sending an html email with PEAR.
  21. Thats a lot going on in 1 query. How often is this query ran / does it need to be ran? It may be prudent to separate it out into some smaller queries if you use it quite often, as doing sums inside of subquerys I can see where that would be very CPU intense. Depending on when it is displayed you may also be able to fetch some of the data once and store it in session (such as a single student viewing their information). Well not much help, but I would also check and make sure your indexes are correct.
  22. Why do you insist on closing the connection? I would remove all of the mysql_close from your script, as unless you are switching databases it is not necessary as PHP will automatically close the connection for you. On another note, perhaps this tutorial I wrote will help you out: Fetch MySQL Data Using PHP and GET
  23. These are basic errors, I would highly suggest you read up on debugging at the tutorial Debugging a Beginners Guide. As you seem to lack any debugging skills. ."Special Instructions: ".$specialinstructions."\n", ."(From $name, $email, $phone)\n","From: $email")){
  24. Not a good enough reason for posting in the incorrect forum. Moving to Javascript. Please do not deliberately disobey the rules again.
  25. By using the GROUP BY function, you will want to GROUP BY user.
×
×
  • 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.