Welcome to WebmasterWorld Guest from 54.147.212.98

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Need help getting database schemas

   
11:54 am on Apr 18, 2012 (gmt 0)




System: The following message was cut out of thread at: http://www.webmasterworld.com/php/4439894.htm [webmasterworld.com] by eelixduppy - 7:37 am on Apr 18, 2012 (est -5)


hi eelixduppy,

I am here again with a another small problem ,

I recently got a 5 star rating script but it does not have Sql file can you tell me what the structure of the data base and tables based on this coding ?
-


<?php
// connect to database
$dbh=mysql_connect ("localhost", "root", "") or die ('Cannot connect to the database');
mysql_select_db ("test",$dbh);

if($_GET['do']=='rate'){
// do rate
rate();
}else if($_GET['do']=='getrate'){
// get rating
getRating();
}

// function to retrieve
function getRating(){
$sql= "select * from vote";
$result=@mysql_query($sql);
$rs=@mysql_fetch_array($result);
// set width of star
$rating = (@round($rs[value] / $rs[counter],1)) * 20;
echo $rating;
}

// function to insert rating
function rate(){
$text = strip_tags($_GET['rating']);
$update = "update vote set counter = counter + 1, value = value + ".$_GET['rating']."";

$result = @mysql_query($update);
if(@mysql_affected_rows() == 0){
$insert = "insert into vote (counter,value) values ('1','".$_GET['rating']."')";
$result = @mysql_query($insert);
}
}
?>
12:37 pm on Apr 18, 2012 (gmt 0)

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



>> can you tell me what the structure of the data base and tables based on this coding ? -

No.