Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zane

  1. Since you want to capture the input of a dot (period) on-the-fly / live it is not considered a server side script. In other words.. PHP would have nothing to do with capturing the dot character as they type. Javascript is what you are looking for ... and jQuery is the best possible framework that I know of to implement your Javascript. Here is an example to get you started http://api.jquery.com/keypress/
  2. http://php.net/implode implode is what you are looking for, but like you've been advised on plenty of times so far, it is not the correct way to go and you will ultimately end up with deeper problems if you persist with the implode method. But like I have already learned from trial and error. You cannot teach trial and error, so go crazy and figure out the reason behind our advise yourself. Then you can come back and tell us, "You were right"
  3. It most likely has to do with the fact that you have spaces before and after the username WHERE username = ' " . $username. " ' "
  4. There are few episodes in Workaholics.. that mention web design and even though the show has nothing to do with programming, it is totally worth a watch. In fact, I think I will watch an episode right now. -- "It isn't very often that you get a second chance at third love"
  5. Great movie that. I was going to suggest the same thing, but like Kevin already pointed out, it barely covers anything about programming at all. It is more about piracy, stealing ideas, trickery/treason, etcetera... and how it equates to being a successful business person. **I never knew that about the Bender/Balmer connection. Thanks for the trivia.
  6. In order to do the toggle from clicking outside the div, you will need a fixed position invisile overlay that covers the entire screen. So, whenever the login link is clicked, the overlay´s z-index is moved up above the rest of the page yet underneath your login/register boxes. This way you can have one single function to hide everything The overlay would have a width and a height of 100%, its position would be fixed, with no margins, borders, or anything else. You COULD if you wanted to, make its background gray with a 50 to 60 percent opacity. Either way, when it is all said and done you would have a jQuery function like this $("#overlay").click(function() { $(".login-form, .register-form").hide(); }); Or you could do it the risky way and hide upon the click of anything on the page, but you would have to list and rule out which elements should not trigger the hiding, like for instance, links, inputs, buttons, etcera, that are inside your login-form and register-form. $("*").click(function() { if($(this).parent().className != "login-form") { $(".login-form, .register-form").hide(); } }); Furthormore, when I googled your problem, the very first result gave me this http://stackoverflow.com/a/1403648/401299 which is WAY better than my solution.
  7. http://stackoverflow.com/a/7185241/401299
  8. PHP does not make queries, MySQL does. To achieve what you want you will need to use a join. "SELECT * FROM articles a JOIN categorys c ON a.profile = c.id ORDER BY a.id DESC LIMIT ".$from.", 20"
  9. You are not querying your SELECT statement. You are literally putting the SELECT query inside the INSERT query. $fuel_code = 'SELECT * FROM expense_categories WHERE type = $fuel_type'; $sql="INSERT INTO expense_fuel (id, fuel_type, amount, month, day, year) VALUES ('$fuel_code', '$fuel_type', '$fuel_amount', '$fuel_month', '$fuel_day', '$fuel_year')"; This will create a query that looks like this INSERT INTO expense_fuel (id, fuel_type, amount, month, day, year) VALUES ('SELECT * FROM expense_categories WHERE type = $fuel_type', '$fuel_type', '$fuel_amount', '$fuel_month', '$fuel_day', '$fuel_year') Can you explain again what exactly you are trying to do? Although I have pointed out a serious problem, I still cannot understand your purpose. If you want the value from a SELECT query to go into your INSERT query, then why are you SELECTing everything, that makes no sense unless the tables expense_fuel and expense_categories have the exact same columns....which I highly doubt. It would help you more than us tremendously if you post your database layout and some sample data.
  10. There is always the DOMDocument route. $doc=new DOMDocument; $doc->loadHTML('<p><img src="myimage.jpg" border="0" /></p> <p>My short paragraph</p>'); $path=new DOMXPath($doc); foreach ($path->query('//img') as $found) echo $doc->saveXML($found);
  11. PHP´s strip_tags function should do the trick http://php.net/strip-tags $html = '<p><img src="myimage.jpg" border="0" /></p> <p>My short paragraph</p>'; $strImage = strip_tags($html, "<img>"); I suppose you could do the same for your second varialbe, but you will have to come up with something to get rid of blank P tags.
  12. Hmm.. I wondered whether that would work or not. I should have mentioned that it was not a guaranteed successful query. But for certain, the IDs will have to be specifically selected.
  13. You didn't search hard enough http://php.net/manua... Simply incrementing or decrementing your pid variable isnt safe. For instance, what if you delete a product, then that id no longer exists in a perfectly normalized database table. If you want the previous and next id you will have to select them and limit your results to 3 SELECT * FROM products WHERE id='$thisID' OR id<'$thisID' OR id>'$thisID' LIMIT 3 To keep the other products' info from disrupting your current while loop, you will have to check whether $row['id'] == $thisID.
  14. You should use mysql_fetch_assoc if you want the column names for the key Typically, when people write code to retrieve mysql results they loop through their result with a while loop, such as this while($row = mysql_fetch_array($result1)) { echo $row['columnName']; }
  15. 5 GB is 5120 MB, so with that part out of the way, Multiply 5120 by 12000, then divide by 2.5 (5120 * 12000) / 2.5 = 24,576,000 rows.
  16. Assuming this script is working already, all you need is an else if if ($row_rsReleaseQue['duedate'] < date('d-m-Y',$now)) { echo '<tr class="tableBody3">'; } else if($row_rsReleaseQue['duedate'] == date('d-m-Y',$now)) { echo '<tr....'; } else { echo '<tr class="tableBody1">'; }
  17. Usisng FTP you should have no problem uploadng to root assuming you have the write permissions. How are you uploading them now?
  18. Since this is indeed in the root directory, you need to prefix the path with a /. That slash symbolizes the root directory. Othrewise it is going to look within the current directory for a directory called home
  19. http://www.devshed.com/c/a/PHP/Simple-and-Secure-PHP-Download-Script-with-Limits-Tutorial/ There is another helpful link.
  20. I have never done anything like this before, but I am going to try to explain the logic I would use if I were in your situation. Assuming you already have payment notifications set up so you can code around a successful transaction, I would have all of your files stored in a private directory outside of public_html and out of the webs reach. I would also have another private folder to which you would store copies of these files. Once a user pays, the file should be copied to the other folder and given an md5 encrypted filename for a bit of obscurity. But like all the good books tell you, Obscurity is not security. So you will indeed need a database for this to keep up with the timestamps as well as the number of times it is downloaded .. and the user who is downloading it. You can do all this using a php download.php script to fetch the file from the other folder without the user ever knowing its whereabouts. Also, it doesnt hurt to Google a bit http://stackoverflow.com/questions/10834196/secure-files-for-download
  21. This may (or may not) help you. I thought I should at least show it to you http://rickosborne.o...-grouped-query/ Here is another source that should help you http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/
  22. I suppose I will just have the person use Dropbox until I have the time to create something. At least it will pay more.
  23. I am looking to implement a private image hosting setup without having to write it from scratch. I know there has to be some kind of Gallery API that is out there that I do not know about. I am looking for some kind of minimalistic tinyimg type thing. Does anyone have a clue of something like that exists? I have googled but all I can find is image hosting servers. I already have the server, I just need to find a simple interface....either open source or pay, doesnt matter to me at this point.
  24. The number one thing I miss about my home is the water. I live in a very rural city in the Appalachian mountains of North Carolina so drinking from the tap is no different that bottled water. Additionally, we have springs and wells all around the area. I can literally hike up into the woods, find a spring and drink directly from the puddle it creates..which converts into a creek later on down the mountain. Sorry, just realized that has nothing to do with workspace.
×
×
  • 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.