Jump to content

ryan king

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Everything posted by ryan king

  1. i figured it out.. at one point the files got moved to the wrong place..then the files where no longer in the folder to move them from..so..re uploaded the files and tried again and voila!
  2. accualy, I take that back..the images are not available.. I had all 5700 of them in there..now it says there are only 307.. so..somewhere along the line..some images got moved..I cant see them in any of the members directories so i dont know where they went..re uploading them now.
  3. Yes, the directories all exists.. I get this error The file ../selecto/CD/090431620229.jpg does not exist Warning: rename(/selecto/CD/090431620229.jpg,/selecto/members/5359/item_5067.jpg) the file 090431620229.jpg is available in the selecto/CD directory and members/5359 directory is also there..
  4. hi, I have recently migrated one mysql database to another. the last thing I need now is images. I have already migrated the image names, ect to the new table from the old. but the old db just had cd/imagename.jpg in the field.. my new database requires that all images be placed in the user id's subdirectory and renamed.. basicly, I just need to move all the images from a directory they are now stored in and put them into the correct user_id subdirectory and rename them.. heres what I have so far.. it echo's the correct results but nothing gets copied, I have all directories permissioned correctly $result = mysql_query("SELECT zoo_products.products_id, jamroom_store.band_id, jamroom_store.item_id, jamroom_store.item_image_name FROM jamroom_store LEFT JOIN zoo_products ON zoo_products.products_id = jamroom_store.item_id ORDER BY jamroom_store.item_id ASC"); while($row = mysql_fetch_array($result)) { rename("../selecto/CD/{$row['item_image_name']}", "../selecto/members/{$row['band_id']}/item_{$row['item_id']}"); echo "<table>"; echo "<tr><td>{$row['item_id']}"; echo "</td>"; echo "<td>{$row['item_image_name']}"; echo "</td>"; echo "<td>{$row['band_id']}"; echo "</td>"; echo "</td></tr>"; } echo "</table>"; ?> it need to go from selecto/cd/imagename.jpg to selecto/members/$BAND_ID/item_$ITEM_ID.jpg
  5. right now I have a table from the zencart application that holds artist_id, products and genre. I have another program Ive intergrated it with that has a column for genre. Ide like to update my other table with this genre info. Only problem is this.. artist in zencart are not directly associated with genres, they are associated with producst and those products are associated with genres. In my other table, (the one im tryin to update) artists are directly associated with genres. Since all the artists products are typicly under the same genre as the artist themselves, I would like to copy this data over to the correct artist id in my other table so all my artist are DIRECTLY associated with a artist genre. heres how I was atempting to do this.. $result = mysql_query("SELECT * FROM zoo_music_genre, zoo_product_music_extra, jamroom_band_info WHERE jamroom_band_info.band_id=zoo_product_music_extra.artists_id AND zoo_product_music_extra.music_genre_id=zoo_music_genre.music_genre_id ORDER BY zoo_music_genre.music_genre_name DESC"); while($row = mysql_fetch_array($result)) { $genre = $row['music_genre_name']; $sql_update = "UPDATE jamroom_band_info SET band_soundlike = $genre"; mysql_query($sql_update) or die(mysql_error()); my code my not even be correct becuase im somewhat of a newbie, but if run the select query without the update stuff I get the proper results echoed. whe I run the update command I get an error stating "Column does not match value at row 1" I believe this is true becuase an artist in the zencart DB might have 10 products each, I just need to pick the first one, take the genre from it and insert it into my other genre table, then go to the next artist id and so on...so only one per record.. I think its failing becuase it might pull artist id 10 times becuase of the products being associated with the genres.. am I making any sense?
  6. good to hear! could you provide me with an example or a link to how this done? Thanks.
  7. I have a column in a table called "location" in 99% of them it has information like.. "Baltimore,MD 21202" I created a new column called "zipcode" Is there a way to copy the location column to the zipcode column and filter out everything but the zipcode? Im planning on doin away with this location column but dont want to loose all the zipcodes as I need them for proximenty searches.
  8. If your just trying to use a variable in a link you can do it it double quotes like so: <?php include("http://mysite.com/$navigation_variable"); thats just an example. but you can put variables in include paths, just use the double quotes.
  9. ok.. after getting some sleep and wakign up with a clear mind. I realize that the script is only paginating results if you dont not give a zipcode.. basicly its only paginating ALL results. when using thhis string.. it will paginate and limit ALL results, but not zipcodes entered <?php $sql_events = mysql_query("SELECT * FROM jamroom_band_info WHERE band_zipcode='$key' ORDER BY band_update DESC LIMIT ".$startrow.",".$rowsperpage); ?> I used your code above and it gives me a blank page and it doesnt work it all if I use: <?php $sql_events = mysql_query("SELECT * FROM jamroom_band_info WHERE band_zipcode='$key' ORDER BY band_update DESC"); ?> the placement of this doesnt help either even though we know its in the right place: <?php // this is just to initialise the variable: $result_array = array(); $zips = array_limit($zips,$startrow,$rowsperpage); // first we gather all the results into a single array: foreach ($zips as $key => $value){ I gotta figure out a way to LIMIT the results of zips in my userdata base, and Im still stumped on how to do this correctly.
  10. Thanks for all your help man! its really appreciated!
  11. your absolutly right! this didnt work! I was trippin!
  12. I fixed it.. I changed $startrow = (isset($_GET['page']) && $_GET['page'] != 0)? ($_GET['page'] - 1) * $rowsperpage : 0; to $startrow = (isset($_GET['page']) && $_GET['page'] != 1)? ($_GET['page'] + 1) * $rowsperpage : 0; this way it starts at page 1 and displays page 1 on the page counter.
  13. yes.. I even have it displaying in my smarty templates going page to page like it should However. SMALL problem.. it starts at 0 so when I click next page it goes to page 1 which ofcourse displays the same results, then goes to page 2 and the results change.. we need to start it at page 1, not 0.
  14. it works! I had the thing in the right place ALL along. I had screwed something else up.. I went back to my code before I started editing with your latest function changes and added in everything.. then moved the stuff that needed to be moved and viola! here is the final outcome: <?php print "<link href='/skins/Cobalt/Cobalt.css' rel='stylesheet' type='text/css' media='screen'>"; require('include/jamroom-include.inc.php'); require_once('zipcode.class.php'); // zip code class Function array_limit($array,$start,$length){ $return_array = array(); for($i=$start;$i<($start + $length);$i++){ $return_array[] = $array[$i]; } return $return_array; } $row_count = 0; $z = new zipcode_class; $zips = $z->get_zips_in_range($_POST['zip_code'], $_POST['miles'], _ZIPS_SORT_BY_DISTANCE_ASC, true); // add searched for zip to $zips array $zips[$_POST['zip_code']] = 0; $row_count = 0; $rowsperpage = 16; // 4x4 grid - u can change this variable to change how many each page, without having to change any of the other code. $prevno = $_GET['page'] - 1; $nextno = $_GET['page'] + 1; $startrow = (isset($_GET['page']) && $_GET['page'] != 0)? ($_GET['page'] - 1) * $rowsperpage : 0; // this is just to initialise the variable: $result_array = array(); // first we gather all the results into a single array: foreach ($zips as $key => $value){ //find all locations within range using returned zipcode values $sql_events = mysql_query("SELECT * FROM jamroom_band_info WHERE band_zipcode='$key' ORDER BY band_update DESC LIMIT ".$startrow.",".$rowsperpage); while ($row = mysql_fetch_array($sql_events)) { // we just add this row to the array: $result_array[] = $row; } } // config i guess $entriesperline=4; $counter=1; print "<table>"; // loop through each result row. $i = 0; $zips = array_limit($zips,$startrow,$rowsperpage); foreach ($result_array As $row){ if($counter%$entriesperline==1 && $i < 50){ print "<tr><td align='center'><div class='body-zip'><a href=\"members/{$row['band_id']}\">{$row['band_name']}</a><br><a href=\"members/{$row['band_id']}\"><img border='0' src=\"image.php?band_id={$row['band_id']}&mode=band_image&width=100&theme=Sage\">{$row['band_image']}</a></div></td>"; }else if($counter%$entriesperline==0 && $i < 50){ print "<td align='center'><div class='body-zip'><a href=\"members/{$row['band_id']}\">{$row['band_name']}</a><br><a href=\"members/{$row['band_id']}\"><img border='0' src=\"image.php?band_id={$row['band_id']}&mode=band_image&width=100&theme=Sage\">{$row['band_image']}</a></td></div></tr>"; }else if($i < 50){ print "<td align='center'><div class='body-zip'><a href=\"members/{$row['band_id']}\">{$row['band_name']}</a><br><a href=\"members/{$row['band_id']}\"><img border='0' src=\"image.php?band_id={$row['band_id']}&mode=band_image&width=100&theme=Sage\">{$row['band_image']}</a></div></td>"; } $counter++; $i++; } //exit loop if($counter%$entriesperline!=0){ print "</tr>"; echo("<a href=\"./azippyyy.php?page=$prevno\">Prev</a> | ".htmlentities($_GET['page'])." | <a href=\"./azippyyy.php?page=$nextno\">Next</a>"); } print "</table>"; ?>
  15. man.. I cant figure out for the life of me where it should go, Ive tried everywhere it would make sense to go after the $zips as $key which is after the $rowsperpage.. those all have to be defined before I cant start this array correct? so I figure it should go right before the foreach loop where it currently is. I either get a blank page or I get the count to 15 deal whereever I put it
  16. I think it would make since for rowsperpage to go here above this: <?php $rowsperpage = 16; $prevno = $_GET['page'] - 1; $nextno = $_GET['page'] + 1; $startrow = (isset($_GET['page']) && $_GET['page'] != 0)? ($_GET['page'] - 1) * $rowsperpage : 0; ?> since it then gets call as part of the startrow variable
  17. ok.. well I get a value of 16 on rowperpage anywhere I put it in the script. this one gives me diffrent values but mostly does this up to 15 print_r($zips = array_limit($zips,$startrow,$rowsperpage)); Array ( [0] => [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => )
  18. Thats understandable. now I have made the changes. before I made the changes it would only display 16 results. now it displays all of them (except for it limits to 50 using that old count I had included that I no longer need) Also, its still displaying the same results on every page. <?php print "<link href='/skins/Cobalt/Cobalt.css' rel='stylesheet' type='text/css' media='screen'>"; require('include/jamroom-include.inc.php'); require_once('zipcode.class.php'); // zip code class $row_count = 0; $z = new zipcode_class; $zips = $z->get_zips_in_range($_POST['zip_code'], $_POST['miles'], _ZIPS_SORT_BY_DISTANCE_ASC, true); // add searched for zip to $zips array $zips[$_POST['zip_code']] = 0; $row_count = 0; $prevno = $_GET['page'] - 1; $nextno = $_GET['page'] + 1; $startrow = (isset($_GET['page']) && $_GET['page'] != 0)? ($_GET['page'] - 1) * $rowsperpage : 0; $rowsperpage = 16; // this is just to initialise the variable: $result_array = array(); // first we gather all the results into a single array: foreach ($zips as $key => $value){ //find all locations within range using returned zipcode values $sql_events = mysql_query("SELECT * FROM jamroom_band_info WHERE band_zipcode='$key' ORDER BY band_update DESC"); while ($row = mysql_fetch_array($sql_events)) { // we just add this row to the array: $result_array[] = $row; } } // config i guess $entriesperline=4; $counter=1; print "<table>"; $i = 0; Function array_limit($array,$start,$length){ $return_array = array(); for($i=$start;$i<($start + $length);$i++){ $return_array[] = $array[$i]; } return $return_array; } $zips = array_limit($zips,$startrow,$rowsperpage); // loop through each result row. foreach ($result_array As $row){ if($counter%$entriesperline==1 && $i < 50){ print "<tr><td align='center'><div class='body-zip'><a href=\"members/{$row['band_id']}\">{$row['band_name']}</a><br><a href=\"members/{$row['band_id']}\"><img border='0' src=\"image.php?band_id={$row['band_id']}&mode=band_image&width=100&theme=Sage\">{$row['band_image']}</a></div></td>"; }else if($counter%$entriesperline==0 && $i < 50){ print "<td align='center'><div class='body-zip'><a href=\"members/{$row['band_id']}\">{$row['band_name']}</a><br><a href=\"members/{$row['band_id']}\"><img border='0' src=\"image.php?band_id={$row['band_id']}&mode=band_image&width=100&theme=Sage\">{$row['band_image']}</a></td></div></tr>"; }else if($i < 50){ print "<td align='center'><div class='body-zip'><a href=\"members/{$row['band_id']}\">{$row['band_name']}</a><br><a href=\"members/{$row['band_id']}\"><img border='0' src=\"image.php?band_id={$row['band_id']}&mode=band_image&width=100&theme=Sage\">{$row['band_image']}</a></div></td>"; } $counter++; $i++; } //exit loop if($counter%$entriesperline!=0){ print "</tr>"; } print "</table>"; echo("<a href=\"./azippyyy.php?page=$prevno\">Prev</a> | ".htmlentities($_GET['page'])." | <a href=\"./azippyyy.php?page=$nextno\">Next</a>"); ?>
  19. now Im confused! ??? why would we want to limit the zips returned. $zips is the zipcodes that are found in radius then used to compare against ones in my band_info table and return the ones that are like it.
  20. nice! well before I move on to that problem. I need to find out why the results of page 2, 3, 4 and so on are the same as the results on page 1. just using the php file (outside of the smarty template) the pages change but the results stay the same.
  21. Something I just noticed.. when just using the php file outside my templates. I thought it was working but it is just going through the pages. the results stay the same, Same users on page 2 as page 1 and so on.
  22. ok.. my site works off of smarty templates. before we added paginiation to this script, I just included this php file into a .tpl file that I created like so {assign var="title" value=$CONTENT_TITLE} {include file="$SKIN_DIR/jr_overall_header1.tpl"} {include_php file="`$JAMROOM_DIR`/azippyy.php"} {include file="$SKIN_DIR/jr_overall_footer.tpl"} Below is the php script with the zipcode stuff <?php print "<link href='/skins/Cobalt/Cobalt.css' rel='stylesheet' type='text/css' media='screen'>"; require('include/jamroom-include.inc.php'); require_once('zipcode.class.php'); // zip code class $row_count = 0; $z = new zipcode_class; $zips = $z->get_zips_in_range($_POST['zip_code'], $_POST['miles'], _ZIPS_SORT_BY_DISTANCE_ASC, true); // add searched for zip to $zips array $zips[$_POST['zip_code']] = 0; $row_count = 0; $prevno = $_GET['page'] - 1; $nextno = $_GET['page'] + 1; $startrow = (isset($_GET['page']) && $_GET['page'] != 0)? ($_GET['page'] - 1) * $rowsperpage : 0; $rowsperpage = 16; // 4x4 grid - u can change this variable to change how many each page, without having to change any of the other code. // this is just to initialise the variable: $result_array = array(); // first we gather all the results into a single array: foreach ($zips as $key => $value){ //find all locations within range using returned zipcode values $sql_events = mysql_query("SELECT * FROM jamroom_band_info WHERE band_zipcode='$key' ORDER BY band_update DESC LIMIT ".$startrow.",".$rowsperpage); while ($row = mysql_fetch_array($sql_events)) { // we just add this row to the array: $result_array[] = $row; } } // config i guess $entriesperline=4; $counter=1; print "<table>"; // loop through each result row. $i = 0; foreach ($result_array As $row){ if($counter%$entriesperline==1 && $i < 50){ print "<tr><td align='center'><div class='body-zip'><a href=\"members/{$row['band_id']}\">{$row['band_name']}</a><br><a href=\"members/{$row['band_id']}\"><img border='0' src=\"image.php?band_id={$row['band_id']}&mode=band_image&width=100&theme=Sage\">{$row['band_image']}</a></div></td>"; }else if($counter%$entriesperline==0 && $i < 50){ print "<td align='center'><div class='body-zip'><a href=\"members/{$row['band_id']}\">{$row['band_name']}</a><br><a href=\"members/{$row['band_id']}\"><img border='0' src=\"image.php?band_id={$row['band_id']}&mode=band_image&width=100&theme=Sage\">{$row['band_image']}</a></td></div></tr>"; }else if($i < 50){ print "<td align='center'><div class='body-zip'><a href=\"members/{$row['band_id']}\">{$row['band_name']}</a><br><a href=\"members/{$row['band_id']}\"><img border='0' src=\"image.php?band_id={$row['band_id']}&mode=band_image&width=100&theme=Sage\">{$row['band_image']}</a></div></td>"; } $counter++; $i++; } //exit loop if($counter%$entriesperline!=0){ print "</tr>"; echo("<a href=\"./azippyy.php?page=$prevno\">Prev</a> | ".htmlentities($_GET['page'])." | <a href=\"./azippyy.php?page=$nextno\">Next</a>"); } print "</table>"; ?> So, basicly the php needs to include an overall_header and overall_footer everytime you click PREV or NEXT to cycle through results.
  23. Thanks alot for your patience! Its working fine with just the php file but Im including this whole php file into a smarty template (.tpl file) This works fine but doesnt produce the other pages. any idea how to fix this one?
  24. thats it! its limiting my results.. ofcourse its saying Prev | 2 | Next Prev | 2 | Next Prev | 2 | Next Prev | 2 | Next Prev | 2 | Next Prev | 2 | Next Prev | 2 | Next Prev | 2 | Next Prev | 2 | Next and the pages dont work..but I think I can fix this! Thanks for taking the time to help me learn as I code.. That helps me to better understand what Im doing!
  25. thanks for pointing that out, I replaced that code. and yes, semi colon on the end of the select string like so.. <?php $sql_events = mysql_query("SELECT * FROM jamroom_band_info WHERE band_zipcode='$key' ORDER BY band_update DESC LIMIT `$startrow`,`$rowsperpage`"); ?> However, now I just get a blank page.
×
×
  • 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.