Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. echo $_SERVER['HTTP_REFERER'];
  2. Same way, just separate each column by a comma... $query = "SELECT SUM(helmet) AS helmet_count, SUM(shoe) AS shoe_count, SUM(sock) AS sock_count FROM information"; $result = mysql_query($query) or die(mysql_error()); $helmet_count = mysql_result($result, 0, "helmet_count"); $shoe_count = mysql_result($result, 0, "shoe_count"); $sock_count = mysql_result($result, 0, "sock_count");
  3. I missed a closing parenthesis on this line: if (is_array($file) { It should be: if (is_array($file)) {
  4. After looking in the manual...of all places !!!...I found this: Which is set in php.ini http://us2.php.net/manual/en/ref.session.php#ini.session.save-handler
  5. You may also want to look at the session_set_save_handler function http://www.php.net/session_set_save_handler
  6. Not sure what you're trying to accomplish...php by default uses a cookie to store the session id of a user. However if a user has cookies disabled it will pass the session id in the url. You may be able to change this default behavior in php.ini, or some other place, but I don't know where off hand.
  7. $sql = "SELECT SUM(item_count) FROM information echo $sum['item_count']; should be $sql = "SELECT SUM(item_count) AS item_count FROM information"; $result = mysql_query($sql); $sum = mysql_fetch_assoc($result); echo $sum['item_count']; or $sql = "SELECT SUM(item_count) FROM information"; $result = mysql_query($sql); echo mysql_result($result, 0);
  8. It's not graceful, but this should do what you want... <?php $dirpath = "./torrents"; $dh = opendir($dirpath); while (false !== ($file = readdir($dh))) { if (!is_dir("$dirpath/$file")) { $fileend = substr($file, -; $fileend = strtolower($fileend); $mod_time = filemtime("$dirpath/$file"); $lm = date("Y-m-d H:i", $mod_time); if ( $fileend == ".torrent" ) { $find = array('&', '+'); $replace = array ('%26', '%2b'); $filename = str_replace($find,$replace, $file); $html = " <table width=\"60%\" cellspacing=\"0\" cellpadding=\"2\"> <tr> <td class=\"reply\" align=\"left\"><A HREF=\"$dirpath/$filename\">$file</A></td> <td class=\"reply\" align=\"right\"><A HREF=\"parse.php?filename=$filename\">details</A></td> </tr> <tr> <td class=\"reply\" align=\"left\"><font size=\"2\">uploaded " . $lm . " CST.</td> <td align=\"right\" class=\"reply\">thread</td> </tr> </table>"; if (!$files[$mod_time]) { $files[$mod_time] = $html; } else { $files[$mod_time][] = $html; } } } } ksort($files); foreach ($files as $file) { if (is_array($file) { foreach ($file as $fil) { echo $fil; } } else { echo $files; } } closedir($dh);
  9. Is the referrals column in your table a number type column...INT, BIGINT, SMALLINT etc? Or is it a VARCHAR or something equally non numeric?
  10. If you aren't going to be using all of the data that your select query returns, then it is very inefficient to query the database and have it return potentially a lot of data for only a call to mysql_num_rows. If you only want a row count, use the count function in mysql... $result = mysql_query("SELECT COUNT(items) FROM item_table") or die(mysql_error()); $num_of_rows = mysql_result($result, 0);
  11. The second parameter to the mysql_query function is the "link identifier". This means that you can have 1000 db connections open at a time and select any one of them to perform any query when ever you want... $link1 = mysql_connect(..., ..., ...); mysql_select_db($database_name, $link1); $link2 = mysql_connect(..., ..., ...); mysql_select_db($database_name_two, $link2); $result = mysql_query("SELECT * FROM table2", $link1) or die(mysql_error()); $result = mysql_query("SELECT * FROM table", $link2) or die(mysql_error()); If you are connecting to the same database host, but are using to different databases, you can simply call mysql_select_db again to change the "default" database that the connection is using.
  12. Use a SUM query... SELECT SUM(item_count) FROM items
  13. Have you tried creating a db object in your class, rather than using the global? I'm not sure, but it could be a scope issue.
  14. That doesn't solve anything...it merely forces php to not display any errors.
  15. Change: $result = mysql_query($sql); to $result = mysql_query($sql) or die(mysql_error()); And see what the error is.
  16. Should have paid more attention before...you aren't assigning a value to $display using your first code example... if you change it to this: <?php $banner_display = "horizontal"; $display = ($banner_display == "horizontal") ? "Horizontal" : "Vertical"; echo $display; ?> It will work. Look in the manual for ternary operators.
  17. Ok, the latter two errors are occurring in a different file...so we can't help you with those. Judging by the error message, your database isn't connecting correctly. You are getting the other error most likely because the move_uploaded_file function failed. Ensure that error reporting is turned on and set to E_ALL. ini_set("display_errors", 1); error_reporting(E_ALL); And why does everyone seem to be using the basename function on the "name" element of the $_FILES array? The element only contains the name of the file, not the entire path that it was uploaded from, which means using that function is pointless.
  18. http://www.phpfreaks.com/tutorials/129/0.php I think I paste a link to this tutorial at least once a week
  19. That is a standard if statement, so there is no reason it wouldn't work...aside from the part of your code you haven't posted.
  20. You have an error at line 46 as well... array_walk($_POST), 'clean'); should be: array_walk($_POST, 'clean'); As far as the error at line 38, here is what Zend Studio gives as an error description: This doesn't return an error: $bln = trim($_POST['brideLname']); $gln = trim($_POST['brideLname']); if (empty($bln) && empty($gln)){ //<-- line 38 echo "<div align=\"center\"><font color=\"ff0000\">Please enter a last name for Bride <i>and</i> Groom.</font></div>\n"; }else{ @Daniel0...you are missing 2 closing parenthesis in your recommendation.
  21. ummm... INSERT INTO tablename (id, username) VALUES ($lost_user_id, $lost_user_name); or am I missing something obvious?
  22. The addslashes function will escape single and double quotes for you. http://www.php.net/addslashes Alternatively, use htmlentities http://www.php.net/htmlentities
×
×
  • 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.