
cmgmyr
-
Posts
1,278 -
Joined
-
Last visited
Never
Posts posted by cmgmyr
-
-
I'm making a "Hot or Not" site for one of my clients and I was just thinking about the rating system. How would the best way to handle a LOT of ratings and averages?
Option 1:
List everything in one big table. (id, userid, rating) then when a query is made it has to scan through all of this and get the average.
Option 2:
Use same table as above but add a "master" ratings table. (userid, total_rating, total_count) So that when I only have 1 row to query instead of 10,000+...
The reason why I want to keep the one big table is to keep track of who voted and what they rated but I know if I just kept this one only eventually it will slow everything down. I'm kind of leaning toward option 2, but that means that I would have to do and insert/update twice.
So...do you forsee any problems with using option 2? Do you have any other suggestions?
Thanks,
-Chris
-
yeah, I saw this the other day too...I got a good laugh out of it.
I think last year they did google romance or something like that which was pretty funny
-
-
you can combine html and php, but the page has to have a .php extension
-
you have to "save as webpage" then you can play around with the html
-
no problem, enjoy
-
yes that too...
-
mysql_connect("localhost", "username", "password") or die("Could not connect to mysql"); mysql_select_db("database") or die("Could not connect to database");
this allows you to connect to a database. You get your username and password when you set your mysql and database up.
hope this helps you out
-
i see a picture
-
-
I have a few clients that would like to easily import new data into their database...They download the current products in excel, make price changes, then upload the same excel file in the same format. Here is what I use:
<?php // mysql connection script ... // tab delimited file $file = "All_Catalog_Manufacturers.xls"; // open file $handle = fopen($file, "r"); $x = 0; echo "<table border=1>"; // loop through results with fgetcsv() function while(($data = fgetcsv($handle, 1000, "\t")) !== FALSE) { // populate field vars just to make it easier to work with .. // you could access the $data[] array directly in the sql if you want $field1 = $data[0]; $field2 = $data[1]; $field3 = $data[2]; $field4 = $data[2]; // etc ... // build your sql statement $sql = "insert into table set testid='1', category='foo', field1='".$field1."', field2='".$field2."', field3='".$field3."'"; //if($x >0) $result = mysql_query($sql); if($x >0) echo "<tr><td>$field1</td><td>$field2</td><td>$field3</td></tr>"; $x++; } echo "</table>"; // close file fclose($handle); ?>
***I just have that outputting to a table, but you can just comment out the echo to the table and un-comment the mysql query.
hope this helps
-
If you are using php on a linux machine you can use the system function.
http://uk2.php.net/manual/en/function.system.php
Or if you are using Windows machines, you can use shell_exec function.
example:
$Info = explode("\n", shell_exec(".\\progs\\program.exe"));
Will dump the output of program.exe in folder /progs/ to $Info using next line carriage as the exploder/seperator.
*From: http://www.daniweb.com/techtalkforums/thread15662.html
-
the best thing to do is set up a static IP for the computer that you are running it on, then find out what port apache is running on. now you can go to any other computer on the intranet and type in your ip and port in a browser and it should come up: (http://192.168.0.21:80)
-
no it's pretty easy (atleast to do the table version)
once you get into CSS its a little tricky with some things but once you work with it more it becomes second nature
-
take a look at these:
http://gr0w.com/articles/code/css_stylesheet_switcher_using_php_javascript_free/
http://www.dotphp.co.uk/articles/stylesheet_switcher_php.php
hope that gets you going
-
take a look at this: http://www.eyesondesign.net/pshop/slicing/images.htm
you pretty much have to slice up your images and "save for web" with html and images selected. this will output a table with all of your sliced images in it. If you want to add another step look into CSS layouts and convert the tables into CSS
-
Yeah I checked that out today too...looks pretty cool
-
You might want to try one more thing...
- plug a computer directly into the modem and make sure you can get to the internet.
- View the network details settings (IP address, Default Gateway, etc...) and take a note of DNS 1, 2, and maybe 3.
- Reconnect the router and the 2 PCs to the router.
- See if they are picking up the DNS IPs. If they arent you are going to have to manually configure them to what you wrote down from above
-
yes, that is correct
-
Just do what I did with mysql_real_escape_string
-
haha nice
-
try doing:
$query = "SELECT * FROM $db.person WHERE id = $personid"; $result = mysql_query($query); $count = mysql_num_rows($result); echo $count;
see what that does
-
it cuts down on SQL injection attaks to your DB.
You should also use MD5 encryption for your passwords in your database.
$md5_pass = md5($password);
-
You should probably also do something like this too:
$safe_username = mysql_real_escape_string($_POST['username']); $safe_password = mysql_real_escape_string($_POST['password']);
PSD to HTML for website
in HTML Help
Posted
sounds like you have to slice it