363 Posted Topics
Re: Hey. Two problems I see. First, you need to add [icode]enctype="multipart/form-data"[/icode] to your form. Required for all forms that do file uploads. Second, [icode]$_FILES['file']['file_name'][/icode] should be [icode]$_FILES['file']['name'][/icode], and the mime and size checks need to be done against their respective fields in the [ICODE]$_FILES['file'][/ICODE] array, rather then against the [ICODE]$file[/ICODE] … | |
Re: Hey. What is the actual URL of the image (not) being shown there? Is it what you would expect it to be? Could you explain exactly [i]how[/i] you are displaying the image, and where the image is coming from? It would also help to see the code for this. P.S. … | |
Re: Hey. The old [url=http://php.net/manual/en/book.mysql.php]MySQL extension[/url] was written for MySQL 3, and while it is compatible with MySQL 4 and above, it doesn't support most of the new functionality, like Stored Procedures. If you are using MySQL 4 or higher, you should really be using the [url=http://php.net/manual/en/book.mysqli.php]MySQLI extension[/url], and, if only … | |
Re: edwinhermann is right. The end delimiter for a [url=http://.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc]heredoc[/url] string must be the first thing in the line, and there can not be anything after the semi-colon, not even a white-space (tabs, spaces, etc..). The latter is also true for the start delimiter. It must be the last thing on … | |
Re: Hey. Easiest way to do that is to just write a function, and have that function change all the pictures. Like: [code=javascript]function SetLinkBG(pActive) { var links = [ document.getElementById('Link1'), document.getElementById('Link2'), document.getElementById('Link3'), document.getElementById('Link4') ]; for(var i = 0; i < links.length; i++) { if(links[i] == pActive) { links[i].style.backgroundColor = "url(active.png)"; } … | |
Re: Hey. You can get the GET parameters from the [icode]window.location.search[/icode] element, which you can then parse and use in your Javascript code. For example: [code=javascript]var $_GET = {}; window.onload = function() { // Parse the GET parameters into the $_GET global. var parts = window.location.search.toString().substring(1).split("&"); for(var i = 0; i … | |
Re: Hey. This is a .Net thing, no? Googling this, these two results look promising. Try reading through that and see if it helps any. If not, I would try asking this in a ASP.Net forum, because this is not really a Javascript thing. (As far as I can tell, at … | |
Re: Hey. A bit of Google'ing turned up these two links. [url]http://www.ietf.org/rfc/rfc2388.txt[/url] [url]http://www.faqs.org/rfcs/rfc1867.html[/url] Does that help? You could of course always just go directly to the W3C HTTP specifications. ([url]http://www.w3.org/Protocols/rfc2616/rfc2616.html[/url]) | |
Re: Hey. Yea, you are using the wrong variable for the Content-Length header, and you don't actually output the file, which is why it is empty. Line #19 should read: [code=php] header("Content-length: " . filesize( $filepath )); readfile($filepath); // <-- this sends the file [/code] | |
Re: [code=php] <?php if(isset($_SESSION['User'])) { header("Location: login.php"); exit; } // rest of your code here. [/code] Like Keith says... it's that simple. | |
Re: Hey. I recommend you try the [url=http://php.net/mysqli]improved MySQL extension[/url], rather then the old MySQL functions. [code=php]<?php $dbLink = new mysqli("host", "user", "password", "database"); if(mysqli_connect_errno()) { die("MySQL connection failed: ". mysqli_connect_error()); } $result = $dbLink->query("SELECT stuff"); while($row = $result->fetch_row()) { // etc... } @$result->close(); $dbLink->close(); ?>[/code] Or, if you aren't a … | |
Re: [QUOTE=Facte;1005940]The expiry date in the database is in this format 06/26/2009 (which cannot be changed in the database) as I am aware that it makes a difference. [/QUOTE] Hi. If you can not replace you custom string date with a proper date, you will have to have PHP do this … | |
Re: Hey. The problem is that you do the replacement one word at a time, inside the loop. This means that your [icode]$comment[/icode] variable is overwritten for every word, and each time with only [i]that word[/i] replaced. So you end up with the original comment text with just the last word … | |
Re: Hey. Could we see the code that is generating this error message? It helps with the debugging process, to be able to see the code ;-) Also, you might want to consider abandoning the old PHP mail function and try one of the PHP mailer classes, like: [URL="http://phpmailer.worxware.com/"]PHPMailer[/URL] or [URL="http://swiftmailer.org/"]Swift … | |
Re: Hey. Rather then doing [icode]if (!$text)[/icode], try doing [icode]if (empty($text))[/icode]. Or, better yet, design your if statements so anything you don't expect falls through to the "else" clause: [code=php] $value = trim($_GET['text']); if($value == "somethin") { ehco "We got something!"; } else if($value == "something else") { echo "No, we … | |
Re: Netbeans, Aptana, Eclipse PHP. All free and very good. I used to use Dreamweaver to, but it's just not worth it. Netbeans is a better IDE, in my opinion, and it doesn't cost a thing. Zend Studio is also a much better option if you insist on spending money on … | |
Re: Hey. Looking over that, I see nothing essentially wrong with it. I assume you have ruled out the usual file permissions issues and upload size limitations? When the code is not working, does it give you any sort of error messages? [i](Are error messages even turned on in the server?)[/i] … | |
Re: Hey. This could be an issue with your database charsets. Some databases, like MySQL, use a case-insensitive collate by default. You can fix that in MySQL by setting the default collate to a case-sensitive one: [i](Note that the 'cs' or 'ci' at the end of collate names indicates whether they … | |
Re: Hey. As the Warning says, the file or directory you are trying to create appears to already exist. Have you verified that this is not the case? You should use the [url=http://php.net/file_exists]file_exists[/url] function on your path before trying to create it, to make sure it actually needs to/can be created. … | |
Re: Hey. This should do it: [code=sql]SELECT * FROM friends WHERE their_id NOT IN ( SELECT their_id FROM address_book )[/code] P.S. Is "my_id" a number? If it is, the $myid value really shouldn't be quoted [code=sql]SELECT * FROM address_book WHERE my_id = $myid[/code] | |
Re: Hey. I am not familiar with the internals of vBulletin, but presumably it has a database where it stores forum posts and related info. All you have to do is create a script that adds a record to the post table, and perhaps to the "surrounding" tables, if that is … | |
Re: Hey. When you submit the form using a [ICODE]type="image"[/ICODE] button, or submit the form using the enter key, some browsers do not pass the button along with the data. To circumvent this, and assure that your test will work on all browsers, always use the [icode]if(isset($_POST['xxx']))[/icode] test on a data … | |
Re: Hey. I see nothing inside the foreach loop that would mess with your $n variable. It should only be incremented by one for each row in your MySQL query result. The output you printed makes no sense. The only thing in that code that changes the $n variable, aside from … | |
Re: Sure. A CMS doesn't have to be complicated. Not knowing a single thing about your website, if you had a news section, simply having a server-side script read the news from a database into a HTML page, and another page that would allow you to add to the news database... … | |
Re: [QUOTE=Tulsa;889325][code] <input type="text" disabled="disabled" name="txt1"/> <input type="button" value="Click me" [B][COLOR="Red"]onblur[/COLOR][/B]="func_unlock();"> <script type="text/javascript"> function func_unlock() { document.getElementByid('txt1').disabled=false; } </script> [/code][/QUOTE] Are you sure you don't mean [icode]onclick[/icode]? That wouldn't fire when the button was clicked, but rather when the button is deselected. [B]Edit:[/B] And you misuse the [i]name[/i] attribute. Only IE … | |
Re: Or you could just do: [code=php] header("Refresh: 3; url=http://www.google.com"); echo "You will be redirected to Google in 3 seconds..."; [/code] [i]Note, the echo [b]must[/b] be after the header, or this will fail.[/i] | |
Re: It wouldn't be a huge surprise if a message like that ended up in your spam folder, so watch out for that. Might want to add some more text to it to try and avoid that :) | |
Re: How do you suppose we should figure out the problem based on that description? Psychically? We can't debug code we can't see. [i](Not well, anyways)[/i] And yes, your right. PHP can't display images, and it doesn't. It's your browser that displays the images based on directions given to it in … | |
Re: Hi. The [url=http://dev.mysql.com/doc/refman/5.1/en/information-functions.html#function_row-count]ROW_COUNT[/url] function will return the number of rows in a previous INSERT, UPDATE or DELETE statement. | |
Re: Hi. What OS, browser, download acceleration software, etc... are you using? Somehow, as I read your description I immediately though "the router", but it could just as well be your network card, your OS or your browser. To rule out your OS and browser, try booting a Linux live-cd and … | |
Re: Hi. [B]#1.[/B] No, not really. In this case using three separate queries is most likely your best option, performance vise. Any combination of them (that I see, anyways) would require you to duplicate data in the return set, which would undoubtedly slow the query down in comparison. [B]#2. [/B]The best … | |
Re: Online information system? That could be anything from a private blog to a Google sized search engine. Could you possible be more vague? :) I would also have to say yes to PHP. P.S. If you want a unbiased opinion, it's probably best to not ask in a language specific … | |
Re: Hi. You could try the IF function: [code=mysql] SELECT IF(SUM(number) IS NOT NULL, SUM(number), 0) AS `Sum` FROM myTable;[/code] | |
Re: Hi. You don't actually have to check if it exists, just use the [icode]IF EXISTS[/icode]clause: [code=mysql] DROP TABLE IF EXISTS `myTable`; CREATE TABLE `myTable`( ... );[/code] | |
Re: Yep, he's right. You need to make sure the quote marks for your strings match up, and that they aren't being closed prematurely by what is supposed to be inside the string. For example: [code=php] <?php echo 'John's name.'; // Parse error (Note how the code coloring is off)' echo … | |
Re: Imagine how annoying it would be if websites could not only pop up windows, but have them chase the mouse around :S | |
Re: Hi. How do you include the CSS file into your page? Could we see the header of your page? | |
Re: If you have the [icode]check()[/icode]function return false, you can remove the [icode]return false;[/icode]from your [I]onsubmit[/I] event. It's just a bit cleaner that way ;-) | |
Re: Hi. Yea, it's kind of hard to debug code you can't see :) I'm guessing that your code is failing to send the mail [I](for any number of reasons, which we need the code to deduce)[/I] and that your host is suppressing the error messages. Try adding this to the … | |
Re: Each Integer type is stored using a certain amount of bytes. [i](See a list [url=http://dev.mysql.com/doc/refman/5.1/en/storage-requirements.html]here[/url])[/i] A typical INT uses 4 bytes, so it can store the numbers: Signed: [ICODE]-2147483648[/ICODE] to [ICODE]2147483647[/ICODE] Unsigned: [ICODE]0[/icode] to [icode]4294967295[/icode] A BIGINT uses 8 bytes, so it can store the numbers: Signed: [ICODE]-9223372036854775808[/ICODE] to [ICODE]9223372036854775808[/ICODE] … | |
Re: Hi. When you say that it has two primary keys, do you mean they are a joint primary key? Because you can only have a single PK, so to use more then one row as the PK, you have to make a composite PK. Judging by your error, I would … | |
Re: You could also have them [i]both[/i]listed alpabetically. [code=php]SELECT name, num FROM tablename ORDER BY name, num[/code] That might give you: [code] +------+-----+ | name | num | +------+-----+ | Abc | 1 | | Abc | 2 | | Abc | 4 | | Bbc | 2 | | Bbc … | |
Re: Yea. Looks like the includes are created dynamically, but the variable containing the file name is empty. Either that or somebody created an empty include on purpose... which makes no sense. Either way, seeing the code around the line that is causing this would be very helpful. | |
Re: And, to process Tulsa's values, I recommend looking into the [url=http://php.net/implode]implode[/url] function. [code=php] <?php if(isset($_POST['comp'])) { // Clean data $cleanData = array(); foreach($_POST['comp'] as $_comp) { $cleanData = mysql_real_escape_query($_comp); } // Build query $compStr = implode("'), ('", $cleanData); $sql = "INSERT INTO tbl('compCol') VALUES('$compStr')"; // Example query: // INSERT INTO … | |
Re: To answer the actual question: No, you can't use PHP client-side. Unless you happen to have a browser that supports PHP as a scripting language. [i](Of which I know none)[/i] [QUOTE=ardav;888187]I came across this a little while ago. I tried some of the functions and they were fine, although one … | |
Re: As an alternative to that [I](albeit, a rather radical one)[/I], you could try setting up a Linux system! :D [url=http://www.ubuntu.com]Ubuntu[/url] is good. Setting up Apache with PHP on Ubuntu is as simple as opening up a terminal and typing: [icode]$ sudo apt-get install apache2 php5[/icode] There is also a GUI … | |
Re: Hi. If you do allow them to use their own CSS, be careful not to let them use [icode]url()[/icode]values, as that could make your users vulnerable to XSS attacks. [i](As well as any other style that would allow loading of external resources... can't think of any more of them at … | |
Re: Hi. Have you made sure your server allows URLs to be used to get data like that? Try this: [code=php]<?php header("content-type: text/plain"); echo "fopen : ", (ini_get('allow_url_fopen') ? "TRUE" : "FALSE"), "\n"; echo "include: ", (ini_get('allow_url_include') ? "TRUE" : "FALSE"), "\n"; ?>[/code] If both are FALSE, then your server doesn't … | |
Re: Which versions of IIS and Apache are you running? And which version of Window$ ? I'm currently running IIS7 and Apache2.2 on my Window$ 7 without problems, and I only edited those two fields... pretty much exactly how you did it. Have you checked the error logs from Apache, to … | |
Re: Hi. The word 'desc' is a reserved SQL keyword. If you want to use it in a query like that, you need to enclose it in back-ticks. Like: [code=sql]UPDATE group_data SET title='$title', `desc`='$title' WHERE groupid='$groupid'[/code] |
The End.