Jump to content

TCombs

Members
  • Posts

    39
  • Joined

  • Last visited

About TCombs

  • Birthday 01/04/1974

Contact Methods

  • Website URL
    http://www.fatguysports.com
  • Yahoo
    tomcombs35

Profile Information

  • Gender
    Male
  • Location
    Cincinnati, OH.

TCombs's Achievements

Member

Member (2/5)

0

Reputation

  1. Yes, Thank you!! That fixed it! Thanks again!!!
  2. Thanks for your response. Here is the upload function from the functions.php file function ProcessImageUpload($field, $image_destination) { //Your Image $imgSrc = $_FILES[$field]['tmp_name']; $imgName = $_FILES[$field]['name']; //getting the image dimensions list($width, $height) = getimagesize($imgSrc); //save original image move_uploaded_file($imgSrc, $image_destination . $imgName); }
  3. I had help last year creating a very basic store that simply shows products, an image for the product, price, etc. No financial information is being input on the site. The admin of the site can go in and add new products, along with their image. The site worked fine for the last year, now suddenly, they can't upload images. When an admin tried to upload an image for a product, this is the error I'm getting: Error: 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 'image = ', B6405 Thumb.jpg' WHERE id = '64'' at line 1 When I look at the console in Firefox when executing the upload command, this is what I see: <br /> <b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/content/93/7468893/html/adminprodupdate.php</b> on line <b>73</b><br /> <br /> <b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/content/93/7468893/html/adminprodupdate.php:73) in <b>/home/content/93/7468893/html/adminprodupdate.php</b> on line <b>82</b><br /> This is the code for the adminprodupdate.php file referenced above, Can someone please take a look at the code and let me know if they see anything obvious? <?php include("config.php"); include("db.php"); include("functions.php"); $id=$_POST['id']; $active=$_POST['active']; $cat_id=$_POST['cat_id']; $name=$_POST['name']; $description=$_POST['description']; $details=$_POST['details']; $price7=$_POST['price7']; $price=$_POST['price']; $price2=$_POST['price2']; $price3=$_POST['price3']; $price4=$_POST['price4']; $price5=$_POST['price5']; $price6=$_POST['price6']; $minimum=$_POST['minimum']; $arrsizes = $_POST['size']; $arrcolors = $_POST['color']; $image1=$_POST['image']; $image2=$_POST['image2']; $image_directory = $_SERVER['DOCUMENT_ROOT'] . '/store-images/'; $image1 = false; $image2 = false; if (is_uploaded_file($_FILES['image']['tmp_name'])) { ProcessImageUpload('image', $image_directory); $image1_name = $_FILES['image']['name']; $image1 = true; } if (is_uploaded_file($_FILES['image2']['tmp_name'])) { ProcessImageUpload('image2', $image_directory); $image2_name = $_FILES['image2']['name']; $image2 = true; } $sql="UPDATE products SET active = '$active', cat_id = '$cat_id', name = '$name', description = '$description', details = '$details', price7 = '$price7', price = '$price', price2 = '$price2', price3 = '$price3', price4 = '$price4', price5 = '$price5', price6 = '$price6', minimum = '$minimum'"; if ($image1) { $sql .= "image = ', $image1_name'"; } if ($image2) { $sql .= "image2 = ', $image2_name'"; } $sql .= " WHERE id = '$id'"; mysql_query($sql) or die ("Error: ".mysql_error()); $result = mysql_query("SELECT id FROM products ORDER BY id DESC LIMIT 0,1"); if ($row = mysql_fetch_assoc($result)) { $productid = $row['$id']; } mysql_query("DELETE FROM productoptions WHERE productid='$id'"); foreach ($arrsizes as $sizevalue) { foreach ($arrcolors as $colorvalue) { $sql2 = "INSERT INTO productoptions (productid, sizeid, colorid) VALUES ('$id', '$sizevalue', '$colorvalue')"; mysql_query($sql2) or die("Error: ".mysql_error()); } } header("Location: " . $config_basedir . "adminhome.php"); ?> Thank you in advance! If I didn't explain thoroughly, please let me know.
  4. I used custom fields for a series of real estate listing posts on a wordpress site. I want to query all posts by the State they are listed in and sort them alphabetically. (custom field: property_locations_state) Then I want to list the properties within that state. (custom field: property_name) For example: Indiana property 1 property 2 Michigan proptery 1 property 2 With the code below, I can see the posts by print_r($propposts), however, no results are being displayed. Please let me know if you can see what's wrong with this code. <?php $args = array( 'posts_per_page' => -1, 'meta_key' => 'property_locations_state', 'meta_query' => array( array( 'key' => 'property_locations_state' ), array( 'key' => 'property_name' )) ); $propposts = get_posts($args); //custom function for comparing the data we want to sort by function cmp($a, $b){ if ($a->property_locations_state == $b->property_locations_state) { return 0; } return ($a->property_locations_state > $b->property_locations_state) ? 1 : -1; } usort($propposts, 'cmp'); $directory = array(); foreach ($propposts as $proppost ) { // get all the posts data $posttitle = get_post_meta($proppost->post_id); if($posttitle){ foreach ($posttitle->property_locations_state as $title) { $directory[$title][] = array ( 'property_name' => $posttitle->property_name ); } } ksort($directory); // sort by state echo '<ul id="example1" class="accordion">'; foreach ($directory as $state => $lists) { echo '<li><h3>' .$state. '</h3>'; echo '<div class="panel loading">'; sort($lists); // sort Properties by name foreach ($lists as $list) { echo '<div id="membox">'; echo $list['property_name'].'<br />'; } echo '</div></li>'; } echo '</ul>'; } ?>
  5. Thank you so much! I spent almost all day yesterday trying to figure this out. You're a life saver :-)
  6. Thank you sir! Looks very good now! 1 last tweak, if a user has multiple instruments listed, can we get all instruments to show in the member output. For example, if you look at this link: http://afm1.org/wp/?page_id=677 You see that david abbott is listed under Accordian & Acoustic...which is CORRECT. however, under his email address only the 1 instrument is listed. Can we get both instruments listed here?
  7. @gizmoloa - Thanks for your response, not sure how the 'b' became 'B' when I pasted the code. I have noticed this editor is a little buggy. @barand - Thank you as well. The code you showed me got me a lot closer to what I need. however, it is listing each instrument with the same user. Here's what I have now: <?php $args = array( 'fields' => 'all', 'role' => 'Subscriber', 'meta_query' => array( array( 'key'=>'instrument' )) ); $members = get_users($args); //custom function for comparing the data we want to sort by function cmp($a, $B){ if ($a->instrument == $b->instrument) { return 0; } return ($a->instrument > $b->instrument) ? 1 : -1; } usort($members, 'cmp'); $directory = array(); foreach ($members as $member ) { // get all the user's data $member_info = get_userdata($member->ID); foreach ($member_info->instrument as $inst) { $directory[$inst][] = array ( 'lastname' => $member_info->last_name, 'firstname' => $member_info->first_name, 'address' => $member_info->address_1, 'city' => $member_info->city, 'state' => $member_info->state, 'zip' => $member_info->zip, 'phone' => $member_info->phone, 'email' => $member_info->email ); }} ksort($directory); // sort by instrument foreach ($directory as $instrument => $players) { echo '<h1>' .$instrument. '</h1>'; sort($players); // sort players by lastname foreach ($players as $player) { // output player details here echo '<div id="membox">'; echo $member_info->first_name. ' ' .$member_info->last_name.'<br />'; echo $member_info->address_1.'<br />'; echo $member_info->city.', '.$member_info->state.', '.$member_info->zip.'<br />'; echo $member_info->phone.'<br />'; echo '<a href="mailto:'.$member_info->email.'">'.$member_info->email.'</a><br />'; foreach ($member_info->instrument as $inst) { echo '<b>'.$inst.'</b>, '; } echo '</div>'; }} ?>
  8. Hello all! I've posted here in the past and had great success, hoping for the same today. I have a wordpress site and I'm trying to pull the members into a page and sort them by results. It's a Musicians site and I need to be able to sort the members by the instruments they play. This code will pull the members into the page and you can see the results at: http://afm1.org/wp/?page_id=677 <?php $args = array( 'fields' => 'all', 'role' => 'Subscriber', 'meta_query' => array( array( 'key'=>'instrument' )) ); $members = get_users($args); //custom function for comparing the data we want to sort by function cmp($a, $B){ if ($a->instrument == $b->instrument) { return 0; } return ($a->instrument > $b->instrument) ? 1 : -1; } usort($members, 'cmp'); foreach ($members as $member ) { // get all the user's data $member_info = get_userdata($member->ID); echo '<div id="membox">'; echo $member_info->first_name. ' ' .$member_info->last_name.'<br />'; echo $member_info->address_1.'<br />'; echo $member_info->city.', '.$member_info->state.', '.$member_info->zip.'<br />'; echo $member_info->phone.'<br />'; echo '<a href="mailto:'.$member_info->email.'">'.$member_info->email.'</a><br />'; foreach ($member_info->instrument as $inst) { echo '<b>'.$inst.'</b>, '; } echo '</div>'; } ?> What I want to do is have the Instrument as a title and have all of the members that play that instrument listed like this: <h1>Accordian</h1> Arpi Anderson 1234 Whitfield Avenue Cincinnati, OH, 45220 513-111-1111 arpianderson@hotmail.com Accordion, David Abbott 123 N. Ft. Thomas Ave. Ft. Thomas, KY, 41075 859-111-1111 davejanet@acninc.net Accordion, Acoustic, <h1>Violin</h1> Ann Baer 123 Cabinridge Batavia, OH, 45103 513-111-1111 violin@cinci.rr.com Violin, Any help would be GREATLY appreciated! Thanks
  9. Yeah, it's a Volusion template that I had to modify. It's a wreck, and if you try to validate it your browser may crash..lol I've just been trying to get by with it until I can setup a test environment, recreate the store the right way and upload it to the server. If I could get the product, price, link & image that would be great. But at this point I'd settle on just the image and link. The table structure in Volusion is horrible. There's the main content table, then within the backend of the store is where all of the WYSIWYG editors are for each product, article, page, etc. which automatically places items on the page depending on which box you check or uncheck. I hate it actually.
  10. Silk....this is the exact type of answer I was looking for. You gave me an option and explained why it was the right way to go. Its just what I needed...Thanks! My apologies, I misread your 2nd post. Seriously, My apologies....long day i guess. I'm going to eat some dinner, regroup, come back and dive into DOM parsing. This is a really good community and great resource.
  11. why are you guys trying make me out to be a bad guy? I thought this was a place to go for help, not ridicule. If I go unprotect the images would that prove I'm telling the truth? jeez. *****Images are now unprotected***** do you feel better? Have I broken some message board rule? Or am I being attacked for not being a php guru? I didn't ask anyone to write the code, just to point me in the right direction. Apparently you'd rather try to continue to prove what I've already admitted, which is I know very little about real php coding. I wasn't questioning anyone to say they were wrong, I was questioning because i didn't understand.
  12. I do have access to the site, they are seperate domains: tigerfitness.com & tigerfitnessforum.com/blog The store is a Volusion store, it started long before the forum & blog. I'm not doing anything shady if that's what you're saying. I just need help getting started in the right direction. I'm trying the cUrl option because after some google searches, it seemed to accomplish what i wanted. I'm trying this way, because i obviously don't know of a better way...lol
  13. Xyph - You are absolutely correct, I do have limited knowledge of PHP. Which is why I come here, to get pointed in the right direction. Due to the limited knowledge, I'm not sure how to tackle the issues at hand sometimes. So I come here, describe my situation, and hope someone can point me in the right direction. Google searches bring back php keywords for me to look up and learn about. I wasn't rejecting your solution, I thought you were saying to use an xml feed to grab the 10, 20, 30 most recent products. But that's not what i want, I want to grab information that is put on the homepage each time the homepage is requested. To simplify what I want: go to http://www.tigerfitness.com , refresh the page a couple times and you will see the grid of products changes each time. The grid is pulling from New, Featured, and Hottest selling products. All I want to retrieve from the front page are the product images and the product page they link to. Once I have that, I'll display in a random image box or slider on different pages of the blog & forum. The images need to maintain their links so that when someone clicks on a product image in the blog it will take them back to the store. Now...Given that information, would you still use an xml feed or would you go another route? It seems like if I wanted to get any product from the store, then maybe using the xml feed would be the way to go. But I don't want to pull in old products, just the latest and greatest..lol If I am wrong or confused, then tell me and explain to me how I'm wrong so i can have a better understanding. I'm a fast learner, but every now and then having someone explain how they got from point A to point B really helps fill the gaps. :-)
  14. Xyph, I need to grab the images with their links to product pages from the homepage of the store. Then show them in a carousel or as related content to posts on the blog, which is a separate domain. When someone clicks on the product image in the blog, I want it to take them to that products page on the store. The homepage of the store changes everytime someone visits the store because the products are displayed in tables based on featured, top sellers, etc. So simply grabbing the data from the database isn't going to help my situation....at least I don't think so (but I've been wrong before).
  15. Thanks Mike, I'm going to work on that now. I'll post back here with the results.
×
×
  • 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.