Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Your value clauses are bogus. Take the dots out.
  2. I have limited ajax experience, but I don't think you can do a post. You must do a get, passing your dropdown value as an argument of your url. Also - you can't do an echo in the background script since that is how you return answers to the caller. You can only do debugging type echos by running the script standalone until you are done developing it. At least that's how I do it.
  3. href='nextpage.php?place=America' and <? $_GET['place'] ?>
  4. Please explain better
  5. change your code to create the query string into a variable and then echo that var out before running the query. Let's see what you get.
  6. You should be checking the results of your queries after running each one to be sure it ran ok. YOu should also be checking that you have valid input. I think the message is telling you that you have an empty value and therefore your query is bad.
  7. I think the usual process is separated and not all combined into one statement. At least I've not seen it that way previously, but then I'm not a real user of prepared statements. That said I usually see this done in steps: a) assign a query string to a variable with your arguments in it b) prepare the query using the variable from a) c) get your values for the arguments and bind them to the prepared statement variable d) execute the query statement Makes it easier to modify the query and the variables should you need to. Not to mention decipher it. Just my $.02
  8. Look up the use of the heredocs structure for assembling your html/var code block. Much better than including your vars in <? ?> php tags, which is what you are missing here. ex. $message=<<<heredocs <html> <body> <p>How you have been effected: $effected</p> <p>URL: $url</p> <p>Company: $company</p> <p>Position: $position</p> <p>Email: $email</p> <p>Alternative Email: $alt_email</p> <p>Phone: $phone</p> <p>Address: $address</p> <p>City: $city</p> <p>Zip: $zip</p> <p>Country: $country</p> <p>Website: $website</p> <p>Signature: $signature</p> </body> </html> heredocs; // in column 1!!!!
  9. Product table: I would think that the retailers are responsible for ALL of the product details - their retailer_id, name, desc, photo, brand AND price. This table would also have a unique id that you assign (std_id?) to each and every product record. Think about a status code to mark products as active or not, cause you never want to delete any. Order_table: Your customers would create records here by ordering something. These records would have their customer id (assigned by you when they sign up), the order date, the std_id of the product they want and the price at the time of the order (from the above table). Customer_table: You then have a table to track customer data such as customer_id (assigned by you), name, address, etc. Vendor_table: a table to hold the retailer's info such retailer_id (assigned by you), name, address and such. The retailers can modify all this data except for the retailer_id. This would be a proper normalized structure where nothing is duplicated except for the keys that tie the tables together. Hope this clarifies things and helps you to re-organize your structures to make your updating easier.
  10. So - did you try what I suggested in my last post? That should work if you do exactly what I showed you. IF not post the 'new' viewstats function so I can see it. And - did you change getwebstats to return something?
  11. I wanted to see where you implemented the suggestion to use str_replace. You don't need that other software to do what you want to do.
  12. ok - gotta go. If you are calling getwebstats ONCE before calling viewstats then my previous example code would work with only the one foreach loop. Just process $data as I originally did since you don't need to put the array of getwebstats into another array just to view it. Period. As for the stuff you said to ignore - how about temporarily creating a viewstats function that just outputs the $data returned from getwebstats and see if you're getting any closer. You are doing some very serious array manipulation here and I'm not sure you understand arrays that well yet. Your references to $data['results'] bother me since they have never existed, yet you keep using that reference.
  13. How many times do you call getwebstats before calling viewstats? That's the big question.
  14. Can we see your code where you do the str_replace?
  15. I also don't see what these are: // Populates fields from array (from "www_globalconfig" table) $results['globalconfig'] = cmsSettings::getSiteSettingsByID( ADMIN_PANEL_SETTINGS ); $results['pageTitle'] = "view website stats | " . $results['globalconfig']->wwwTitle; $results['pageMetaTags'] = $results['globalconfig']->wwwMetaTags; $results['pageFaviconURL'] = $results['globalconfig']->wwwFaviconURL; $results['pageCSSURL'] = $results['globalconfig']->wwwCSSURL; $results['pageJSURL'] = $results['globalconfig']->wwwJSURL; $results['bannerTitle'] = $results['globalconfig']->wwwBanner; This looks like you are referencing objects. Is 'getSiteSettingsByID' returning an object to you? Your comment says you are getting fields from an array. Perhaps you want an element of the 'globalconfig' array? That would be $results['globalconfig']['wwwMetaTags'].
  16. I looked at view stats. Don't understand you. First we're storing $data into $results. Then you start adding elements to $results with names. Why are we storing the stats as an array ($data) in $results if you are using $results for these other things? That must be why you were referencing $results['listwebstats']. That now makes sense. Of course you were storing the wrong thing in that element before ($data['results']).
  17. Ok - I looked at the function getwebstats. You are not returning anything from it. End of story.
  18. Good luck. Be sure to post the new code if you are still having a problem.
  19. What I provided you will work to display the results from one call to getwebstats. If you want to do multiple calls to getwebstats and save each of their results do: $data = cmsStats::getWebStats(); $results[] = $data; This will give you an array ($results) containing each of the arrays that are returned by each call to getwebstats. To process: simply add a foreach to the one I already gave you: foreach ($results as $data) { echo "<ul class='chartlist'>"; foreach ( $data as $row) { list($title,$url) = explode("|",$row['visitedPageTitle']); $cnt = $row['clickCount']; echo "<li><a href='$url'>$title</a><span class='count'>$cnt</span><span class='index' style='width: 42%'>(42%)</span></li>"; } echo "</ul>"; } Not sure where you want the <ul> tags. As it is above you'll get a list for each call to getwebstats.
  20. oops - left out a paren in above. S/B: list($title,$url) = explode("|",$row['visitedPageTitle']);
  21. I see the problem with the index. I'm guessing that you pointed me to the wrong error line and that the error is the line above $row['visitedURL'] which is a value stored in $row['visitedPageTitle']; From your intial dump of the array of results from getwebstats: Array ( [visitedPageTitle] => about me | sampledomain.net [totalClicks] => 2 ) I see that the [visitedPageTitle] element has two things separated by |. So instead of doing: $url = $row['visitedURL']; $title = $row['visitedPageTitle']; change it to this: list ($title,$url) = explode("|",$row['visitedPageTitle'];
  22. I don't see why you are doing this: $data = cmsStats::getWebStats(); $results['ListWebStats'] = $data['results']; You're taking the webstats data which is a 2-dimensional array and placing one piece of it in one element of an array. In fact there is nothing named $data['results'] that I can see, so I don't know what you saving. You should be getting an error on that line. Maybe you have other code that is changing what you have shown me so far. If that is so, then I can't be of much help here. But from what I have seen here is what getwebstats returns to you in $data: ($data[0]) array with 2 elements named 'visitedPageTitle' and 'totalClicks' ($data[1]) array with 2 elements named 'visitedPageTitle' and totalClicks' etc etc. etc. Then you are trying to copy something called "$data['results']" which I don't see here. You actually showed us a dump of the viewwebstats output - I didn't see anything named 'results' in there. My code was handling the data as I have been shown it. If there is something that has massaged it, obviously my code wouldn't work.
  23. check if email is empty before processing? if ($email == '') { echo "you didn't provide a message"; echo "<br><a href='" . $_SERVER['PHP_SELF'] . "'>Try Again</a>"; exit(); }
  24. That means you have the wrong column name from the query that produced it. Could be an upper/lower case issue or just a misspelling.
  25. Tell me who you deal with. Are you creating a catalog of products from suppliers and then gathering data on who buys them from you?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.