I'm not sure if this should be in this forum but I figured it was a good starting place. I am creating a database that, among other things, allows users to input a store's location (e.g. name, address, etc). Once a store has been added, there is an ability to go into a single store's "page" to view all of it's information including name, contact info, reviews, comments, etc. What I would really like is the ability for a Google Map to generate automatically when the page loads with the store's name and address listed (and pulled up in the …

Member Avatar
Member Avatar
+0 forum 6

So I'm getting this error message from MYSQL when I load this page. The first message is what's it displaying on the PHP code, the 2nd message is the result of mysql_error(). [ICODE](1) Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in [I][redacted][/I] on line 19 (2) 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 'AND CigarID = 334 AND DATE_SUB(CURDATE(),INTERVAL 15 DAY) <= DateAdded' at line 1[/ICODE] When I run the query in mySQL it returns a result, as it …

Member Avatar
Member Avatar
+0 forum 4

I am trying to secure a folder within my site by forcing an HTTPS connection when anything in this folder is run (the folder contains a series of scripts that process registrations, password resets, etc). What's the easiest way to accomplish this?

Member Avatar
Member Avatar
+0 forum 1

I have a javascript login box on my site ([url]www.cigardig.com[/url]) that a user can click on and login on any page. The way I would like it to work is that once a user hits submit, they are redirected back to the page they logged in on. So, for example, if I login in Page 1, I want to be redirected back to Page 1 once the login is successful. I have it implemented now; however, I've read that it's not a reliable method since some browsers and/or firewall software blocks the sending of this variable. Honestly though, I thought …

Member Avatar
Member Avatar
+0 forum 5

