Jump to content

mds1256

Members
  • Posts

    259
  • Joined

  • Last visited

Everything posted by mds1256

  1. Hi I am looking to develop a public facing website and would like some good practice info on php, what you should and shouldnt do and which way to do things, e.g. for security and efficiency, etc. I have read through the PHP security guide from the PHP Security Consortium and was really good, does any one have any more info like this regarding PHP and general good practice Thank you
  2. Thanks for the replies! very useful
  3. no. you have to SEND the value to the function when it's called. if you don't send a variable, the default 0 will be used. // something causes an error, so you set the error id before calling the function $error_id = 123; // Call the function, passing the value displayError($error_id); // Note: the name of the passed variable is ignored by the function, so it can be anything. thanks! thats what im after!
  4. so i take it that 0 will be a default but what happens then if it is declared, will it take the declared errorID rather than the 0?
  5. Hello I am wanting to host my site that has the following attributes: Php site and mysql backend. Hits per day: 5000 ish Page views per day: 15000 ish Site is used to share photos so php GD library will need to process picture compression etc. What kind of server will host this. do you think a shared server would host this ok or should i go VPS or dedicated? What spec server should i be looking at (Memory / processor) Thanks
  6. Thanks for the reply. I will put the code together to show you what i mean then will post back.
  7. Thats fine but if i cannot use global variables then how do i pass this $errorID over?
  8. Hello I've have read that global variables should not be used. so if i have 2 .php files: index.php - main content php file sitefunctions.php - php functions site file on my index.php page i have the following (an example of my problem): <?php displayError($errorID); ?> and in the sitefunctions.php file i have the following (an example of my problem): <?php function displayError($errorID) { if($errorID == 1) { echo "Password Failure"; } else { echo "Other Failure"; } } ?> now that works but since when first accesing that page the $errorID is not set then i get an error. How can i achieve this without first setting a blank $errorID global variable? Thanks
  9. all sorted using the example above. Thanks again!
  10. do you have an example of the preg_replace method, as i've just tried this with no luck, cannot seem to get the syntax correct with the example you have provided? Thanks again
  11. Hello I have a form that takes an input, i want to replace 2 parts within the string see example <object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/fT7rCWZvsD8?fs=1&hl=en_GB"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/fT7rCWZvsD8?fs=1&hl=en_GB" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object> This is just an example but i want to replace all occurances of width="****" and height="***" with width="300" height="198" but the width and height are not always the same from the source so need a way to pickup - height="385" then replace what ever is after that first speech mark and the last speech mark Any ideas?
  12. Order a pint and im paying lol Perfect Thanks again!!!!
  13. $nid = 65 ------- an example Select title, body, picdescription, piclink, date_format(date, '%D %M %Y' ) as convDate from news, newspic where news.id = $nid and newspic.newsid = $nid This query works perfect when the linked record is in both tables, but if the record does not exist in the 'newspic' table it doesnt even return the result from the 'news' table. Please bear in mind the way this works is to return all the results from 'newspic' table (which could be multiple results) where the news.id and newspic.newsid matches. Any idea how i can return the result even if the newspic table contains no matching records I have tried an LEFT JOIN but cannot work out the exact way to do it? Thanks
  14. sorted myself, just came to me... needed to do a group by on news.id
  15. Hello I have the below query pulling data from 2 tables: news - where news is stored newspic - where news pictures are stored (usually many pics for the same news article news table: id title date body newspic table: id newsid picdescription piclink piclinkthumb type Query: SELECT news.id, title, date_format(date, '%D %M %Y' ) as convDate, piclink, SUBSTR(body,1,110) as bodySub from news, newspic where news.id = newspic.newsid order by date desc but it still returns multiple entries for the same article (returns the same news article as many times as their are pics) so what join do i need to do to only return one of each no matter how many pics there are
  16. Hello Im trying to achieve the following output (see the below table. Then on a new row have the next 4 pieces of data that is pulled from the database. So i want the table to automatically have a new row after every 4 cells e.g. 1st piece of data 2nd piece 3rd piece 4th piece 5th piece of data 6th piece 7th piece 8th piece etc etc, until there is no more results within the database to pull back, i guess its a bit like pagination but rather rowination Any one point me in the right direction on what i need to do
  17. sorted with the following sql select distinct(p.name) dname, (select min(date) from calendar where name = dname) as date1, (select max(date) from calendar where name = dname) as date2 from calendar p
  18. hello I currently have 1 table with the following columns: id | name | date and with the following data as an example: 1, test1, 2010-11-25 2, test2, 2010-10-21 3, test1, 2010-11-26 4, test3, 2011-01-01 and what i am wanting to do is get a select statement that selects 'name' and 'date' but where the name exists twice i need to select that 2nd date as another column, so in the ideal world i need the following from a select statement: id | name | date | date2 1, test1, 2010-11-25, 2010-11-26 2, test2, 2010-10-21 4, test3, 2011-01-01
  19. WOW, that was very quick and works perfect! Many thanks for this help!
  20. Table: news id | title | date | body | picturelocation int varchar(255) date longtext varchar(100)
  21. Hello I am after some guidance on the following scenario: I have a news page that pulls from a database and would like to seperate it out by year, see below 2010 Bulletin 2 - 23/11/2010 - Some news here..... Bulletin 1 - 21/11/2010 - Some news here..... 2009 Bulletin 2 - 23/11/2009 - Some news here..... Bulletin 1 - 21/11/2009 - Some news here..... How can i do this automatically and seperate them out by year like above
  22. http://demo.themify.me/bloggie/ I like the way the banner presents itself and would find it useful if i could find the name of this jquery effect
  23. Hey Thanks, think I may have been confused. I found what i was trying to do e.g. If i wanted to update a field's data within a table and replace part of a piece of data but see what it would look like first i would do the following before running an update script: select replace(location, 'UK', 'London') from table this would show me what the table would look like after the query has ran, then once im happy i can run the update script. Thanks for the comments
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.