Solved

rating product with ajax script 5star

Posted on 2014-04-29
4
897 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
  • 3
4 Comments
 
LVL 109

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 109

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 109

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

831 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