Jump to content

webent

Members
  • Posts

    255
  • Joined

  • Last visited

    Never

Everything posted by webent

  1. Why not use a mailing list, that is what it is designed for? ... Certainly not the php mail function...
  2. Well, I didn't explain myself appropriately, what I'm trying to do is, when a category id is passed and queried, to pull up all of the products that have a relation with that category id... and then put the products (products_id, products_image, products_name, products_description, etc.) in a table, 3 columns wide and infinately long... with 65000 plus products, each category can have hundreds or thousands or products to display... Of course I will have to add paging to it, but I got to get this part working first... The reason I am putting into an array and then passing it into a function is because the array will have data related to that product from different tables... so I assembled it into an array and then passed it to the function.
  3. Just curious if you tried getting rid of all the special characters and variables in the second one and just put in some simple test static data, if it still doesn't send?
  4. Thanks Barand, switching from mysql_fetch_array() to mysql_fetch_assoc() got rid of the obsolete array data... Now as far as the , I tried that before but couldn't and still can't figure out how to pull specific vars from the array, I tried this... echo '<tr>'; foreach ($fields as $fld) { echo '<td>' . $fld['products_name'] . '</td>'; } echo '</tr>'; but that just gave me gibberish...
  5. So what I can't seem to find any information on anywhere is, how to iterate a loop by each dataset within an array? Here's an example print_r of some of it... How do I, with a loop, determine when one product starts and another stops? Array ( [0] => 124 [products_id] => 124 [1] => anskunumber [products_sku] => anskunumber [2] => [products_model] => [3] => Jim Wagner Reality-Based Knife Defense DVD [products_name] => Jim Wagner Reality-Based Knife Defense DVD [4] => Jim Wagner Reality-Based Knife Defense DVD [products_description] => Jim Wagner Reality-Based Knife Defense DVD [5] => 0.0000 [products_cost] => 0.0000 [6] => 0.0000 [products_price] => 0.0000 [7] => 0.0000 [products_msrp] => 0.0000 [8] => [products_map] => [9] => 0.0000 [products_map_price] => 0.0000 [10] => 0.2 [products_weight] => 0.2 [11] => 0 [products_length] => 0 [12] => 0 [products_width] => 0 [13] => 0 [products_height] => 0 [14] => 6 [products_qty] => 6 [15] => 0 [products_sort_order] => 0 [16] => 2008-06-10 [products_date_added] => 2008-06-10 [17] => 0000-00-00 [products_date_modified] => 0000-00-00 [18] => [products_metatags_title] => [19] => [products_metatags_keywords] => [20] => [products_metatags_description] => [21] => 19 [manufacturers_id] => 19 [22] => 1 [product_types_id] => 1 ) Array ( [0] => 1024 [products_id] => 1024 [1] => anskunumber [products_sku] => anskunumber [2] => [products_model] => [3] => SAS Jungle Survival [products_name] => SAS Jungle Survival [4] => Practical survival handbook based on SAS training and techniques, covering every aspect of survival in the worlds most inhospitable places. 160 pages with over 75 illustrations. [products_description] => Practical survival handbook based on SAS training and techniques, covering every aspect of survival in the worlds most inhospitable places. 160 pages with over 75 illustrations. [5] => 0.0000 [products_cost] => 0.0000 [6] => 0.0000 [products_price] => 0.0000 [7] => 0.0000 [products_msrp] => 0.0000 [8] => [products_map] => [9] => 0.0000 [products_map_price] => 0.0000 [10] => 0.5 [products_weight] => 0.5 [11] => 0 [products_length] => 0 [12] => 0 [products_width] => 0 [13] => 0 [products_height] => 0 [14] => 3 [products_qty] => 3 [15] => 0 [products_sort_order] => 0 [16] => 2008-06-10 [products_date_added] => 2008-06-10 [17] => 0000-00-00 [products_date_modified] => 0000-00-00 [18] => [products_metatags_title] => [19] => [products_metatags_keywords] => [20] => [products_metatags_description] => [21] => 3 [manufacturers_id] => 3 [22] => 1 [product_types_id] => 1 )
  6. My intention is not to bump my post... but some logic just came to me, I just need help with part of it... Here's what I came up with... I just can't figure out what the SOMETHING is supposed to be... ? function showProducts($fields) { echo '<tr>'; $count = 0; while (SOMETHING < 4)) { echo'<td>' . $fields['products_name'] . '</td>'; $count++; } echo '</tr>'; }
  7. Without seeing more of your table structures, all I can tell you is that the best way would be to use a JOIN query... or you could embed the second query inside your while($row = mysql_fetch_array) of the first query...
  8. Would something like this work?... $query=""; if(isset($_GET['cat'])){ $query=$query."cat='$_GET[cat]', "; } if(isset($_GET['subcat'])){ $query=$query."subcat='$_GET[subcat]', "; } if ($query == "") {$query = 1} else { $query = substr_replace($query," ",-2); $sub_query = "SELECT * FROM idea WHERE ".$query. " ORDER BY ref DESC"; $sub_results = mysql_query($sub_query); if (!$sub_results) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $sub_query; die($message); } }
  9. Hi all, so here I am again... So, come to find out, that when an array is passed into a function, the function actually acts as a loop... did not know that... was quite interesting to find out... since that is the case however, it creates a small problem for me... let me show you what I have for code first, then I'll tell you what I'm trying to make it do... function showProducts($fields) { echo ' <tr> <td>' . $fields['products_name'] . '<br />' . $fields['products_description'] . '</td> <td>' . $fields['products_name'] . '<br />' . $fields['products_description'] . '</td> <td>' . $fields['products_name'] . '<br />' . $fields['products_description'] . '</td> </tr> '; } I'm sure some of you are laughing right about now, go ahead, I would too... but I need to be able to create columns and cells and populate each individual cell with one particular product's information from the array...
  10. Told wwfc_barmy_army that yesterday when this post was made in the php help forum... http://www.phpfreaks.com/forums/index.php/topic,200988.msg908903.html#msg908903
  11. Hi, I've found tons of different scripts for metering the progress of uploading files and I can see how that would require the loads of scripts that come with it and configurations neccessary... The thing is though, I am inserting thousands of rows into a database from the file that I uploaded, which can take anywhere from 5 to 10 minutes or more... thanks to help from the php forums, I have decided the best solution is AJAX,... I have the total amount of rows in the file, done by a pre-query... That is done before the actual loop of populating the db with the file contents... which is done like so... $total_count = 0; $handle = fopen($_POST['file_name'], "r"); while (($fields = fgetcsv($handle, 0, ",")) !== FALSE) { $total_count++; } $total_count -= 1; // Minus 1 for the file header mysql_query("UPDATE insertion_counter SET total_count = '$total_count' WHERE counter_id = '1'"); And in the loop that is actually populating the db with the file contents, I have it also updating the insertion_counter table with the current row that it is on, like so... $row_counter = 0; $handle = fopen($_POST['file_name'], "r"); while (($fields = fgetcsv($handle, 0, ",")) !== FALSE) { $row_counter++; if ($row_counter == 1) { // First row header removed. } else { $products_inserted_counter = $row_counter - 1; mysql_query("UPDATE insertion_counter SET current_count = '$products_inserted_counter' WHERE counter_id = '1'"); So now that I have both values, that I can call like so... $results = mysql_query("SELECT current_count, total_count FROM insertion_counter WHERE counter_id = '1'"); while ($row = mysql_fetch_array($results)) { $current_count = $row[current_count]; $total_count = $row[total_count]; } if ($total_count != 0) { $percent_complete = number_format($current_count / $total_count,2); $percent_complete *= 100; } Isn't there a simple way to use that with AJAX for a meter or something?
  12. What's up with all of these links posted in the "AJAX - a basic start and working example" sticky not working... ? http://www.ajaxfreaks.com/quickcode.php http://www.ajaxfreaks.com/tutorials.php http://www.ajaxfreaks.com/scripts.php http://www.ajaxfreaks.com/articles.php
  13. If you want it to print all of the results, then you need to put that section of your html structure in your while loop... while ( $row = mysql_fetch_array($result) ) { }
  14. Just try it in one, just to make sure that it is working... Just for future reference though, if you would have to change it in many pages, I would suggest using a header.inc file in your pages...
  15. Hey, why not try this,... put the style.css in the same directory as the calling page and change the url in which you call the style.css page to match... See if anything changes...
  16. rarebit, would passing it via a session array be more secure, then only retrieving that data from the session array?
  17. You can try refreshing it... Other than that, I'm stumped, you can't have two different files with the exact same name and file extension in the exact same place at the exact same time... LOL... At least not in my own private universe... I would delete all the style.css files in that location,... then make sure your old one is deleted from your pc, double check to make sure that you are really about to upload the new one, then upload it... refresh your page and if the Gods are willing, Voila!
  18. Did you try refreshing your page or possibly clearing your cache?
  19. It just stops injections...
  20. Yeah, I just create one of these bits for every variable being passed into the form processor, put it at the top, prior to any processing... $from=$_POST['lname']; if (eregi("\r",$from) || eregi("\n",$from)){ die("Why ?? "); } This is by no means sufficient enough for anything that requires higher security.
  21. And that's the exact path you're using to call it? <link rel="stylesheet" type="text/css" href="www.mysite.org/styles/styles.css" />
  22. Used to happen to me all the time, so Just to drive you bonkers! LOL
  23. My God, LOL... you're right AndyB ... I never seen that little typo, definately time to get new glasses...
  24. Are you absolutely sure about the path you are using to call your style.css page and that the style.css page is where you think it is? Type in the path of the style.css page in your browser and see if it tries to download... one easy way to make sure it is where you think it is... and use that absolute path in your css page call...
×
×
  • 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.