Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. Honestly, this is how I'd do it, but I'm no database engineer by any means. CREATE TABLE `pm` ( `id` int(10) unsigned NOT NULL auto_increment, `title` varchar(100) NOT NULL, `content` text NOT NULL, `date_sent` timestamp NOT NULL default '0000-00-00 00:00:00', `sender_id` mediumint( unsigned NOT NULL, PRIMARY KEY (`id`) ) CREATE TABLE `pm_info` ( `message_id` int(10) unsigned NOT NULL, `receiver_id` mediumint( unsigned NOT NULL, `read` tinyint(1) NOT NULL default '0', `date_read` timestamp NOT NULL default '0000-00-00 00:00:00', KEY `message_id` (`message_id`) ) This way, you could send a PM to multiple people and see when they first read it.
  2. I was actually just reading up on facebook's engineering page today. If you have an account go to their page at: http://www.facebook.com/FacebookEngineering and then click on the notes tab, and they have a lot of cool info. A lot of their design wouldn't be for you until your site got large enough (I don't think you're going to have 1/4 a billion people anytime soon)
  3. Why not just keep the background position fixed, put the bottom pixel of your background image as the background color for the page, and repeat-y? Example css: background: url('bg.jpg') repeat-x fixed #000;
  4. About damn time is right.
  5. I dont think there is one that will default check to make sure there aren't any numbers in it - since a string can contain numbers. is_string[/code] ?
  6. No? strstr in the manual - maybe you should look at that
  7. if(strlen($field) > 3) && (strstr($field)){ if(strlen($field) > 3 && strstr($field)){ Notice the parenthesis.
  8. echo "Username: $logged[username]" echo "Email: $logged[email]" echo "Games Played: $logged[gameplayed]" echo "Level: $logged[level]" You're missing a semicolon on each of those statements. echo "Username: $logged[username]"; echo "Email: $logged[email]"; echo "Games Played: $logged[gameplayed]"; echo "Level: $logged[level]";
  9. I'd still go with PayPal/Google Checkout. They allow users to fill out normal credit cards and its going to be more secure (since they do it all on their servers)
  10. It is because $sql isn't a valid MySQL resource. Or, in other words: mysql_query('SELECT * FROM tbl_news sort by story_date desc') failed. echo mysql_error() and see what it says
  11. Well, what errors did it give? The way I did it is the way I'm used to, OOP style. Do the following comments help: // Create the query string, notice the ? as a placeholder $query = "SELECT * FROM administrators WHERE adminusers=?"; // Prepare the statement, but only run it if it doesn't fail if($dbh = $connect->prepare($query)) { // If we are here, then the prep didn't fail... // bind the parameters (I'm guessing $adminuser is a string, thus the 's') $dbh->bind_param('s', $adminuser); // execute your query $dbh->execute(); // As long as there wasn't an error, if(!$connect->error) { // We should loop through the results while($row = $dbh->fetch_assoc()) { // and echo the row, or whatever. echo $row['column']; } } else { // but if we got here, there was an error. echo $connect->error; } } else { // and if we got here, the prepare call didn't work. so lets see why: echo $connect->error; }
  12. It's been a while, and this is untested.... but: $query = "SELECT * FROM administrators WHERE adminusers=?"; if($dbh = $connect->prepare($query)) { // bind the parameters: $dbh->bind_param('s', $adminuser); // execute $dbh->execute(); if(!$connect->error) { while($row = $dbh->fetch_assoc()) { echo $row['column']; // echo a row, or whatever you want to do. } } else { echo $connect->error; } }
  13. Change: $post = mysql_query("INSERT INTO `downloads` (name, username, date, url, dldesc) VALUE ('$name', '$username', '$date', '$url', '$dldesc')"); to: $q = "INSERT INTO `downloads` (name, username, date, url, dldesc) VALUE ('$name', '$username', '$date', '$url', '$dldesc')"; echo '<br>'.$q.'<br>'; $post = mysql_query($q); And copy/paste the query you're giving mysql.
  14. $filename is called several times after the move file - and they do not have str_replace on 'em //... echo 'Your file/image upload of <em>'. $filename . '</em> ';
  15. Yes, using LIKE for mysql search. What does this have to do with searching through an array? If you have another way of doing it, by all means please show me haha
  16. @zanus: lmao @Q695: First of all, whats the question? Second, why are you calling mysql_fetch_array($result) 3 times?! - Mainly the 2 inside the while loop...
  17. I'd agree with mjdamato on this one. Code examples below: <?php $a = array(5, 6, 8, 12, 16, 23, 35); $b = array(5, 8, 23); //$b = array(5, 8, 23,55); // Shows what happens when a number isnt in $a // To check to see if some of the values are in the array (Scenario 1): if(count(array_intersect($b, $a))>0) { echo count(array_intersect($b, $a)),' elements were from array(5, 8, 23) were in array(5, 6, 8, 12, 16, 23, 35)<br>'; } // To check to see if all of the values are in the array (Scenario 2): if(!count(array_diff($b,$a))) { echo 'All elements from array(5, 8, 23) were in array(5, 6, 8, 12, 16, 23, 35)<br>'; } else { echo 'You were missing the following: '; print_r(array_diff($b,$a)); } ?>
  18. Well, I'm not familiar with odbc, but if you echo $total and $total4 separately and they don't show up then something is up with your queries.
  19. $users5 = "$total + $total4"; echo ""$users5""; should be $users5 = $total + $total4; echo $users5;
  20. Haha, nahhh, a small dev server we shared a while back has a bunch of random crap on there.
  21. Haha, I'm a ninja and have my ways of finding things on teh interwebz.
  22. You mean.... his wannabe self portrait?
  23. Not the best of security practices right there, unless you can be sure to secure your db. cunoodle2 hit the spot, just create them a temporary password, and they can change it once they login with the temp pass.
  24. in_array perhaps?
×
×
  • 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.