Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. I may be wrong here but I think you want this: $data = cmsStats::getWebStats(); // Calling cmsStats class::getWebStats function echo "<ul class='chartlist'>"; foreach ( $data as $row) { $url = $row['visitedURL']; $title = $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>"; You already have an array of arrays returned in $data from your call to getwebstats. Simply loop thru $data, getting one row and echo the values from that row into a list element. Note I removed the ul tags to outside of the loop, otherwise you would be creating a whole bunch of unordered lists still.
  2. I dont' know what prod_id buys you in the tbl_product table std_id is the key to all of your products, whether they are the same (with different vendors) or different. So that table is pretty much good right now. Your table tbl_product is confusing. What does the user have to do with the product-cat-subcat & price data? Also - are cat/subcat/price something that pertains to the buyer (/user?) or to the product? If the product, then I suggest that cat/subcat be stored in the other table.
  3. First - I have been very supportive of your issue and we have been having a long helpful dialog. But your latest sample is too much for me to help you with. I'm afraid if I get into it, I'll say something wrong and I don't want to do that. Maybe someone else can pick up and help you correct this latest code sample. I will say that you should be using some kind of IDE that can help you out with syntax checking and code references, since right now you have a lot of issues like that. Good luck!
  4. Most class design articles tell you that you should setup functions to "get" and "set" class-based vars. So - sounds like you simply need a function that returns the values you want. And then you echo them.
  5. You initially said: i have a table with the following columns pord_name, prod_brand, prod_photo, prod_desc and another table with the following columns prod_name, prod_brand, prod_photo, prod_desc, cat, subcat, prod_price, prod_w_c So where is 'std_id'? Are you asking about creating a new column? Well - with all that duplication of prod_ columns, this db is not fully normalized. You need to figure that out first before trying to assign std_id. Is std_id one-to-one with anything above?
  6. Sorry - but you will have to explain to me what you want to do. Are you asking how to add a value to a table, or add a new field to a table? What is std_id - an input value? Is it the key to a record on another table? I'm confused. Remember this is not my appl so I'm not keeping track of all your details.
  7. You could place some code in your processing logic to measure the time that each step takes and output that and see where you need to re-think your code. Look up microtime in the php manual - some good examples there of how to use it.
  8. By removing the value= from your checkbox tag you will never get a response from $_POST['selected']; Please re-read my first post on what you have to do or simply remove the checkboxes entirely.
  9. Now you got it! No reason to duplicate data across multiple tables. Yes - your future queries will 'gather' the data items(fields) from multiple tables to give the user the 'view' they need. So basically - the user selects from a page that has a 'view' of product info that you produced. When he selects one, you save the product id in a table under his id and the date and whatever else you need to remember the transaction. When you later want to see what the user selected/purchased you do a query looking for the records with his id and the transaction date and also grab all the product records for each product id you find. There will be multiple records with userid and prod ids and dates as well as a record for each prod id which you will gather and produce a combined result record. userid1 prodid1 date1 prodname proddesc prodphotoname...... userid1 prodid2 date1 prodname proddesc prodphotoname...... userid1 prodid2 date2 prodname proddesc prodphotoname...... userid1 prodid3 date1 prodname proddesc prodphotoname...... userid1 prodid4 date1 prodname proddesc prodphotoname...... userid1 prodid3 date4 prodname proddesc prodphotoname......
  10. You want to select the data, design and format a page to display the data and output it as a PDF document. Can do. Go to www.fpdf.org and download their class for creating pdf files. Works pretty well. It will take a few hours of playing to figure it out but then you can do exactly what you want with it.
  11. Do this - replace this line: echo "ELSE part of the code"; // written with: echo "ELSE part of the code - error message is: ".MySQL_error(); Your query is not returning a result OR it completely failed. The 'MySQL_error()' will tell us which one it is.
  12. Don't know about those code tags either. I have my issues .. HTH with your problem (if I did). Pls mark this topic close though regardless
  13. A properly constructed html page has header information such as the <doctype> tag, <meta> tags and others at the top. Then it has a <header></header> section where your <style></style> and <script></script> stuff goes. (This is the css style settings and your JS code. What I suggested was to create function to put your JS code into, moving it into the <header> section of your page and to add a line to set the value of the hidden submit <input> tag. Very simple to do. Now in your html, you change your 'onchange' event to point to your new js function: onchange='mySubmitFunc(this.form)' and then your function will be function mySubmitFunc(f) { f.getElementById('submit_hidden').value=(your real submit button's value); f.submit(); } Keep trying!! The concepts of html processes, js executions and behind-the-scenes PHP processing are difficult to grasp all at once, but it will come to you - but only after you have worked at it for awhile. When you get something that works - keep it handy to reference for the next time.
  14. Do you have multiple prod_desc and prod_photo values for the ONE record you are Inserting? Or are there multiples? If it's just one, then I would do the select query for prod_desc & prod_photo for the prod_name you are inserting and then use the result to include in the INSERT query. Of course in a normalized database you shouldn't be putting those values into the other table as long as you have a foreign key in 'tbl_product' that can always connect you to the photo and desc in 'tbl_prodstd'.
  15. Can we see that code? I'm still confused since you seem to be saying now that the js is being called from an html submit and NOT PHP.
  16. PLEASE - show the new code when you want us to help solve your problem.
  17. Or perhaps more pertinently - do a google on php and checkboxes. You don't assign a value to your checkbox when you process the query results to generate it. The value= that you output will then be returned as the value of $_POST['selected']. Note that each record you process and output needs a unique value assigned to it. I don't know what that would be in your case.
  18. You are throwing some js code in the middle of your php code. Put that code into the <head></head> section as a function of your webpage output and instead of using explicit js code for your submit, make it call to a js function call and include the setting of the hidden field value as part of the new "submit" function.
  19. To DavidAM: My response was not aimed at harming the OP -merely to suggest to him that reading manuals is where ultimate knowledge is to be gained. I don't think anything I wrote should have been taken in a bad way. As for my seeking to up my post count here: That is the second time someone has suggested that to me. What is up with that? Do people really care about post counts here? I don't get it. What - do we all get a prize when we reach a milestone? Can I have my points removed and my posts not counted? That would be great!
  20. Can I see the code with the echo statements added? Add some extra echos to show how you proceeded through the code.
  21. Decrying yourself as a complete moron when reading is not the way to get ahead. I just read the manual for the first time (on this subject) and it makes perfect sense to me. Maybe it's just your lack (?) of understanding of php that prevents you from understanding what these (probably) advanced functions are all about? Why are you so curious about these functions? I've been into PHP for 3 years, but I've never had use of these. Give it time and it may make sense. In the meantime, if you want to succeed in this endeavor you better get used to reading manuals. Just my $.02 And as for your question about "if($_SESSION)" I think you mis-read your test results. This code: if ($_SESSION) echo "true"; else echo "false"; returns true for me.
  22. You don't understand the usage of quotes and double quotes. If you begin a string with one type of quote (single or double) you can't use that same kind of quote again in the string without escaping it (preceding it with a \). Should you need to quote something always use the other type of quote to do so. So, in your case, when you start a string with a double quote ($html = "....), you have to use single quotes to encase any other strings inside meaning that the parms of your <a> tag are quoted incorrectly. IMHO it is preferable to always use double quotes on strings since any php var used inside will then be evaluated without having to break the string up. Anything inside the string requiring quotes can always use the single quote, again avoiding having to use escape sequences. $var = "<input type='text' name='name' value='$myvar'>"; will always work while $var = '<input type="text" name="name" value="$myvar">'; will not do what you want since the outer quotes were single and thus the php var will show up literally as '$myvar'.
  23. PLEASE post the code so you can be helped.
  24. This is pretty much all discussed in the php manual. us.php.net/manual/en/function.session-unset.php
  25. you need to escape the double quotes on the onfocus= because it is competing with the starting " for the whole string. LIke this: onfocus=\"if (this.value=='password') this.value='';\"/> You're only getting the default html and body tags because your $html var is not valid because of the quote marks confusion.
×
×
  • 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.