
jdavidbakr
Members-
Posts
271 -
Joined
-
Last visited
Everything posted by jdavidbakr
-
Control what a user sees based on User account setting
jdavidbakr replied to stuaz's topic in PHP Coding Help
I like the sound of both. lol. I am doing the website for different "regions" of the country, so one region sees other "button" than another, etc. So it would be good to do: Region A sees buttons A,B,C Region B sees buttons 1,2,3? That makes sense. It pretty much boils down to coming up with a schema that fits your requirements. If each user has a region value in their table, then you just link the regions to the buttons that they see and you should be good to go. -
I think requinix is right - there are two values you need to change in php.ini: upload_max_filesize and post_max_size
-
Control what a user sees based on User account setting
jdavidbakr replied to stuaz's topic in PHP Coding Help
Depending on what level you need to control it, you probably will need to make a table that defines what buttons each user sees. Then do a select from that table to get the buttons (using the logged in user_id), and iterate through the result set to draw each button. If your buttons table had three columns - user_id, link, and button_image, you could draw it with something like this: $statement = "select * from buttons where user_id = '{$login_id}'"; $result = mysql_query($statement); while ($row = mysql_fetch_assoc($result)) { echo '<a href="'.$row['link'].'"><img src="'.$row['button_image'].'"></a>'; } -
$result = mysql_query("SELECT * hours WHERE member='$user'");
jdavidbakr replied to madjack87's topic in PHP Coding Help
Also ... you might change your query to: $query = "SELECT * from hours WHERE member='$user'"; -
Something like this? Assuming the link column contains your e-mail address (since you don't have an e-mail column defined) insert into Classified select NULL, user, description, '[email protected]', img1, published where link like '[email protected]' The NULL for the PK will put in the next auto-increment value, the other columns will be filled by the matching rows except for the 4th (link) which will be replaced by the new e-mail address.
-
Are you wanting to use LEFT JOIN instead? That will find the match in the Members table and then join the other two tables, leaving their columns NULL if there is no match. You should also join against the foreign keys instead of putting the constant in each join. Assuming m_id is the Member table's primary key: SELECT * FROM Members LEFT JOIN MemberMartialArts on MemberMartialArts.mma_memberId = Members.m_id LEFT JOIN MemberAbilities on MemberAbilities.ma_memberId = Members.m_id WHERE Members.m_id = '$memberId'
-
On that note, most ISP's block port 80 inbound anyway.
-
Must be a difference between the Windows and Linux versions of php, I get: $ php -r "echo date('r', strtotime('first day', 1291064453));" Tue, 30 Nov 2010 15:00:53 -0600 php 5.2.13 on Linux I don't know what I would expect 'first day' to return, and don't see an official list of commands in the strtotime() manual page.
-
Why do you want to do that? It would make more sense to do a join instead of storing the same data in two tables.
-
The easiest might be to put the three dates into an array as timestamps and sort the array. Then you can just implode that array for your output.
-
Maybe just echo date('m/1/y', 1291064453);
-
Try date_default_timezone_set() to change your script into your own time zone. Great tutorial on working with dates and times here: http://www.phpfreaks.com/tutorial/working-with-dates-in-php
-
Are you sure you're getting a row in your query? Try echoing the query right after you compose it and double-check it by copying it into phpMyAdmin.
-
Depends on what all you need it to do - but yes, that's likely what you'll want to do. You can have the enddate field set to NULL if there is no range. I did a calendar app once that had events on a day or a range of days, and did just that - if the end date was null, it was on a single date, otherwise it spanned from the start date to the end date.
-
check if a date is 10 days beyond another date
jdavidbakr replied to jeff5656's topic in PHP Coding Help
Assuming $row['duedate'] is a DATE or DATETIME format: if (strtotime($row['duedate']) < strtotime("+10 days")) { ... } -
If you look at the source code you'll see that it's printing "Copyright © <?php echo date("Y"); ?> - The Veitch Law Firm – All Rights Reserved" - which means that the page is not being parsed as PHP. Either the functionality is disabled on your server, or you might need to try one of the other methods on that link I sent.
-
Ah, you're wanting to force the html page to parse as php? You can do this in .htaccess, yes, add this line: AddType application/x-httpd-php .html If that doesn't work, here's a handful of other methods: http://www.velvetblues.com/web-development-blog/how-to-parse-html-files-as-php/ This will make the server treat any file with the .html extension as if it had the .php extension.
-
If you want to send the server's date in an html page, it has to happen as you create the html on the server. You can't instruct the client to do this with an html tag.
-
You're missing a closing ")" in your call to hvataj()
-
ob_start but css still renders layout late in ff
jdavidbakr replied to scottieclark's topic in PHP Coding Help
Wasn't too noticeable on my FF on OSX. Any reason you're using a php file for the css? It's possible that since it's a php file there may be some disabled caching where it's fetching the stylesheet on each page load. It could also be that it's taking just enough time to draw the stylesheet in php that firefox is displaying the page before it's completely received the stylesheet, while the other browsers are waiting to show anything until they finish loading the stylesheet. (Those are guesses, I don't know if any of those thoughts have any element of fact to them but they sound good) -
Storing information in mysql, viewing it and editing it
jdavidbakr replied to Cowprint's topic in MySQL Help
You'll need to have either a separate form for editing or modify your form to include a way to look up the current information. You need to tell the form which row you're editing, so you might put it into the query string, something like form.php?id=15 - and then as you build your form, retrieve the row with id 15 and use those values to populate the form. You also might want to include a hidden input type to store the ID, so when you process the submission you know whether you are editing an existing row or adding a new one. As for styling in the database, if I understand your question, you don't do any styling in the database. As you draw the page that has the info in the database you style it using the html/php code. The data in the database is just that - raw data. -
Are your dates being stored as a numeric or string type? I think if you're using something like VARACHAR 26 will come before 8 (because it's sorting by character, not number). Change your row to something like TINYINT and it should sort as you expect.