-
Posts
4,362 -
Joined
-
Last visited
-
Days Won
11
Everything posted by Zane
-
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.
-
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.
-
http://stackoverflow.com/a/7185241/401299
-
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"
-
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.
-
Split String At <Img> Tag And Place In New Varaible
Zane replied to matthewtbaker's topic in PHP Coding Help
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); -
Split String At <Img> Tag And Place In New Varaible
Zane replied to matthewtbaker's topic in PHP Coding Help
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. -
Whoa, gotta check this out.
-
Adding Next And Previous Function To An Edit Form
Zane replied to RLAArtistry's topic in PHP Coding Help
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.- 6 replies
-
- php next code
- previous code
-
(and 2 more)
Tagged with:
-
Adding Next And Previous Function To An Edit Form
Zane replied to RLAArtistry's topic in PHP Coding Help
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.- 6 replies
-
- php next code
- previous code
-
(and 2 more)
Tagged with:
-
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']; }
-
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.
-
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">'; }
-
Usisng FTP you should have no problem uploadng to root assuming you have the write permissions. How are you uploading them now?
-
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
-
http://www.devshed.com/c/a/PHP/Simple-and-Secure-PHP-Download-Script-with-Limits-Tutorial/ There is another helpful link.
-
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
-
I suppose I will just have the person use Dropbox until I have the time to create something. At least it will pay more.
-
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.
-
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.
-
December 6th. Then I will at least have a 20" monitor and a desktop computer. Still, the space is minimal and my room lacks extra outlets so I pretty much have a power strip attached to a powerstrip. I hope to clean things up when I get back, but it wont be long until I am back in a dormroom.. .. Someday I will get my cool workspace. Until then, I´m just having a good time and coding when I get the chance to make a buck or so.
-
Sweet setup Philip, very minimalistic, I like. I don´t exactly have a setup at the moment. My setup gnerally consists of whatever computer I just so happen to be using and usually it is very uncomfortable. I have somewhat of a sloppy personality so my goals for a clean and admirable workspace are usually diminished within a day or two. As of right now, in Mexico, I have a 10.1" HP netbook with Spanish Win7 Starter because I spilled water on my Lenovo G570 that I had for almost a year. Since it is so small I am using the box it came in to raise up higher. I have a retractable mouse with very minmal space to use it. The desk I am using is very wobbly with hardly any legroom. I am sitting uncomfortably in a fold out chair with cushions. Thank God it at least has cushions! To my left is my twin size bed with no box spring, just a wooden plank. To my right I have a vertical shelf with 5 open compartments and behind me is my bathroom. The room is about 15ft wide give or take. Including the bathroom... the room is 30 ft long give or take. Someday I hope to have a setup like yours, I am full of jealousy.
-
You have to use PHP´s isset function to check whether or not the variable exists or not... That is why you get an undefined index...you haven´t hit the submit button therefore POST is empty. $Number = isset($_POST['Fnumber']) ? $_POST['Fnumber'] : null;
- 8 replies
-
- conditional operator
- is_numeric() function
- (and 3 more)
-
Trouble 'notice: Undefined Offset: 1 In ...' Error
Zane replied to ruthpast's topic in PHP Coding Help
You only gave us 15 lines, how are we supposed to know which line is 82? Additionally, associative arrays are called like this $k=$rec['keyword']; with single quotes. Lastly, please use our code tags for code.