Jump to content

per1os

New Members
  • Posts

    3,095
  • Joined

  • Last visited

Everything posted by per1os

  1. The second is better, it is good practice to always check to see if there is a value when pulling GET POST or SESSION data. --FrosT
  2. Best bet is to read up here: http://us2.php.net/manual/en/class.dir.php Have fun! --FrosT
  3. Not for an insert statement. $result = SQLQuery("SELECT ID,Day,Month,Year,ShortDescription FROM `".SQLTable('party')."` WHERE `ClubID`=".$_GET['view']." ORDER BY `Year`,`Month`,`Day` DESC"); You do not need to put DESC after every single column in the order by. And for debugging purposes I would add this to that line $result = SQLQuery("SELECT ID,Day,Month,Year,ShortDescription FROM `".SQLTable('party')."` WHERE `ClubID`=".$_GET['view']." ORDER BY `Year`,`Month`,`Day` DESC") or DIE(mysql_error()); --FrosT
  4. You can do operations in MySQL. Here is an example query: SELECT column1 FROM table1 WHERE column2 <> 14 SELECT column1 FROM table1 WHERE column2 > 14 SELECT column1 FROM table1 WHERE column2 < 14 SELECT column1 FROM table1 WHERE (column2 - 7) = 14 SELECT column1 FROM table1 WHERE (column2 + 7) = 14 Hope that helps any. --FrosT
  5. Wow, this DB must not be in 3NF. That would of made this a lot easier. One way (half-assed to do it) is this: <?php $comids=array(); while (odbc_fetch_row($res)) { if (!in_array($comids)) { $composer=odbc_result($res,"ARTIST"); $comid=odbc_result($res,"ORDER"); $comids[]=$comid; echo '<option value="' .$comid. '">' .$composer. '</option>'; } } ?> Hope that works for a temporary fix. --FrosT
  6. If it is a new item, you would use INSERT. Sorry about that from the top post it seemed like you were updating a database field that was already there. --FrosT
  7. It goes databasename.tablename in the scheme, which it is basically say for database nights_test the table nights_test does not exist. fun stuff, it might not be a good idea to name the tablename the same as the DB name. I am not sure if that causes issues/conflicts. Maybe phpMyAdmin might be able to help diagnose that problem. --FrosT
  8. The answer is in the query, without that your at a loss. Best bet is to post the query so that can be re-written properly. --FrosT
  9. First off surrounding the tablename by single quotes may be causing the error. It should be ` not ' . Second off lets add a feature to dell us if there is an error. <?php $query = "INSERT INTO 'nights_test' (name, pass) VALUES ('$name', '$pass')"; $result = mysql_query($query) or DIE(mysql_error()); $query = "SELECT * FROM 'nights_test'"; $result = mysql_query($query) or DIE(mysql_error()); ?> Chances are both of those threw an error due to the single quotes around the table name. Try that and see what happens. --FrosT
  10. You really should put all code inside the [ code ] [ /code ] tags. One way (I am just creating this in my head since you did not post any SQL what so ever) is this: <?php // mysql connection started mysql_query("UPDATE tabl_name SET filename = '".$newName."' WHERE fileid = '".$fileid."'"); ?> This is assuming you have a fileid in the database to identify the file, if not put your identification field there. Either way that is how you update a field using MySQL. --FrosT
  11. Hey, Sessions are really intriguing. I am still trying to figure out the ins and outs. What seems to be happening is your session is staying in the cookie. Here is a snippet I pulled from http://us2.php.net/manual/en/function.session-destroy.php <?php // Initialize the session. // If you are using session_name("something"), don't forget it now! session_start(); // Unset all of the session variables. $_SESSION = array(); // If it's desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } // Finally, destroy the session. session_destroy(); ?> They key here is the $_COOKIE part to kill the session cookie. Once that happens the session should be destroyed completely. Best of Luck --FrosT
  12. Well without the included file it is hard to tell. My suggestion would be not to make $yourid=included file here as the reason the ID is always 1 is because include($file) returns a boolean if the file was included. Which it was included so it returned 1. Instead I would go about grabbing the ID this way. <?php #main file here $useremail = $_POST["email1"]; $userfirstname = $_POST["firstname"]; $userlastname = $_POST["lastname"]; $yourpassword = $_POST["password1"]; include('getUserId.php'); // Doing this includes the variable $yourid from the included file without needing to set the variable here. //...rest of text here <?php #get user id $yourid = mysql_ insert_ id($query); ?> Hope this helps. --FrosT
  13. More information would be nice. How is the file gathered? If it is not uploaded to the server how do you have access to that file? If it is uploaded to your server, than I am sure you can get the name that way. If they are just uploading a file and you do not want to store it, you can grab the data of the file "on the fly" without even needing the filename to begin with. It seems your question can be answered by this site http://us2.php.net/manual/en/features.file-upload.php and reading through that manual. Good reading. --FrosT
  14. You say another mod_rewrite, but this really is not considered a mod_rewrite. At any rate, I am really confused on what is being asked here. I guess this might be what you want: <?php $m=$_GET['m']; $file='http://djreaka.com/music/'.$m.'.mp3'; header("Location: " . $file); die(); ?> Your other option might include sending out a header that states it's an MP3 file and then print using fread. For more on the header data check out the first contribution located here http://us2.php.net/manual/en/function.fread.php --FrosT
  15. Hi All, This is my first post here so I will try to be as helpful as possible on what I am looking at. Currently I am revamping a website of mine to increase speed, usability and offer more features for the end user. In the past when I coded for a company who required ASP they passed variables via the Session array. Now my site is not "Top" security, if someone's account is breached well I have a problem, but nothing major. I want to keep the session data alive, and I keep the session hash for a user in the database until their cookie expires or they logout at which time it is flushed from the system. In the past I always ran a query to grab the users data from MySQL, but I see that as a waste of "unnecessary" processing time. Thus I decided to look into storing that users data in a class that is housed in the session. The only "problem" I foresee is that if an administrator modify's that person's account for whatever reason I have no real way to check and make sure their session is up-to-date other than creating a new db field "isDirty" which in return would require another DB call to check that single field every time. Now would that 1 field return call each time be better than returning 15 fields each time? Another option would be to place isdirty in the session table on SQL and check against that. I do not know if anyone has a suggestion for me or not, I am kind of just brainstorming and looking at my options as I want it to be done correctly. Here is my background: I am a 22 year old male PHP coder for 7 years, .NET 2 years, and SQL 8 years. I consider myself advanced in coding PHP and SQL. My Server is running on Linux RedHat 7.3 with PHP 4 installed on Apache 1.3. Any suggestions are welcomed and would love to get some better ideas. Thanks! --FrosT
×
×
  • 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.