Jump to content

laPistola

Members
  • Posts

    245
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

laPistola's Achievements

Member

Member (2/5)

0

Reputation

  1. News isn't a reserved word as well is it?? It works without me exiting the word news. Thanks anyway!
  2. $return is not set unless $id is not empty try putting: $return = "" in the else of the condition if($id != ""):
  3. Do you have access to PHPMyAdmin on the MySQL server? If you do you can always just export the data including all the table config using the tabs across the top.
  4. Probably need more info but if I understand you just need to use a comma on your ORDER BY clause eg: ORDER BY premium, name ASC How ever you will need to switch the code value. If its a premium profile then it needs to be 0 and if not a 1.
  5. MYSQL: 5.1 Hello This is the line of code "SELECT * FROM news WHERE (show >= ".$tdate." AND expire < ".$tdate.") OR (show = 00000000 AND expire < ".$tdate.") AND (show = 00000000 AND expire = 00000000) ORDER BY `order`, title ASC" The error is You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'show >= 20111112 AND expire < 20111112) OR (show = 00000000 AND expire < 2011111' at line 1 show and expire are both date fields in the DB, $tdate is todays date in the format yyyymmdd Generally I need the record to show if both show and expire = 00000000, If show is of the days date or the date has pasted AND it hasn't gone past the expire date. Also I need the records to show if either date = 00000000 and there show on or expire condition is true. I have gone through many of websites, looked at examples and can't see where my issue is. Thanks in advance
  6. it works perfect now. If it helps anyone this is my code $file = urldecode($_GET['file']); if(file_exists($file)) { header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file)); header("Cache-Control: no-cache"); header("Pragma: no-cache"); ob_clean(); flush(); readfile($file); header("Location: ".urldecode($_GET['return'])); } else { header("Location: ".urldecode($_GET['return'])."&status=fileErr"); }
  7. Thank you, Thank you and Thank you The mod_header wouldn't be ideal as the file could be one of about 30 different formats. Ill use the readfile() method, looking at the php manual its the perfect solution. Did I thank you
  8. Now I have done just this but its not working, but i bet that is my code which is at fault as I didn't think my method would work as it basically loaded a new page without the header info. My first way was: <?php // stop cashing header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); ?> <a href="file.doc" target="_blank">Click here</a> and my second was in it basic form <?php // stop cashing header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header("Location: file.doc"); ?>
  9. Hello PHP 5.3 Im looking for a solution to a problem. A site im building stores documents. You can then upload a newer version of that document that overrides the old document. But if you viewed the first document when trying to view the new document it loads the old one up unless you clear your internet files inbetween. Is there a way to make the site not download the file to the clients computer or a way to delete the clients local temp version before downloading and opening the new document?
  10. PHP 5.3 MySQL 5.1 Hello Im building some software for a training company and they require that there students upload evidence documents. Each document needs an id number starting from 1. Each student needs to start from 1. I have one table that holds all the data for the evidence so using a auto increment in the DB column is not suitable. In the students table there is a column "file_tally" that starts from 1 and increases every time they submit evidence. This tally number is stored in the evidence row also. This is the code: // find tally value mysql_select_db($dbn,$db); $tsql = "SELECT file_tally FROM students WHERE sid = ".$_SESSION['student_id']; $tquery = mysql_query($tsql,$db) or die(mysql_error()); $tally = mysql_result($tquery,0); intval($tally)++; // update tally $utsql = "UPDATE students SET file_tally = '".$tally."' WHERE sid = ".$_SESSION['student_id']; if(isset($_SESSION['student_id']) && !empty($_SESSION['student_id'])) { mysql_query($utsql,$db) or die(mysql_error()); } // insert record $sql = "INSERT INTO evidence (`file`,sid,tally) VALUES ('".$name."','".$_SESSION['student_id']."','".$tally."')"; mysql_query($sql, $db) or die(mysql_error()); Now it works fine but it had occurred to me that if a staff member was uploading a document for the student at the every same split second (unlikely I know) they may both then get the same tally value and two documents get inserted into the DB with the same tally number. Is there a way we can write the first command $tsql = "SELECT file_tally FROM students WHERE sid = ".$_SESSION['student_id']; In a way where it increases the tally value in the command string? This could then keep that value in reserve and if there is an error I could adbopt the script to then "give" that value back by decreasing the value in the students file_tally.
  11. After finding the sticky to an article that explained quiet well how to write rewrites I did this: RewriteEngine On RewriteRule ^blogs/article/([0-9]+)/?$ blogs.php?bid=$1 [NC,L] And it worked great!
  12. Please see this thread for more details http://www.phpfreaks.com/forums/index.php?topic=234739.0;topicseen . I stumbled to it after a Google search. Server: Apache/2 PHP: 5.3.6 PHP is ran as CGI. Im trying to achieve a friendly URL for a blog im writting. ie the url looks like domain.com/blogs/article/1 where as blogs is the .php file After a ForceType not working due to my host using CGI to run php files I found this solution and inserted it into my .htaccess file: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] which just made a redirection of domain.com/blogs/.php (it entered a / slash between blogs and .php) So after reading the above linked to thread I changed my .htaccess file to: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (.*)/?$ $1.php [NC,L] Which like the OP in that thread I received an 500 error. This is the log error: Now I only really what this on the blogs.php file as the rest of the site is fairly static. Any help would be great thank you.
  13. Yes I was thinking about doing it anyway to make the software more flexible with future expansion. Even more so to prevent more tables getting created that stores the sid and I or someone forgets to add it to the delete scripts.
×
×
  • 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.