trq
Staff Alumni-
Posts
30,999 -
Joined
-
Last visited
-
Days Won
26
Everything posted by trq
-
Why wouldn't getProduct() already be returning the correct object types?
-
There's a pretty major floor in the INSERT statements. I forgot, you'll need to put the user_id in there too. INSERT INTO custom_settings (user_id, k, v) VALUES (19232, 'text-color', '#fff'); INSERT INTO custom_settings (user_id, k, v) VALUES (19232, 'background-color', '#666'); INSERT INTO custom_settings (user_id, k, v) VALUES (19232, 'max-post-per-page', '20');
-
Lots of ways it could be done, probably the simplest though is too simply store key => value pairs against a users id. So... you'd need a table. CREATE TABLE custom_settings ( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), user_id INT, k VARCHAR(80), v VARCHAR(80) ); Then, for say user 'thorpe' whos id is 19232, we store some settings. INSERT INTO custom_settings (k, v) VALUES ('text-color', '#fff'); INSERT INTO custom_settings (k, v) VALUES ('background-color', '#666'); INSERT INTO custom_settings (k, v) VALUES ('max-post-per-page', '20'); Then, when a user logs in you grab those settings and store them along with there session. // login code goes here. if ($result = mysql_query("SELECT k, v FROM custom_settings WHERE user_id = 19232")) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { list($k, $v) = $row; $_SESSION['custom_settings'][$k] = $v; } } } You can now use.... <?php echo $_SESSION['custom_settings']['background-color']; ?> wherever you need it and it will be custom for the logged in user. Of course the top few queries also need to be executed via php but that should be pretty simple to figure out.
-
Usually those settings are stored within a database, then applied as a user logs in.
-
What I need to post in 'Beta test your stuff'?
trq replied to eevan79's topic in PHPFreaks.com Website Feedback
You obviously didn't read the rules well enough. Have another look. -
Disable users from opening website on firefox
trq replied to markcunningham07's topic in Javascript Help
Websites need to be downloaded to be viewed so it doesn't matter what browser your users are using they can get your codes source. -
The files would either need to be saved with a php extension or you will need to configure your server to parse files with the css extension as php.
-
That is a very common error and would have nothing to do with Apache not starting. You'll need to check the error logs again.
-
GTK isn't a compiler so that should remove that from the list.
-
What error are you getting exactly?
-
We really don't need all that information. There are many different clients available for subversion. The command line 'svn' being the most popular. Most IDE's (that I've used anyway) simply provide another interface to the 'svn' command.
-
This is a VERY common request. http://www.crucialwebhost.com/blog/htaccess-apache-and-rewrites-oh-my/#add-www-to-domain
-
That code does not help us at all.
-
Do you have any code?
-
This wouldn't have anything to do with php. have a look at the produced html (view source) and see what that looks like.
-
need help posting php to a php file (page creation feature for template)
trq replied to blesseld's topic in PHP Coding Help
Its pretty hard to tell what is part of your current code and what you want in the file. Just remember that all single quotes within a single quoted string will need to be escaped. -
need help posting php to a php file (page creation feature for template)
trq replied to blesseld's topic in PHP Coding Help
This entire process defeats the purpose of using a language like php to create dynamic websites. Is the reason your doing things this way because you don't have access to a database? What about sqlite which is built into php5? -
You need to always do it within your code. At minimum a SELECT query should look something like.... <?php $sql = "SELECT foo FROM bar"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { // within here $result contains a valid result resource // which contains records. $row = mysql_fetch_assoc($result); } else { // no records found, handle error. } } else { // query failed, handle error. } ?>
-
What program are you using?
-
Make sure you have firebug installed within FF and get a decent editor.
-
There was a few syntax errors. $(document).ready(function() { $('#slidedown').toggle( function() { $('#form').slideDown("fast"); }, function() { $('#form').slideUp("fast"); } ); });
-
Those clicks don't belong there. $('#slidedown').toggle( function() { $('#form').slideDown("fast"); }), function() { $('#form').slideUp("fast"); }); );
-
Copy and Paste your actual code. We need your markup as well.
-
It appears you are missing the # hashs from the 'form' selectors.
-
O'Reilly have a great book on these very subjects. Can't remember excactly what its called or what revision it might be up too but just search there site.