Jump to content

2muchspam

Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.fatofthelan.com

Profile Information

  • Gender
    Not Telling
  • Location
    Portland, OR

2muchspam's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. WooHoo! Found the problem. My table field (varchar) was set as BINARY. I changed it to nothing and all is well with the world. Thanks for your time!
  2. Hello again, I\'m stuck again. I\'ve built a search page for my db. I have a record for the name \"Bill Gates\". If I search for the first name Bill, it finds it. If I search for bill (lower case B) it doesn\'t find it. I\'m using LIKE so it should fing it. Ex: mysql> SELECT \'abc\' LIKE \'ABC\'; -> 1 But it\'s not working so what the heck is going on???? <?php include \'header.php\'; include \'db.php\'; //Create short variables from POST data $searchtype = $_POST[\'searchtype\']; $searchterm = $_POST[\'searchterm\']; //Trim off whitespace $searchterm = trim($searchterm); //Checks for null search if (!$searchterm || !$searchtype){ echo \'You did not select anything to search for! Please go back and try again.\'; exit; } //Add MySQL slashes so as to not destroy the query with bad data. I know this is anal. $searchterm = addslashes($searchterm); $searchtype = addslashes($searchtype); //Query database $db_query = "SELECT * FROM incident.violators WHERE ".$searchtype." LIKE \'%".$searchterm."%\'"; $db_result = mysql_query($db_query) or die("Error in query:".mysql_error()); $num_results = mysql_num_rows($db_result); echo \'<p><br /><b>UP Incident Reporter</b></p>\'; echo \'<br /><br />\'; echo \'<div class="h">Search Results</div>\'; echo \'<div class="t">\'; echo \'<p>Nuber of Matches: \'.$num_results.\'</p>\'; //Loop through database results and build table echo \'<center><table width="80%" border="0" cellspacing="0" cellpadding="2"><tr>\'; echo \'<td bgcolor="cccccc"><b>Name</b></td> <td bgcolor="cccccc"><b>Phone</b></td> <td bgcolor="cccccc"><b>Email</b></td> <td bgcolor="cccccc"><b>Address</b></td> <td bgcolor="cccccc"><b>Violation</b></td> <td bgcolor="cccccc"><b>Disconnect</b></td></tr>\'; while ($result = mysql_fetch_array($db_result)) { echo \'<tr>\'; echo \'<td>\'.$result[\'firstName\'].\' \'.$result[\'lastName\'].\'</td>\'; echo \'<td>\'.$result[\'phone\'].\'</td>\'; echo \'<td>\'.$result[\'email\'].\'</td>\'; echo \'<td>\'.$result[\'address\'].\'</td>\'; echo \'<td>\'.$result[\'violation\'].\'</td>\'; echo \'<td>\'.$result[\'disconnect\'].\'</td>\'; echo \'</tr>\'; } echo \'</table></center>\'; echo \'</div>\'; echo \'<br /><br /><br /><br />\'; include \'footer.php\'; ?>
  3. Got it!! The result returned by a mysql query is not the data, it\'s a resource that contains the data. To get the data out, you need to \'fetch\' it out. Try it with mysql_fetch_array(). $query_th = mysql_query("SELECT count FROM hits"); $fetched_result = mysql_fetch_array($query_th); $total_hits = $fetched_result[\'count\'];
  4. Hello again! I\'ve got a total hits script that I kinda got from an old nuke site. The script does incriment the database just fine. But when I call the result, I get \"Resource id #4\" What the heck am I doing wrong? Database: # Table structure for table `hits` # CREATE TABLE hits ( type varchar(80) NOT NULL default \'\', var varchar(80) NOT NULL default \'\', count int(10) unsigned NOT NULL default \'0\' ) TYPE=MyISAM; # # Dumping data for table `hits` # INSERT INTO hits VALUES (\'total\', \'hits\', 45612); Here is the header script: (this works fine. stolen from nuke) include_once \'db.php\'; mysql_query("UPDATE hits SET count=count+1 WHERE (type=\'total\' AND var=\'hits\')"); Here is the footer scriipt: $total_hits = mysql_query("SELECT count FROM hits WHERE type=\'total\' AND var=\'hits\'"); echo "$total_hits"; Thanks in advance!
  5. I want to keep a directory from public view. (/foo) I\'ve enabled digest auth and it works fine for /foo. The web-based program (php/mysql/gd) works just fine without any auth, but when auth is enabled, it doesn\'t. I can log in and see the index page, but none of the links work. I messed with it for a while and got it to let me follow links, but the app won\'t make images anymore (using gd) unless I remove the auth. Here is an excerpt from my httpd.conf: <Directory "x:/apache/apache2/htdocs/foo"> AllowOverride None AuthType Digest AuthName securearea AuthDigestFile x:/xxxxxxx/xxxxx/.passwdfile AuthGroupFile /dev/null Require user appuser # Options -indexes +Includes +ExecCGI #Order allow,deny #Allow from all </Directory> ANY HELP GREATLY APPRICIATED!!!!! Thanks!
×
×
  • 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.