PHP - What's Your Opinion
On my web site I have users, each user has his/her individual profile. Currently in the profile its just information like name, user name, favorites, ect. (Information Stuff) I want to add the feature of profile image. (Pictures associated with each profile)
But i want the pics to only be able to be seen associated with that person (I dont want you to be able to get the images exact url and be able to get that pic off the internet) So what is the best way to do it? Is there a way to put the pics in mySQL? XML? Other Option? What's your opinion? Similar TutorialsOn one of my pages, I have 1 form, which just a few text boxes / check boxes. Currently, I have the form submit a new record into the DB and then refreshes the entire page to show the new result. My question is, should I display all records using JQuery or PHP. PHP refreshed the whole page, thus more queries are run per page. Does it matter much? Thanks. Started learning PHP a few weeks ago, I want to ask if anyone can give me some feedback (warnings, pointers, ...) about some code I wrote, with the objective to learn more about functions as well as MySQL. I created three functions, one to create a new table (in an existing DB), one to add a new Record and one to delete an existing record. Next I want to try to use an array as parameters for these functions. Code: [Select] <?php require 'DB.php'; // Connection string mysql_connect("localhost", "root", "") or die(mysql_error()); /* echo "Connected to MySQL<br />"; */ mysql_select_db("test") or die(mysql_error()); /* echo "Connected to Database"; */ // Create a MySQL table in the selected database function newTable($tableName) { mysql_query("CREATE TABLE IF NOT EXISTS $tableName ( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), age INT)") or die(mysql_error()); } // Insert Two values in the corresponding rows in table $tableName function newRecordTwoVal ($tableName, $recordName1, $recordName2, $recordVal1, $recordVal2) { $myQuery=mysql_query("SELECT * FROM $tableName WHERE $recordName1=$recordVal1 AND $recordName2='$recordVal2';"); $doesItExist= mysql_fetch_array($myQuery); if ($doesItExist) { print ('Person already exists'); } else { mysql_query("INSERT INTO $tableName ($recordName1, $recordName2) VALUES('$recordVal1', '$recordVal2'); ") or die(mysql_error()); echo "Data Inserted!"; } } function delRecord ($tableName, $recordName1, $recordName2, $recordVal1, $recordVal2) { $myQuery=mysql_query("DELETE FROM $tableName WHERE $recordName1=$recordVal1 AND $recordName2='$recordVal2';"); } newTable('Moderators'); newRecordTwoVal ('Moderators', 'age', 'name', '40', 'Jack'); delRecord('Moderators', 'age', 'name', '40', 'Jack'); ?> This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=356626.0 Hello!
I have five websites on a single server, and each website uses the same geographic data, for instance US zip codes and city/state latitudes and longitudes. Each website uses it's own copy of these "large" tables.
I would like to avoid having to maintain the same data in 5 databases, but I am more concerned with database performance, e.g., the speed at which the data is retrieved for each website.
Question: Should I set up a new separate database that contains the shared tables for all websites and allow each website to connect to this new database for shared data? Or is it better for each website have it's own copy of the duplicate tables?
Thanks for any info!
Cheers
|