Solved

rating product with ajax script 5star

Posted on 2014-04-29
4
909 Views
Last Modified: 2014-05-01
I am almost a New in php and also in programming, but I need to do some things in my web. I want to put ajax rating script with 5 stars in my website, but i dont know how to correctly put in my folders. I am using Codeignter and my web folder is calling "svetaine" .

Where i get code is here http://coursesweb.net/php-mysql/rating-stars-script-ajax-php_s2

My code php is looking like this:


    <h3>Mobilieji Telefonai</h3>
    <form method='get'>
    <?php
     //check if the starting row variable was passed in the URL or not
     if (!isset($_GET['startrow']) or !is_numeric($_GET['startrow'])) {
     //we give the value of the starting row to 0 because nothing was found in URL
     $startrow = 0;
     //otherwise we take the value from the URL
    } else {
    $startrow = (int)$_GET['startrow'];
    }
     //this part goes after the checking of the $_GET var
     $fetch = mysql_query("SELECT * FROM telefonai order by prioritetas LIMIT $startrow,  5")or
     die(mysql_error());
    $num=Mysql_num_rows($fetch);
        if($num>0)
        {
        echo "<table border=2  >";
        echo "<tr><td>Telefono pavadinimas</td><td>Nuotrauka<td>Kaina</td>   <td>Parduotuve</td><td>Nuoroda</td></tr>";
        for($i=0;$i<$num;$i++)
        {
        $row=mysql_fetch_row($fetch);
        echo "<tr>";
        echo"<td>$row[1]</td>";
		echo "<td>   <img src=\"{$row[5]}\"  width=75  height=75/>    </td>";
        echo"<td>$row[2] LT</td>";
		echo"<td>$row[3]</td>";
	    echo "<td><a href=\"{$row[4]}\"><img   src=\"".base_url()."images/parduotuve.png\" /></a></td>";
        echo"</tr>";
        }
        echo"</table>";
        }
    //now this is the link..
    echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+10).'">Sekantis</a>';

    $prev = $startrow - 10;

    //only print a "Previous" link if a "Next" was clicked
     if ($prev >= 0)
    echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.$prev.'"> Buves</a>';
    ?>
    </form>
    </body>
    </html>

Open in new window


Have product database, and need that product should have rating and rating_counts. I Think this script can do this. So from where start to put script in my web folders?
0
Comment
Question by:Nekasas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 40029824
If you're new to PHP and want to get a foundation in how web applications work, you may find this article helpful.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11769-And-by-the-way-I-am-new-to-PHP.html

The design for a voting and star rating system is shown in this article:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/A_5256-Simple-Vote-Counting-in-PHP-and-MySQL.html
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 40034264
@Nekasas: Please explain why you gave a marked-down grade without comment or any followup questions.  We don't do something like that at EE without giving our colleagues an explanation.

For your reference you may find the Grading Guidelines here:
http://support.experts-exchange.com/customer/portal/articles/481419

Looking forward to hearing from you. ~Ray
0
 

Author Comment

by:Nekasas
ID: 40034287
I am sorry if I offend you. Maybe then I want more than just link's, but I realized no one can do my jobs except me, so I will just keep doing my job and in another question I will be more friendly
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 40034290
I'm not offended -- I just want to understand if my answers were deficient, what was expected?  Work in an online forum like EE often requires a little more conversation!
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

731 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question