86Stang
Members-
Posts
182 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
86Stang's Achievements
Regular Member (3/5)
0
Reputation
-
I can't spend forever on this project so I decided to go with an alternative solution. I decided to do away with the session idea altogether and redo the header redirect to: header ('location: http://www.clientsite.com/display.php?i='.$filename); and use _GET on display.php to get the info I need. Thanks for all the help though!
-
My apologies for being so vague with the code but since this is for a client and it will be his code, I always ask to show it and sometimes they restrict me in what I can show. Here's the bits that covers the DB insertion, variable assignment and redirecting them. Hopefully this will help shed some light. NOTE: $filename and $ip_ad variables are defined early on. // Insert the images' info into the database // mysql_query ("INSERT INTO images SET `url`='$filename', `created`=now(), `ip_ad`='$ip_ad', `views`='0'"); // Grab the info we'll need to post the thumb and codes on display.php // $ii_qry = "SELECT * FROM images WHERE url = '$filename'"; $ii_res = mysql_query($ii_qry); $image_share = mysql_fetch_array($ii_res); $_SESSION['image_url'] = $image_share['url']; // Move them along to the display page // header ('location: http://www.clientsite.com/display.php'); exit;
-
I have session_start() at the very top of both index.php and display.php if that's what you mean. Or are you saying that I should also have it posted right before/after the header redirect? If all the info is lost on a redirect, how is it that it's retaining the info each time after the first try? I'm only losing the session info on the first try.
-
And what is the exact error message you're getting and on which page is said error being shown?
-
Why can't you do it when someone enters a time manually? Is it the formatting of the time they may enter that's throwing you?
-
Also, mjdamato, I did check the source and there is no value in the image path where the session variable should be.
-
On index.php, right after setting the session variable, I use: header ('location: http://www.clientsite.com/display.php'); That's not a dumb question at all, but yes I have session_start(); right after the opening <?php tag.
-
I've built a image hosting script for a client and am seeing an oddity that I am hoping you all can help me with. I've built a page (index.php) where a person can upload an image. I take the image, store it, and put some info on it into a DB. A piece of that info is a url string that points to the image they uploaded. I grab this info and put it into a $_SESSION variable ala: $_SESSION['image_url'] = $image_share['url']; I then scoot them on to the next page (display.php) where it's suppose to show a thumbnail and links to their uploaded image. I use the $_SESSION variable mentioned above to display the thumb/links akin to: <img src="thumbs/<?php echo $_SESSION['image_url'];?>" alt="" /> The Problem... is that the first time an image is uploaded during a session, the image gets uploaded and the info is inserted into the DB just fine but the thumb and links don't show the $_SESSION variable on display.php. If I go back to index.php and try a to upload any image after this, the thumb and links show up just fine. Any idea on why this may be happening?
-
That is SOOO simple! Mucho gracious!!
-
I've got the following two tables: EVENTS ------------------- event_id title info DATES ------------------- id event_date event_id and I'm pulling the data I need via this query: $qry = "SELECT id,event_date,title,events.event_id FROM events INNER JOIN dates ON dates.event_id = events.event_id ORDER BY event_date asc"; Using a WHILE loop off of that query, I can get that query to generate something akin to: 2010-02-07 Title 1 2010-02-09 Title 2 2010-02-09 Title 3 2010-02-09 Title 4 2010-02-11 Title 5 2010-02-12 Title 6 but what I need is a loop that will show each date only once with the info below it, like: 2010-02-07 Title 1 2010-02-09 Title 2 Title 3 Title 4 2010-02-11 Title 5 2010-02-12 Title 6 I'm sure this is a quick kill for a lot of you out there so I'm hoping a kind soul can help me out.
-
How do you build a query from a number of search fields
86Stang replied to 86Stang's topic in PHP Coding Help
That's originally where I put it but it keeps throwing a syntax error when all fields are blank so I moved it outside the if. -
How do you build a query from a number of search fields
86Stang replied to 86Stang's topic in PHP Coding Help
I think that was it. This seems to be working as I want it to: $where = ''; if (isset($keyword_search) || isset($category_search)) { $where_clause = array(); if (isset($keyword_search) && !empty($keyword_search)) { $where_clause[] = "(title LIKE '%$keyword_search%' OR info LIKE '%$keyword_search%')"; } if (isset($category_search) && !empty($category_search)) { $where_clause[] = "event_type LIKE '%$category_search%'"; } $where = implode(' AND ', $where_clause); } if ($where <> '') { $where_param = "WHERE "; } $qry = "SELECT * FROM test_events {$where_param} {$where}"; $result = mysql_query($qry) or die("Doh!"); If there's a better way to do that, feel free to enlighten me!! -
How do you build a query from a number of search fields
86Stang replied to 86Stang's topic in PHP Coding Help
That works for a blank search (nothing in either field but when I put something in one of the fields, such as 'test' in the category field, I get the same syntax error: category LIKE '%test%'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKE '%test%'' at line 1 Could this be because it's not actually inserting the word WHERE in there anywhere? -
How do you build a query from a number of search fields
86Stang replied to 86Stang's topic in PHP Coding Help
Thanks so much for the help! It's throwing this error though: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(title LIKE '%test%' OR info LIKE '%test%') AND category LIKE '%%'' at line 1 Any thoughts? -
I've got a keyword, category, start_date and end_date fields that I want the user to pick from but I'm having a hell of a time putting it into a 'master query' based on what they've entered. I'm trying something like this: if (isset($keyword_search)) { $keyword_qry = "WHERE title LIKE '%$keyword_search%' OR info LIKE '%$keyword_search%'"; } else { $keyword_qry = ""; } if (isset($category_search)) { $category_qry = "WHERE category LIKE '%$category_search%'"; } else { $category_qry = ""; } $qry = "SELECT * FROM table " . $keyword_qry . $category_qry; $result = mysql_query($qry) or die("Doh!"); but I know this isn't right because I have multiple WHEREs. Any help would be greatly appreciated!