139 Posted Topics
Re: Add this to the start of your code: [CODE]echo "Post:".print_r($_POST,true); echo "Get: ".print_r($_GET,true); [/CODE] This should give you an idea of what Flash is passing to your script. | |
Re: Assuming that date_visit is of date or datetime type you can use the BETWEEN operator in mysql. [CODE=sql]... WHERE date_visit BETWEEN '$date_start' AND '$date_end' ...[/CODE] | |
Re: If you don't want users to be able to change a value, don't give it to them in a form. Even a hidden input field can be hacked. If filling out the form will always award the user 10 points and 10 coins, for example, then do that in the … ![]() | |
Re: The examples above don't make mathematical sense to me as @niranga also points out. The average total in your example is $77.50. Anybody who spend more than that is owed money and anybody who spent less owes money to the others. Is that the gist of what you are trying … ![]() | |
Re: @asif49 means that MySQL's full-text index feature is designed to accomodate natural language searches that are much more powerful than a simple LIKE statement with wildcards. Check out the MySQL manual for details on how to use them. Here's the manual entry for MySQL 5.0: [url]http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html[/url] | |
Re: @momo219 is correct. Don't use LIKE when comparing for a number. LIKE works with strings and the '%' is a wildcard that matches ANY CHARACTER(S). | |
Re: I tried the statement with a string and it works fine using the format you indicated. Perhaps the file isn't being read in properly? This works, for example: [CODE=php] <?php $filecont ='Name: Some Name 1 Email: some@email.com Name: Some Name 2 Email: some@email.com Name: Some Name 3 Email: some@email.com Name: … | |
Re: You can solve this using CSS. Advanced CSS Printing - Using CSS Page Breaks : [url]http://davidwalsh.name/css-page-breaks[/url] A List Apart - Going to Print: [url]http://www.alistapart.com/articles/goingtoprint/[/url] | |
Re: It sort of depends on what jupiter.php actually does and how it would be used. You could access it remotely using an html iframe element. | |
Re: On line 85 of your code, you are using [I]$id_album[/I] which occurs AFTER the initial [I]while[/I] loop, so yes, you should only get the last value it was assigned while in the loop. The first [I]while[/I] is terminated on line 55. | |
Re: Do your results need to be returned as columns/rows like that? It is much easier to return the details as rows and columns instead (also, more legible in my experience.) [CODE][U][B]id | data[/U][/B] 10 | k 9 | a 8 | s [/CODE] | |
Re: There is no MOVE in sql. 1. Select the request from the Requests table. 2. Insert a row in the Friends table with the new friend. 3. Insert another row with the keys reversed (friend_id is also a friend to user_id) 4. Delete the friend request entry in the Requests … | |
Re: Clients and Work types form a "1 to many" relationship (often 1:n.) This means that for every client (stored in one record) there needs to be 1 or more related worktypes for that client. Usually this is solved with three tables. Two tables will store the data and the third … | |
Re: Take a look at array_intersect () php.net/manual/en/function.array-intersect.php That function returns an array of elements that match in two (or more) arrays. ![]() | |
![]() | Re: As you are clearly very new to php, I'd recommend you read up on [I]arrays[/I] and [I]loops[/I]. ![]() |
Re: [I](The previous two posts came in while I was editing this, but maybe it will still be useful to you.)[/I] @jacksantho, Your code is looking better but you haven't integrated what @almostbob demonstrated. You must echo out some html, [ICODE]selected="selected"[/ICODE] for the option that is selected for the entry. What … | |
Re: When rewriting, assume the url is already in the form you want and then rewrite it to what the web server and php would expect. For example: [CODE=apache] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(cms|admin|client|public)/(.*) $1/index.php/$2 [PT,L] # Allow any files or directories that exist to be displayed directly … | |
Re: That dash is being interpreted as a minus sign. Try wrapping the table name in back quotes: [CODE=sql] SELECT * FROM `ue-userfile` WHERE id='$imageid' AND userid='$userid' [/CODE] | |
Re: What version of php are you using on the new server? What version did it run on before? | |
Re: You may be exceeding the maximum file size limit on the upload (not clear from the question if you are doing this.) Check out [url]http://www.php.net/manual/en/features.file-upload.common-pitfalls.php[/url] | |
Re: Debug by adding the line [code] echo mysql_error();[/code] to see what you get. | |
Re: The selected dates will be in $_POST['date'] as an array of those dates selected. If no dates were checked, $_POST['date'] won't exist! So don't just assume an array will be there. You can store the current month and year in hidden fields in your form. After submission, delete ALL entries … | |
Re: If you don't know the path to your document root you can use [ICODE]$_SERVER['DOCUMENT_ROOT'][/ICODE] [CODE=php] $path = $_SERVER['DOCUMENT_ROOT']."/logs/".date("Y")."/".date("m"); [/CODE] NOTE: DOCUMENT_ROOT is blank on an IIS (Windows) web server. | |
Re: I'd recommend you read up on PRIMARY KEYS for databases and see how they are used. It is rare and very inconvenient to do updates based on strings like that. What if two orders contain the same set of checks? You will update MULTIPLE orders. Also, where is the value … | |
Re: $_post should be $_POST. [I]er...unless there is another, preceding script that is creating $_post as a filtered, cleaned up version of $_POST.[/I] If not, you should filter the form info to prevent potential massive spam abuse. | |
Re: A slight correction to Zero13's code. Line 9 will always evaluate to true (except for year 0.) [ICODE]$selected = ($selectedYear == $yr_nam ) ? ' selected="selected"' : "";[/ICODE] | |
Re: I like: [I]The Definitive Guide to Apache mod_rewrite[/I] by Rich Bowen Apress Good coverage on the subject and a whole chapter dedicated (early on) on when NOT to use mod_rewrite because there are other Apache modules that do the task better. | |
Re: Haven't done this in a while but I think you can use count() with HAVING: [CODE=SQL] SELECT a.mem_id, count(b.mem_id) as trackCount FROM members a LEFT JOIN subs_track b USING(mem_id) WHERE a.mem_id = b.mem_id AND b.status = 'A' AND a.mem_status = 'A' GROUP BY a.mem_id HAVING trackCount = 0 ORDER BY … | |
Re: @designalex Sessions are identified by a cookie that is sent to the browser when a session is first initialized. The session_id contains a key that points to the right set of session data. If a user has disabled cookies, this becomes problematic but a session id can also be passed … ![]() | |
Re: I get a broken link for the source code. If you already have a connection established to the database, your class doesn't need to create another one when using the mysql_* functions. The connection, once made exists in any scope like a superglobal. | |
Re: I notice your event table doesn't have a numeric primary key; instead eventid is a date. If you add a primary key to this table (rename current eventid to eventDate or something and add an 'id' column that is primary key, auto_increment.) Having a numeric primary key makes joining tables … | |
Re: [CODE=sql] SELECT * FROM pages WHERE subjectid = '{$sid}' AND showing='1' ORDER BY pos ASC [/CODE] That will let you filter for just pages keyed to a supplied subject where $sid is the subject id. | |
Re: You can solve this with a series of if statements by working backwards from greatest amount of time to least amount of time. Have a variable store how much time is remaining to be added to the total price. Pseudocode: [CODE] tempTime = totalTime price = 0 if tempTime is … | |
Re: Each of your include files is not a complete document, they are snippets/sections of a document that will be included in index.php. Therefore, those other files do not need doctype, html, head, and body tags. If you view the source of your current output, you'll find these are being repeated … | |
Re: You are sending the email addresses as the values of the selected entry. So, you can just loop over the results: [CODE=php] <?php if(isset($_POST['emails']) && is_array($_POST['emails']) { foreach($_POST['emails'] as $email) { mail($email, $message); } } else { echo "No email addresses to send to!"; } ?> [/CODE] If the code … | |
Re: It actually does work but not very well. You have to click on the Gallery link to see your results somewhere in the gallery. It converts an image into ASCII art versions of the supplied picture. Unfortunately, I don't really know much about the algorithm that goes behind converting an … | |
Re: Are you coding for a server that only has PHP 4.x or lower. Use of function like [URL="http://php.net/manual/en/function.session-register.php"]session_register()[/URL] have been deprecated in favor of using the $_SESSION super-global. Also, add a die() statement after your redirects. This prevents php from continuing to execute the script after the header is sent. … | |
Re: Because in line 8 you are [I]casting[/I] $e as an array. ![]() | |
Re: Returning an array makes most sense for a 'getter' method. You can also create class properties to hold the information: [CODE=php] class Model_Group { public $groups = array(); public function getGroupData() { // Check if property was already initialized earlier. if(!empty($this->groups)) return $this->groups; $return_value = array(); $result = mysql_query('SELECT * … | |
Re: I'm not at a computer with php installed but I have a hunch. Line 30 includes [icode]$total_rows/$per_page[/icode]. Both of those variables are integers so the rules of integer math are in play -- the result will be an integer, not a float. ceil() is left with nothing to round up. … ![]() | |
Re: Not at a computer where I can test your code. It would be easier (and the typical way) to key on the customer's id instead of email address. The id is, by necessity, a unique column and using the intval() function you can guarantee you have an integer value. | |
Re: So what is the value of $value and where would it come from? Is this a global coming from another file that includes this one? ![]() | |
Re: [CODE] ... FROM friends RIGHT JOIN feeds ON friends.friendid=feeds.sender_id OR feeds.sender_id = '$logged_id' ... [/CODE] (I haven't tested this, not at my computer.) If you right join to the feeds (a feed without a friend that still satisfies the join condition) and store your user events as feed entries this … | |
Re: Test for the condition you want to eliminate in your loop. [CODE=php] for($i=0;$i<$limit;$i++){ if(intval($cantitate[$i]) < 1) continue; // skip to next entry in the array; $queryi="insert into livrari_luni ... [/CODE] | |
Re: If that first blank line is actually in your source file, that is the culprit. There can be NO OUTPUT before setting a cookie or session (which also sets a cookie.) ![]() | |
Re: I don't see where the photo form field is being generated (I just see code at top where you test it.) If photo is a checkbox set or a multi-select, name the form field as 'photo[]'; [ICODE]<select name="photo[]" multiple="multiple" ...> [[/ICODE] You can then treat $_POST['photo'] as an array. Just … | |
Re: str_replace is great for replacements but you have a pattern to find and section of that pattern you want to reuse. In your example, you insert the ENTIRE original string back into each link. YOu also lose the name for description of the link. A [B]regular expression[/B] does the job … | |
Re: Try this: [URL="http://tinyurl.com/3xok2g6"]Drag and Drop with JQuery, PHP[/URL] | |
Re: I agree with Shanti Chepuru about the logic. Also, not clear why you call `$this->getDepartmentCode()` in the query building statement when that information is being passed in as a parameter. Is that method returning the right piece of data? | |
Re: There is an active discussion about that on the [URL="http://php.net/manual/en/function.time.php"]time() page of the php manual[/URL] with several code implementations. |
The End.