Jump to content

tazeha

Members
  • Posts

    34
  • Joined

  • Last visited

Posts posted by tazeha

  1. sorry, but I dont have only code.. I saw the tutorial but , don't know how save the varible title ,.. save to table.

     

    first , I do connect the mysql with this code ..

    $con=mysqli_connect("example.com","peter","abc123","my_db");// Check connectionif (mysqli_connect_errno()) {  echo "Failed to connect to MySQL: " . mysqli_connect_error();}

    but, after this I don't know how do save in table..

     

    founded one code than save in table but so I don't know.

     

    http://stackoverflow.com/questions/13868799/storing-php-simple-html-dom-results-to-mysql-db

  2. I using PHP Simple HTML DOM Parser .

    Now I write the mini script .

    This script find the products online shopping with price.

    <?phpinclude_once('simple_html_dom.php');// Create DOM from URLheader("Refresh: 300;");$html = file_get_html('http://wpu.ir/v3128');$articles = array();// Find all article blocksforeach($html->find('div#content') as $article) {    $item['title']     = $article->find('h1', 0)->plaintext;    $item['intro']    = $article->find('h3', 0)->plaintext;    $item['details'] = $article->find('span.finalprice', 0)->plaintext;    $articles[] = $item;}echo $title="<b>نام محصول:</b>". $item['title'] . "</br>  ";echo  $dec="<b>توضیحات:</b> ". $item['intro'] . "</br> "; echo $pr="<b>قیمت:</b> ". $item['details'] . " </br> ";  //to fetch all images from a webpage$images = array();foreach($html->find('img') as $img) { $images[] = $img->src;}echo " $images[29]";?> 

    I have save price in table database mysql.. how can?

  3. I using PHP Simple HTML DOM Parser .

    Now I write the mini script .

    This script find the products online shopping with price.

    <?phpinclude_once('simple_html_dom.php');// Create DOM from URLheader("Refresh: 300;");$html = file_get_html('http://wpu.ir/v3128');$articles = array();// Find all article blocksforeach($html->find('div#content') as $article) {    $item['title']     = $article->find('h1', 0)->plaintext;    $item['intro']    = $article->find('h3', 0)->plaintext;    $item['details'] = $article->find('span.finalprice', 0)->plaintext;    $articles[] = $item;}echo $title="<b>نام محصول:</b>". $item['title'] . "</br>  ";echo  $dec="<b>توضیحات:</b> ". $item['intro'] . "</br> "; echo $pr="<b>قیمت:</b> ". $item['details'] . " </br> ";  //to fetch all images from a webpage$images = array();foreach($html->find('img') as $img) { $images[] = $img->src;}echo " $images[29]";?> 

    I have save price in table database mysql.. how can?

  4. Hello

     

    I using PHP Simple HTML DOM Parser .

     

    Now I write the mini script .

     

    This script find the products online shopping with price.

     

    but one problem is.

    <?phpinclude_once('simple_html_dom.php');// Create DOM from URLheader("Refresh: 300;");$html = file_get_html('http://wpu.ir/v3128');$articles = array();// Find all article blocksforeach($html->find('div#content') as $article) {    $item['title']     = $article->find('h1', 0)->plaintext;    $item['intro']    = $article->find('h3', 0)->plaintext;    $item['details'] = $article->find('span.finalprice', 0)->plaintext;    $articles[] = $item;}echo $title="<b>نام محصول:</b>". $item['title'] . "</br>  ";echo  $dec="<b>توضیحات:</b> ". $item['intro'] . "</br> "; echo $pr="<b>قیمت:</b> ". $item['details'] . " </br> ";  //to fetch all images from a webpage$images = array();foreach($html->find('img') as $img) { $images[] = $img->src;}echo " $images[29]";?> 

    the product's detail's.

     

    name

     

    price

     

    image

     

    description

     

    ...

     

    in this loop

    foreach($html->find('img') as $img) { $images[] = $img->src;}echo " $images[29]"; 

    only display the image url not imge.

     

    please help

     

  5. I have to display random photo using array and rand function.

    Now I would add text under each photo(For example, the words of the elders text with image)

    my code:

    What do I do?

    
    
    <?php$images=array(    array('file'=>'pic1','alt'=>"Your Description About pic1"),    array('file'=>'pic2','alt'=>"Your Description About pic2"),    array('file'=>'pic3','alt'=>"Your Description About pic3"),    array('file'=>'pic4','alt'=>"Your Description About pic4"),    array('file'=>'pic5','alt'=>"Your Description About pic5"),    array('file'=>'pic6','alt'=>"Your Description About pic6"),    )    $i=rand(0,count($images)-1);    $selectimage="newfolder/{$images[$i]['file']}.jpg";    $alt=$images[$i]['alt']; if (file_exists($selectimage) && is_readable($selectimage))    $imagesize= getimagesize($selectimage);?>

    view in html

    <img src="<?php echo $selectimage;?> "  alt="<?php echo $alt ; ?>" <?php echo $imagesize[3] ; ?> /> 
×
×
  • Create New...