Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

rating product with ajax script 5star

Posted on 2014-04-29
4
Medium Priority
?
916 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 111

Accepted Solution

by:
Ray Paseur earned 1500 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 111

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 111

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
The viewer will learn how to dynamically set the form action using jQuery.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

715 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