I'm trying to figure out the best way to accomplish the computation of weighted averages for my site. Here's the PHP that pulls down the results -- [CODE]$SQL = "SELECT a.*, b.CName, c.Description FROM humidor a LEFT JOIN cigar b on a.CigarID = b.CigarID LEFT JOIN cd_manufacturer c on b.Manufacturer = c.Code WHERE UserID = $UserID AND DisplayCD = 1 AND Quantity > 0 GROUP BY CigarID ORDER BY c.Description, b.CName ASC"; $Result = mysql_query($SQL); }[/CODE] Then it goes into a WHILE loop -- [CODE]while ($row = mysql_fetch_row($Result)) { $convertpurchasedate = strtotime($row[3]); echo("<tr style=\"vertical-align:middle\"><td><a href=\"../cigar?id=$row[2]\">$row[12] $row[11]</a></td><td>".date('F d, Y', $convertpurchasedate)."</td><td>$row[4]</td><td>$ $row[5]</td> …

Member Avatar
Member Avatar
+0 forum 1

I am trying to figure out the best way to figure out "age" of a particular item. I currently have fields in a mySQL databases that are stored as datetime formats and I need to display (in PHP) the relative age of those dates in terms of years, months, and day. Any suggestions?

Member Avatar
Member Avatar
+0 forum 2

So I am in the process of putting some finishing touches on a new section of my website which allows users to keep track of their cigars in an online inventory (or humidor) type system. I'm kind of stuck; however, on what the best way to capture and process data when being displayed. So right now, a user adds a record for a particular cigar, a new row is created with information relevant to that entry (price per cigar, date purchased, quantity purchased, and the particular cigar purchased). So what ends up happening is let's say I purchased the same …

Member Avatar
Member Avatar
+0 forum 3

I'm trying to figure out the best way to replace apostrophes in various user input which is all formatted first using [B]mysql_real_escape_string[/B]. Of course this replacement should take place after all input has been sanitized and anything funny removed. :) Any help would be awesome!

Member Avatar
Member Avatar
+0 forum 9

For my new code that I'm developing, I have a text box where a user will type in a date as follows: [B]MM/DD/YYYY (e.g. 05/19/2011)[/B] This date then needs to be converted and inserted into a date/time field on a mySQL database. I've been trying to play around with this a bit though and have been having trouble getting it to register on the database. Any idea on how best to format this field and insert it into the DB? Also, one option I had thought about is maybe using a javascript dropdown calendar or something, any good recommendations? Thanks!

Member Avatar
Member Avatar
+0 forum 6

I am in the process of trying to customize my site's URLs and I'm running into an issue with my htaccess file, specifically the newest one I am trying to add. Here's the file -- [CODE]RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [L,QSA] RewriteRule ^/retail/(.*)$ retail.php?id=$1[/CODE] The first condition removes the extensions from the site so that I can go to index instead of index.php. This is working great with no issues. It's the next one down that's causing problems. it's basically not working at all. So when I visit my site and go to domain.com/retail/100, …

Member Avatar
+0 forum 0

Any chance the wonderful people here on daniweb could help me again with a loop? My apologies, loops are not my thing :| Basically what I'm trying to do is add a condition where on the last tweet (that is where the loop = $nooftweets), that tweet gets a different <span> class. Here's the function -- [CODE]function get_tweets($twitter_id, $nooftweets=3, $dateFormat="m/d/y", $includeReplies=false, $dateTimeZone="America/New_York", $beforeTweetsHtml="<ul>", $tweetStartHtml="<li><p>", $tweetMiddleHtml="&nbsp;&nbsp;<small>", $tweetEndHtml="</small></p></li>", $afterTweetsHtml="</ul>") { date_default_timezone_set($dateTimeZone); if ( $twitter_xml = twitter_status($twitter_id) ) { $result = $beforeTweetsHtml; foreach ($twitter_xml->status as $key => $status) { if ($includeReplies == true | substr_count($status->text,"@") == 0 | strpos($status->text,"@") != 0) { $message …

Member Avatar
Member Avatar
+0 forum 1

So I'm trying to create one central file for my navigation which is used across my site; however, some of the pages are in different directories. So, for example , let's say I have the following directories -- domain.com/ domain.com/dir1/ domain.com/dir2/ If I wanted to use the same include between all three of these options, is there a way for it to figure out how many "../" need to be included based on where it is?

Member Avatar
Member Avatar
+0 forum 11

I've been having a reoccurring issue with my VPS since I moved to a new company and I'm trying to figure out what the issue is. There are a few different things going on (I believe they are all connected) -- [LIST=1] [*]When you visit a page that doesn't exist, instead of throwing a 404 error, it shows a page which looks like the index.php file in the respective directory you are in. [*]The bigger issue, is that when I'm uploading new files through FTP, they are successful but when I visit the page in the browser, nothing has changed. …

Member Avatar
Member Avatar
+0 forum 2

So I'm trying to figure out the best way (if possible) to combine these two stored procedures. Basically these are the same, the only difference is one is looking at a 'Spot' table, the other is looking at the 'Retail' table. However, in both cases the column count is the same and most of the column names are even the same (with the exception of RetailID vs SpotID and RName vs SName). Any help would be much appreciated! [CODE]/* Procedure structure for procedure `EventsNear1` */ /*!50003 DROP PROCEDURE IF EXISTS `EventsNear1` */; DELIMITER $$ /*!50003 CREATE DEFINER=`root`@`localhost` PROCEDURE `EventsNear1`(Lat1 float,Long1 …

Member Avatar
+0 forum 0

So I've developed some code to pull the latest 8 images from my flickr feed; however, I'm having trouble with figuring out how to do what I'm trying to do. Essentially, I need each 4th image to have a different <div> class (this helps with margins and what not). Any suggestions on how to get this working? Here's the code I have now which displays the 8 images in a row [CODE] foreach($images->photos->photo as $photo) { echo '<div><a href="http://flickr.com/photos/' . $flickr->username . '/' . $photo->attributes()->id . '"><img src="http://farm' . $photo->attributes()->farm . '.static.flickr.com/' . $photo->attributes()->server . '/' . $photo->attributes()->id . '_' …

Member Avatar
Member Avatar
+0 forum 3

I am having a problem with the Google Maps API because of conflicting names in my site's CSS. From what I've been able to find, Google Maps uses the name "container" in their code as does my site, so when the map loads it has this nasty white shadow behind it. Is there a way to change the name of the <div> class for this one <div> or does anyone else have any other suggestions (outside of changing thousands of tags!) Any help you all could provide would be much appreciated! :|

Member Avatar
Member Avatar
+0 forum 5

I’ve created a dynamic page ([I]page.php[/I]) who’s content changes based on the incoming link, specifically by calling a GET on the ID in the URL. So, for example, someone visits [I][url]www.domain.com/page.php?id=310[/url][/I] and the content on the page changes queries the database and returns results for item 310. I’m in the process of redesigning a few things and I’m trying to figure out whether there is a way instead to make these URLs more “friendly.” So, instead of it being [I]page.php?id=310[/I] is there a way to create an alias (for lack of a better term) to make the URL more representative …

Member Avatar
Member Avatar
+0 forum 4

I recently moved a script I created for Google Maps over from my development site and I changed the information in the mysqli line and now I'm recieving an error mesage -- any idea what's going on here? Here's the error message: [CODE]Warning: mysqli::mysqli() [mysqli.mysqli]: (28000/1045): Access denied for user 'Username'@'localhost' (using password: YES) in /home/cigardig/public_html/XXXX.php on line 259[/CODE] Here's the relevant code: [CODE]$mysqli = new mysqli( "localhost", "[I]Username[/I]", "[I]Password[/I]", "[I]DB Name[/I]" );[/CODE] I also don't know if this has anything to do with it but this script is using stored functions which grant as follows: [CODE]/*!50003 CREATE DEFINER=`root`@`localhost` FUNCTION …

Member Avatar
Member Avatar
+0 forum 10

I want to add something to the script below that, prior to insert, check to see if the $CigarID already exists for the $UserID. If so, I want it to do an update and increase the $Quantity by whatever the user inputs. If the value doesn't exist, then insert the full statement. What's the best way to handle this in PHP?? [CODE]<?PHP session_start(); //Open Database include 'dbconnection.php'; //Create Post Variables $CigarID = mysql_real_escape_string($_POST['Cigar']); $Quantity = mysql_real_escape_string($_POST['Quantity']); $DatePurchased = mysql_real_escape_string($_POST['DatePurchased']); $DatePurchasedFormatted = date("m/d/Y", strtotime($DatePurchased)); $PricePaid = mysql_real_escape_string($_POST['PricePaid']); $UserID = $_SESSION["UserID"]; //Create SQL Statement Variable $SQL = "INSERT INTO humidor VALUES (NULL,'$UserID','$CigarID', …

Member Avatar
Member Avatar
+0 forum 6

Let's say I have the majority of my site in the 'root' WWW directory on the server, such as: [url]www.domain.com/index.php[/url] My current header & footer files are set to respect this configuration and work beautifully. I am now in the process however of creating a new directory which will be used in the main site, such as: [url]www.domain.com/newfolder/index.php[/url] What would be the easiest way to make the header and footer file work in both directories instead of having to create a new header/footer file for each directory? Perhaps another way to say this, is there a way to append a …

Member Avatar
Member Avatar
+0 forum 4

So I'm trying to figure out the best way to go about setting up an image upload system for my site. Basically we have, let's say, 2,000 stores in our database currently (that number expands by the day). I want users to be able to upload images for each store so, in theory, it would be possible for a single store to have multiple images. Based on my research, it appears that storing paths in the DB as opposed to storing the images directly in the DB would be better since we are talking about a large number of images …

Member Avatar
Member Avatar
+0 forum 1

So this may be a bit of a stupid question but I'm not sure I'm understanding this completely. Currently, my site uses sessions to store username and a UserID across the site; however, the session lacks the ability to remember a user should they close the browser. I want to build an option that would allow a user, on login, to click "remember me" that will save there information for a specified period of time. My question is, how would this work? So when the login page is processed, if a user checks the box I will do a setcookie …

Member Avatar
Member Avatar
+0 forum 1

I am trying to write a script for my site that will check if a user has submitted a review for a particular cigar in the past [B]30 days[/B] and if they have, prevent them from creating a new review. I am trying to figure out the code but I'm getting stuck on how to calculate the 30 days from today's date? Any help? Here's what I have now - [CODE]<?PHP $SQL = "SELECT max(DateAdded) from reviews_cigar WHERE $UserID = UserID AND $CigarID = CigarID"; $Result = mysql_query($SQL) If ($Result < ?????) { echo "Sorry but you've submitted a review …

Member Avatar
Member Avatar
+0 forum 6

I keep getting the following error whenever I try to run this query on my "spot" table: [CODE]#1054 - Unknown column 'a.Longitude' in 'field list'[/CODE] The weird thing is though that the column DOES in fact exist, is spelled the same way, and has thousands of rows of data. Even weirder, a similar query runs on my "retail" table and has no problem getting the longitude, the only difference is 3 column names change (longitude and latitude stay the same). I also checked the datatypes for both tables and once again, exactly the same. If it matters, my mySQL version …

Member Avatar
Member Avatar
+0 forum 4

Ok, I currently have three different pages in play here. [LIST=1] [*]Cigar.php - This is the individual cigar page, dynamically generated based on a GET Value [*]Cigarreview.php - This is where a user goes to review a cigar. It has a drop down menu that pulls from the DB and based on which one the user selects, this value is passed to the #3 in the form of a POST value [*]ProcessCigarReview - The script that actually processes the review, updates the db, works voodoo magic, etc [/LIST] I would like to add an option on #1 to "Rate this …

Member Avatar
Member Avatar
+0 forum 8

I have a large amount of items stored in my DB (around 3,000 total and growing) and I have a list of them sorted alphabetically that displays on a page. I was interested; however, in having the items display in blocks instead that look something like: [INDENT][B]A[/B] [All items that start with the letter A] [B]B[/B] [All items that start with the letter B] [B]C[/B] [All items that start with the letter C][/INDENT] How would I go about doing this in PHP or is it even possible?

Member Avatar
Member Avatar
+0 forum 10

I am in the process of trying to create a search option for my database; however, I need the user to be able to submit one search which looks at three tables in the database. I'm using the following right now and it's working for each individual one (I have to comment out two for it to work). So I have two questions: (1) What's the best way to get a full search of these columns in the respective tables? (2) As you can see, I generate a link at the bottom that echo's the results. The problem is that …

Member Avatar
Member Avatar
+0 forum 6

I have a question regarding Google Maps integration I am planning for my site. Right now I have a list of approximately 5,000 addresses (Street Address, City, and Zip Code). I would like to add two columns to the table these address are stored in for Longitude & Latitude so that when a user visits a particular location's page, a Google map can be served up with the chosen location being centered on the map with a marker. I've tried reading the API; however, it doesn't seem to me there is a way to submit a request of the address …

Member Avatar
Member Avatar
+0 forum 4

My site is broken into three different categories (which are stored on 3 separate tables) and I am looking at creating a functionality to let a user upload photos. Ideally, I would like the following to happen: [LIST=1][*]A user is viewing a single retail store on the site, for example and clicks "upload photos" [*]The user is prompted with a box that allows them to upload multiple photos simultaneously. These photos need to be "tagged" or associated with this particular store so they can be displayed later (more on that in a bit) [*]On upload, the files are renamed and …

Member Avatar
Member Avatar
+0 forum 1

I think I'm having a blonde moment because I can't seem to get the bit of CSS/HTML working. When I make changes to the code such as cellpadding and cellspacing in the table attribute, it doesn't do anything to the form itself. I've even tried changing something like BGCOLOR and nothing happens (I even added a second table thinking it may have had something to do with the form tags but no luck there either). I think it has something to do with inheritance but I can't seem to figure it out -- any ideas? [B]HTML Page:[/B] [CODE]<div class="container"> <div …

Member Avatar
Member Avatar
+0 forum 13

The End.