Jump to content

xuykin

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

xuykin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi Guys, I have the following questions: 1. Table - 'Vendor_Products'. Table has the following fields: `IMAGEURL`, `SKU`, `CURRENCY`, `PRICE`, `BUYURL`, `NAME` 2. 'NAME' Field contains a string that has product name, model number and it's description and type of the product 3. Need to restrict the product only to certain type and subtype (for example, want the query to show only airplane that is powered only by gas/nitro, leave out electric), since the field contains also rows that list: car (gas or electric), trucks (gas or electric), boats (gas or electric), airsoft rifles (gas and electric), airplanes (gas and electric: sub as kit airplanes and trainer), helicopters (gas or electric) 4. Problem: results from my query lists all other products beside the restricted to Here is two different versions of query that failed to deliver the desired results: 1. $query = 'SELECT DISTINCT `IMAGEURL`, `SKU`, `CURRENCY`, `PRICE`, `BUYURL`, `NAME` FROM 'Vendor_Products' WHERE ((`NAME` LIKE \'%plane%\') OR (`NAME` LIKE \'%gas%\')) AND `PRICE`>35 ORDER BY RAND() LIMIT 0, 18 '; 2. $query = 'SELECT DISTINCT `IMAGEURL`, `SKU`, `CURRENCY`, `PRICE`, `BUYURL`, `NAME` FROM 'Vendor_Products' WHERE (`NAME` RLIKE \'plane\' || `NAME` RLIKE \'nitro\')&& `NAME` NOT RLIKE \'electric\' && `NAME` NOT RLIKE \'pistol\' && `NAME` NOT RLIKE \'car\' && `NAME` NOT RLIKE \'racing\'AND `PRICE`>35 ORDER BY RAND() LIMIT 0, 18 '; Please help me to restrict the query results only to products that are airplanes and are powered by gas or nitro copy/past from Random list of 'Vendor_Products' 'NAME' field: Hydrofoam Kit RC Airplane Boat (Balsa Wood) Wholesale Case (4 Units) VB M14 Spring Gun Sniper Rifle M1 Grand Airsoft Tri-Rail Mount, FPS 390, Ai Clearance Item - Winner Full Function Electric RC Helicopter 3 CH With Double Blades RC Electric Helicopter Shogun 400 V2 ARF Package Deal RC Killer Whale Electric Dual Motor Speed Boat Yakovlev Yak 54 ARF 87 Inch Aerobatic Nitro Gas RC Airplane (****THE QUERY TO PICK ONLY THIS PRODUCT FROM THE LIST****) PACKAGE 3 Silverlit Gyrotor RC Electric RTF Micro Helicopter Package Deal (Buy 2 Get 1 FREE!) RAH-66 Comanche 3CH Electric RTF RC Helicopter 220 Salangane 2CH RTF Electric RC Airplane Syma Bell 206 3CH RTF RC Helicopter Syma S006 Alloy Shark 3CH RTF Electric RC Helicopter UTG Sport Ultimate Tactical Gear 10 Piece Complete Kit Black Airsoft Gun Accessory Monster Jammerz Electric RTR RC Monster Truck
  2. AdRock, Thank you! Looks like it solved error issues and did resize images, however all images resized and given static value as for width and height. Is it what supposed to happen? Thank you for the reply. I have learned today how to use concatenation properly!
  3. Just follow up clarification: My problem with the code is that it does not resize the image. Works well if I have manual link to the image, but when php retrieves image url from the array the second echo for <img parameters does not work.
  4. Hi Guys, I'm new to PHP programming and hope you can help me here. I have difficulty comprehending functions in PHP. Here is what I am trying to accomplish: I have a website that automatically pulls the content from MySQL database and puts them out. I am able to connect and retrieve the content and put them on, however the problem I am encountering is automatically resizing picture and placing javascript affiliate link underneath the picture. Since, I have more than 2000 items on the database I will like to be able to split that content into 100 pages (20 in each page). I don't know how to do that. Here is my code I am having a trouble with: <?php // this calulates resizing function imageResize($width, $height, $target) { if ($width > $height) { $percentage = ($target / $width); } else { $percentage = ($target / $height); } //gets the new value and applies the percentage, then rounds the value $width = round($width * $percentage); $height = round($height * $percentage); return "width=\"$width\" height=\"$height\""; } ?> <?php //this creates array $rcimage = getimagesize("http://images.xxxxxx.com"); ?> <img src="http://images.xxxx.com" width="125" <?php echo imageResize($rcimage[0], $rcimage[1], 125); ?> /> <?php //Connect To Database pulls information $hostname='xxxxxx'; $username='yyyy'; $password='zzzzz'; $dbname='aaaaa'; $usertable='bbbbbbbbbb'; mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.'); mysql_select_db($dbname); $query = 'SELECT DISTINCT `IMAGEURL`, `NAME`, `CURRENCY`, `PRICE`, `BUYURL` FROM `bbbbbbbbbb` WHERE `NAME` LIKE \'%heli%\' LIMIT 0, 20 '; $result = mysql_query($query); if($result) { while($row = mysql_fetch_array($result)){ $imageurl=$row[0]; $name = $row[1]; $currency=$row[2]; $price=$row[3]; $buyurl=$row[4]; echo "<div class=\"contenttopcenter2\" <img src=\"$imageurl\" <?php echo imageResize($rcimage[0],$rcimage[1], 125); /> ?> $name, $currency, $price, $buyurl </div>"; } } ?> The piece of code I am having a problem is highlighted in red and orange color.
×
×
  • 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.