Solved

rating product with ajax script 5star

Posted on 2014-04-29
4
891 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 108

Accepted Solution

by:
Ray Paseur earned 500 total points
Comment Utility
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 108

Expert Comment

by:Ray Paseur
Comment Utility
@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
Comment Utility
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 108

Expert Comment

by:Ray Paseur
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now