363 Posted Topics

Member Avatar for akvlko

Hey. We can't really help you fix the problem unless we can see your code. There is no copy/paste'able script for stuff like this we can just hand over. It has to be tailored to your data. Also, a description of your database tables would be helpful.

Member Avatar for akvlko
0
196
Member Avatar for tulipputih

Hey. I wrote an article a while ago that explains how to do this in detail. [url=http://bytes.com/topic/php/insights/740327-uploading-files-into-mysql-database-using-php]Check it out[/url]. [QUOTE=network18;1036572]At the same time , its never advisable to store the entire file in the database.[/QUOTE] Why do you say that? I can think up a few reasons why you would …

Member Avatar for Atli
0
131
Member Avatar for elanorejoseph

Hey. The [url=http://php.net/isset]isset[/url] and [url=http://php.net/empty]empty[/url] functions are also handy when validating form data. (or any data, for that matter)

Member Avatar for venkat0904
0
346
Member Avatar for olunde

Hey. I just wanted to point out a few minor things in network18's code: [list] [*]Short tags are baaad! ;-) [*]Where does the [icode]$uploadArray[/icode] variable for the foreach loop come from? Wouldn't it be better to just use [icode]$_FILES[/icode]? [*]Line #2. [icode]$_POST[submit][/icode]. The 'submit' should be quoted, right? [*]Line #13. …

Member Avatar for network18
0
129
Member Avatar for violarisgeorge

Hey. You should check out [url=http://phpmailer.worxware.com/]PHPMailer[/url] or [url=http://swiftmailer.org/]Swift Mailer[/url]. Both are much easier to deal with than the PHP mail function, and both allow for multiple recipients. But if you don't want that, the steps you describe for you mail script looks OK. At least on paper :)

Member Avatar for violarisgeorge
0
153
Member Avatar for SKANK!!!!!

Hey. Yea, you set the [icode]session.gc_maxlifetime[/icode]variable in the php.ini file to limit the time a session can stay idle. If you don't know where the php.ini file is, create a file with just: [icode]<?php phpinfo(); ?>[/icode] and look for the [i]"Loaded Configuration File"[/i] value. That will contain the path to …

Member Avatar for SKANK!!!!!
0
264
Member Avatar for slr

Yea, whatever you do, you will need a list of correctly spelled words to test against. PHP has no way to determine what is and is not incorrectly spelled unless it has something to compare it to. Once you have that list, however, PHP has a few functions you can …

Member Avatar for diafol
0
2K
Member Avatar for whitestream6

You could even simplify it further: [CODE]<?php $dat = intval(@$_GET['day']); if($dat < 1 || $dat > 7) { $dat = date('N'); } include("test{$dat}.html"); ?>[/CODE] The [icode]intval[/icode] function always returns a number, or 0 if the input is invalid, which would be the case if no "day" value was passed.

Member Avatar for diafol
0
185
Member Avatar for dangari

Hey. How about something like: [code=java] // Create a list object for the conditions, and the query string. List conditions = new List(); String query = "SELECT * FROM tbooks"; // Add each condition to the list if it is present. if(!serial.equals("")) { conditions.add("serial='" + serial +"'"); } if(!tel.equals("")) { …

Member Avatar for dangari
0
107
Member Avatar for bonzi200x

Hey. No, this is a problem with one of your PHP scripts. Somewhere in the code you try to use a non-object (a normal variable) as if it were an object. I can't really tell you more unless you locate the code that is generating the message. Was there more …

Member Avatar for cwarn23
0
110
Member Avatar for lamjdx

Hey. No offense, TCANIPE, but that code is just... bad. Let me explain: [list=1] [*]Most importantly, you NEVER put a $_POST variable [I](or any variable, for that matter)[/I] into a MySQL query without running it through [url=http://php.net/mysql_real_escape_query]mysql_real_escape_query[/url], or something equivalent. It leaves you wide open for [url=http://php.net/manual/en/security.database.sql-injection.php]SQL Injection[/url]. [*]The way …

Member Avatar for network18
-1
233
Member Avatar for jyotidagia

Hey. I don't know of a MySQL statement that is capable of fetching those values in such a way that it can be return as a table, and I am unable to find one in the manual. [i](Although, it may well have eluded my brief search.)[/i] Usually, the structure of …

Member Avatar for Atli
0
102
Member Avatar for samarudge

Hey. I was under the impression that Blowfish was an encryption cipher, not a hashing algorithm? Encryption usually allows for decryption, while hashing does not, and I believe Blowfish does allow for decryption. [I](Although, now that I think about it, I am not entirely sure on that point.)[/I] In any …

Member Avatar for digital-ether
0
175
Member Avatar for sam023

Hey. The old MySQL extension was never built to run procedures, even tho it *can* be used to do so. You should be using the [url=http://php.net/mysqli]Improved MySQL[/url] extension if you are planing to use features like Stored Procedures. The problem you are facing, "Commands out of sync", is caused by …

Member Avatar for sam023
0
9K
Member Avatar for hemgoyal_1990

Hey. To add to an array from withing a recursive function, you need to either import a global variable into the function, or pass it as a reference parameter. [code=php] $myArray = array(); function setValue($value) { if($value < 100) { global $myArray; $myArray[] = $value; setValue($value+1); } } [/code] [code=php] …

Member Avatar for Atli
0
176
Member Avatar for badmanmc

Hey. You can see how MySQL procedures look like [url=http://dev.mysql.com/doc/refman/5.1/en/stored-programs-defining.html]in the manual[/url]. In your case it would look something like this: [code=sql] DROP PROCEDURE IF EXISTS `delgroup`; DELIMITER // CREATE PROCEDURE `delgroup`(g_id Int) BEGIN DELETE FROM grouptable WHERE GROUP_ID=g_id; END// DELIMITER ;[/code] [I]Note, the DELIMITER commands and the trailing // …

Member Avatar for Atli
0
102
Member Avatar for veledrom

You don't really need to do anything special on the website itself. You could just create a standard web-form that would allow users to publish their content. Then you could create a client-side app that replicates the form submission, sending the data as a HTTP request to the same URL …

Member Avatar for Atli
0
126
Member Avatar for aptitudedude

You could also try using joins: [code=sql]SELECT f.FileID, f.Name FROM `File` AS f INNER JOIN `File_Keyword` AS fk1 ON f.`FileID` = fk1.`FileID` AND fk1.`Keyword` LIKE '%key1%' INNER JOIN `File_Keyword` AS fk2 ON f.`FileID` = fk2.`FileID` AND fk2.`Keyword` LIKE '%key2%'[/code] There must be a more dynamic way tho. A way to …

Member Avatar for Atli
0
1K
Member Avatar for dan1992

Hey. There is nothing wrong with the syntax itself. How is this supposed to be working? And how is it actually working? Are you getting any errors? *(We like error messages! ;-])* What have you tried to do to fix this? We can only work with what you give us. …

Member Avatar for dan1992
0
186
Member Avatar for brianzet

Hey. You can use the [url=http://php.net/uniqid]uniqid[/url] and [url=http://php.net/mt_rand]mt_rand[/url] functions to generate a unique string of numbers and letters that you can add to the image name. [code=php] $unique = uniqid(mt_rand()); $filename = "user_imgs/{$unique}_{$_FILES['file']['name']}"; $filename1 = "user_imgs/thumbs/{$unique}_small{$_FILES['file']['name']}";[/code]

Member Avatar for Atli
0
178
Member Avatar for nits4u

Hey. The `EOD;` on line 32 is indented, so the string it is supposed to close never ends. You need to remove the white-spaces before it. <?php // This is NOT VALID. Causes a parse error. echo <<<HERE This won't print, because the following delimiter is indented. HERE; ?> <?php …

Member Avatar for nits4u
0
151
Member Avatar for manoj2161

Hey. By "hash table" I assume you mean an associative array? There isn't anything in PHP like the HashTable you find in .Net or Java. [i](There is no need for it, because of PHPs flexible array type.)[/i] Anyhow, you can use the [url=http://php.net/serialize]serialize[/url] and [url=http://php.net/unserialize]unserialize[/url] functions to create a data …

Member Avatar for Atli
0
93
Member Avatar for vaultdweller123

Hey. Check the apache error log. See if it gives you a more detailed error message. Not entirely sure where Apache is located under WampServer, but the file is called [icode]error.log[/icode]. Can't really tell you what is wrong unless you give us a more detailed error message, but the WampServer …

Member Avatar for vaultdweller123
0
74
Member Avatar for sumit007

Hey. Simplest solution, just name all your submit buttons the same and do stuff based on the value. Like, if you have this form: [code=html] <form action="process.php" method="post"> <input type="submit" name="button" value="Add"> <input type="submit" name="button" value="Delete"> </form> [/code] You could do this: [code=php] <?php if($_POST['button'] == "Add") { // Do …

Member Avatar for sumit007
0
1K
Member Avatar for Phil++

Hey. Also, on line #15 you use the [url=http://php.net/mysql_affected_rows]mysql_affected_rows[/url] function, where you should be using the [url=http://php.net/mysql_num_rows]mysql_num_rows[/url] function. The [url=http://php.net/mysql_affected_rows]mysql_affected_rows[/url] function only returns the number or rows affected by INSERT, UPDATE, REPLACE or DELETE queries. SELECT queries have no affect on any rows, and as such, the function doesn't return …

Member Avatar for liamfriel
0
193
Member Avatar for dandixon

[QUOTE=dandixon;1029573]anywhere in the country is fine?[/QUOTE] Which country? This is a international forum ;-)

Member Avatar for dandixon
0
85
Member Avatar for Noodles156

Hey. Line #68. You try to add the variable [icode]$s[/icode] directly into the string, but because it is a single-quoted string, it isn't parsed and reads as an invalid character in the query. Replace it with this and you should be fine. [code=php] and t1.site_no='. $s .' [/code] Alternatively, you …

Member Avatar for Noodles156
0
2K
Member Avatar for zhou1919

[QUOTE=zhou1919;1028169]But it doesn't work. Could you tell me the reasons?[/QUOTE] Hey. Sadly, the fact that the code doesn't work doesn't exactly help us debug it. Nor does posting the part of your PHP code that isn't actually PHP ;-) Please explain why/how it isn't working, what you have tried to …

Member Avatar for zhou1919
-3
394
Member Avatar for lcyew

[QUOTE=Will Gresham;1028110]Use % values for all element width/heights. Use EM for text. Never specify Pixel ot Pt values.[/QUOTE] Yea, in general I would agree to that. Try not to use Pixels or Pt values unless you have a very good reason to do so. It restricts the screen space your …

Member Avatar for Will Gresham
0
79
Member Avatar for itsrahulk

Hey. No offense, but that first code snipped is some ugly looking code :-] Always write your code like the person, who's job it is to debug it, is a mad heavy-weight boxer with an anger-management problem. [i](The first thing I was told when I started learning programming. As it …

Member Avatar for itsrahulk
0
106
Member Avatar for weeon

Hey. Just to check if I understood that correctly: [list=1] [*]You want to allow your users to answer a question form about products they have already bought. [*]And you want them to be able to edit their answers once ever month? [i](I'm fairly sure I got this part wrong xD)[/i] …

Member Avatar for Atli
0
131
Member Avatar for masocha

Hey. I wrote an article about that a while ago. [url=http://bytes.com/topic/php/insights/740327-uploading-files-into-mysql-database-using-php]Check it out[/url].

Member Avatar for Atli
0
68
Member Avatar for expertotech

Hey. How exactly are you adding these images to your HTML? What are the file paths you are using? I can't imagine that this has much to do with the OS itself. More likely something like an extremely over-protective AntiVirus, broken browser plugins, or just a typo in the HTML.

Member Avatar for expertotech
0
529
Member Avatar for sethm

Hey. There are a couple of things in that code that I would like to point out. First, the variables you use the [icode]htmlspecialchars[/icode] function on. What that function does is prepare the fields for being printed into a HTML page, but you aren't actually doing that. You are preparing …

Member Avatar for Atli
0
244
Member Avatar for kayblack

Hey. Could you please post the code you are using, and the error messages? It helps with the debugging process, actually seeing what you are debugging :-]

Member Avatar for Atli
0
184
Member Avatar for Stefano Mtangoo

Hey. If you want to completely deny access to all files in a directory, you can create a .htaccess file containing only [code=htaccess]Deny from all[/code] That will block all access to it. If you just want to block access to some files, you can use a regular expression: [code=htaccess] <Files …

Member Avatar for Atli
0
121
Member Avatar for Andy_nexus

Hey. Just wanted to point out: [code=sql] FROM products AS p, products_description AS pd FROM products AS p, products_description AS pd, manufacturers AS m [/code] Adding multiple tables like that is the same as doing a INNER JOIN without an ON clause. Basically, it creates a massive table of all …

Member Avatar for jomanlk
0
155
Member Avatar for shishtawitch

Hey. Yea, you typically get this warning if you leave out the $, as network18 suggested, or when you forget the quotes around a string. In either case, PHP will assume it is a string who's quotes got left out and use it as such. Ideally you should hunt the …

Member Avatar for Atli
0
156
Member Avatar for maheshks230

[QUOTE=maheshks230;1022010][B]Registeration[/B] hai plz validate the mandatory fields give me jqueryscript to that php code [/QUOTE] Hey. Have you attempted this yourself? If so, what have you tried? I'm happy to help you fix problems in your code, or help you in your search for a way to do something, but …

Member Avatar for network18
-2
177
Member Avatar for shishtawitch

Hey. How are you accessing the page on your PC? (the one that downloads it) Usually when Apache sends the PHP file rather then the output, it is because Apache is not set up to associate .php files with PHP. But if that were the case, it should happen both …

Member Avatar for shishtawitch
0
95
Member Avatar for bufospro

Hey. If you only want to print the first sentence (up until the first period), you can do something like: [code=php] <?php function getFirstSentence($text, $delimiter=".") { return substr($text, 0, stripos($text, $delimiter) + 1); } ?> [/code] Also, you can get rid of the sub-query from your SQL query by doing: …

Member Avatar for Atli
0
92
Member Avatar for chowdarysmk

Hey. First of all, you need to [Validate Your HTML](http://validator.w3.org). It is all mest up. You don't even have a body tag, and a bunch or random attributes that mean nothing. Please fix this first, then post your code back. (Within code tags, please) Also, from what I understand of …

Member Avatar for Atli
-1
92
Member Avatar for fumnimda

Hey. In general, you should never rely on any sort of client-controlled functionality for your sites to work. Like the HTTP_REFERE or cache-control headers. Use server-side methods, like sessions or databases, to do stuff like this if the functionality of your site depends on it. Try just always writing the …

Member Avatar for Atli
0
83
Member Avatar for quickworld

Hey. I'm sorry mate, you are going to have to explain that a LOT better if you want us to be able to provide any sort of useful responses. Try showing us the code you have, and tell us what isn't working and why.

Member Avatar for quickworld
0
107
Member Avatar for seanooi

Hey. You could just use [url=http://php.net/str_replace]str_replace[/url] to insert the <code> tags where you want them. [code=php] <?php $text = <<<HTML <pre>Line 1 Line 2 Line 3</pre> HTML; $old = array("<pre>", "\r", "\n", "</pre>"); $new = array("<pre><code>", "", "</code>\n<code>", "</code></pre>"); echo str_replace($old, $new, $text); ?>[/code] Output: [code=text] <pre><code>Line 1</code> <code>Line 2</code> …

Member Avatar for seanooi
0
153
Member Avatar for dipaq1976

Hey. You could just create a separate table for each filter and update them periodically, either using the [url=http://dev.mysql.com/doc/refman/5.1/en/events.html]Event Scheduler[/url], or just by creating an update script and have your OS execute it. (crontab, Windows Task Scheduler). Personally, I would either create some sort of a master table of filter …

Member Avatar for Atli
0
96
Member Avatar for web3

Hey. Check out [url=http://bytes.com/topic/php/insights/740327-uploading-files-into-mysql-database-using-php]this article[/url].

Member Avatar for Atli
0
106
Member Avatar for sirhcnus

Hey. Could you explain that a little better? What exactly do you want to happen? [I](Examples are always helpful.)[/I]

Member Avatar for Atli
0
52
Member Avatar for fudgealtoid

[QUOTE=fudgealtoid;1017061]I wish to limit uploading to the video files swf pps bmp pps png gif mpg mp3 and wav>[/QUOTE] Not all of those are video files. [I](Or rather; the extensions of known video formats.)[/I] Only SWF and MPG would qualify. Unless you also count animated images, in which case PNG …

Member Avatar for crohole
0
514
Member Avatar for broll911

Hey... again :-] There doesn't appear to be anything wrong with the code itself (syntax-vise, at least) so there must be some hidden character at the start there, like the UTF8 Byte Order Mark (BOM). Try using [url=http://notepad-plus.sourceforge.net/uk/site.htm]Notepad++[/url]. Open the file in that and from the "Format" menu select: "Convert …

Member Avatar for jomanlk
0
381

The End.