Jump to content

lukeUrtnoedki

New Members
  • Posts

    9
  • Joined

  • Last visited

lukeUrtnoedki's Achievements

Member

Member (2/5)

0

Reputation

  1. the warning says to move all item elements to the bottom of the channel, arent they allready?
  2. Ya, dont understand the warning, Do you see the issue?
  3. ok made some corrections. But am having a hard time figuring out this last error https://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fphp_class.teamluke.net%2FAssignment_9%2Frss.php
  4. ok, made a few changes and this is where im at. https://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fphp_class.teamluke.net%2FAssignment_9%2Frss.php Every error occurred 10- times so the problem is everything in the while loop while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo '<item>'; echo ' <link>http://php_class.teamluke.net/Assignment_9/product.php?Code='.$row['productCode'].'>'; echo ' <title>' . $row['productName'] . '</title>'; echo ' </link>'; echo ' <category>' . $row['productLine'] . '</category>'; echo ' <source>' . $row['productVendor'] . '</source>'; echo ' <description><![CDATA[' . $row['productDescription'] . ']]></description>'; echo ' <Price>$' .number_format($row['buyPrice'], 2) . '</Price>'; echo '</item>'; } I sort of guessed on what tags to use (out of the ones I can) and I had no idea how to use a tag to describe the price. Thanks for your help thus far
  5. ok, then Im stuck on one problem, heres my assignment Your RSS feed is to display these fields: Product Name Product Line Product Scale Product Vendor Product Description Buy Price formatted in US dollarsThe product name of each feed item, is to be a link to a product page. You may choose the format of the remaining item data. I have most of it down, but looked at the available tags and made some guesses, is this ok? <?php header('Content-Type: text/xml'); ?> <?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <rss version='2.0'> <channel> <title><![CDATA[Assignment 9 - Newsfeed]]></title> <link>http://teamluke.net/</link> <webMaster>lurtnowski@gmail.com</webMaster> <description><![CDATA[The trials & Tribulations of Luke Urtnowski as I complete this assignment.]]></description> <language>en-us</language> <image> <title>Luke Urtnowski</title> <url>http://php_class.tea...images/luke.jpg</url> <link>http://php_class.tea...images/luke.jpg</link> <description><![CDATA[The trials & Tribulations of Luke Urtnowski as I complete this assignment.]]></description> </image> <?php require_once('db/conn.php'); try { $stmt = $conn->prepare('SELECT productCode, productName, productLine, productDescription, productVendor, buyPrice FROM `products` WHERE productLine = "Trains" OR productLine = "Vintage Cars" ORDER BY timeStamp ASC LIMIT 10'); $stmt->execute(); if($stmt->rowCount()) { while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo '<item>'; echo ' <link>http://php_class.teamluke.net/Assignment_9/product.php?Code='.$row['productCode'].'>'; echo ' <title>' . $row['productName'] . '</title>'; echo ' </link>'; echo ' <category>' . $row['productLine'] . '</category>'; echo ' <source>' . $row['productVendor'] . '</source>'; echo ' <description><![CDATA[' . $row['productDescription'] . ']]></description>'; echo ' <Price>' // I looked and couldn't figure out if my code in the while loop makes sence. // Does it to you? .number_format($row['buyPrice'], 2) . '</Price>'; echo '</item>'; } } } catch(PDOException $e) { echo 'ERROR: ' . $e->getMessage(); } ?> </channel> </rss> I looked and couldn't figure out if my code in the while loop makes sence.Does it to you? When i try to validate it, I get soo many errors though... https://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fphp_class.teamluke.net%2FAssignment_9%2Frss.php
  6. I have a pretty simple form php_class.teamluke.net/ajax/send.php and am trying to use ajax to link to it, so it can be read by a php page, heres the script <script> function showCar(str) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("myForm")..style.display = none; document.getElementById("result").style.display = block; document.getElementById("result").innerHTML = this.responseText; } }; xhttp.open("GET", "showCar.php?id="+str, true); xhttp.send(); } </script> but the php page works... php_class.teamluke.net/ajax/showCar.php?id=1
  7. I'm trying to create a page which asks for 5 alphanumeric numbers It then creates an image out of the input (if its valid) php_class.teamluke.net/Assignment_8/index.php (attachment) As of now, I get an image, the background, lines, and pixels all over the place I'm trying to figure out how to add each character (which is to be rotated 10 degrees from the last character) to that image. My best guess is to create an image out of each character, rotate it, then add it to the other image. Heres what I have so far... function displayImage($input) { //create a blank image (width & height) and assign it to a variable $my_img = imagecreate( 200, 50 ); //get the background ready (using RGB values) $background = imagecolorallocate( $my_img, 255, 230, 230 ); //get the text color ready (using RGB values) $text_color = imagecolorallocate( $my_img, 102, 0, 0 ); //line (also using RGB) $line_color = imagecolorallocate( $my_img, 0, 0, 0 ); //fill the image with background imagefill( $my_img, 0, 0, $background); imagesetthickness ( $my_img, 5 ); //create a border (start_x, start_y,end_x,end_y) imageline($my_img, 0, 0, 0, 50, $line_color); imageline($my_img, 200, 0, 200, 50, $line_color); imageline($my_img, 0, 0, 200, 0, $line_color); imageline($my_img, 0, 50, 200,50, $line_color); //add random lines $line_color = imagecolorallocate( $my_img, 204, 0, 0 ); imagesetthickness ( $my_img, 2 ); imageline($my_img, rand(0,200), rand(0,50), rand(0,200), rand(0,50), $line_color); imageline($my_img, rand(0,200), rand(0,50), rand(0,200), rand(0,50), $line_color); imageline($my_img, rand(0,200), rand(0,50), rand(0,200), rand(0,50), $line_color); imageline($my_img, rand(0,200), rand(0,50), rand(0,200), rand(0,50), $line_color); imageline($my_img, rand(0,200), rand(0,50), rand(0,200), rand(0,50), $line_color); //add a few pixels $line_color = imagecolorallocate( $my_img, 0, 0, 0 ); for($i=0;$i<=1000;$i++) { imagesetpixel($my_img, rand(0,200),rand(0,50), $line_color); } // # of characters $l = strlen($input); //do stuff to each char for ( $i = 0; $i < $l; $i++ ) { $char = substr( $input, $i, 1 ); //char contains the current character so make $char an image $char_img = imagecreate(10,50); //fill the image with background imagefill( $char_img, 0, 0, $background); imagestring($char_img, 5, 0, 20, $char, $text_color); //wouldn't this rotate $char_img by 10 degrees and set its background to the main images imagerotate($char_img, ($i * 10), $background); //copy new image to main image //imagecopy ( resource $dst_im , resource $src_im , int $dst_x , int $dst_y , int $src_x , int $src_y , int $src_w , int $src_h ) imagecopy( $my_img, $char_img, 20, 50, 0, 0, 10, 50); } //place user input on the dynamic image (font size,x,y,text,font color) // display image, or add second parameter to save it (imagepng($my_img,"Dynamic_image.png") imagepng( $my_img ); //free resources just to be sure imagecolordeallocate( $my_img, $text_color ); imagecolordeallocate( $my_img, $background ); imagedestroy( $my_img ); } any ideas?
×
×
  • 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.