Jump to content

benphp

Members
  • Posts

    336
  • Joined

  • Last visited

Everything posted by benphp

  1. Now that I think of it, that won't work, because it would submit it on any key down. I think this is what you want: http://www.cs.tut.fi/~jkorpela/forms/enter.html
  2. You could use a javascript onkeydown event.
  3. The code I posted does it all. function fnOpenDbConn() { $db_Conn = new COM("ADODB.Connection"); $db_connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=".$_SERVER['DOCUMENT_ROOT']."/Evaluation/db/eval.mdb;Uid=;Pwd=;DefaultDir=".$_SERVER['DOCUMENT_ROOT']."/Evaluation/db"; $db_Conn->open($db_connstr); return $db_Conn; } //end fnOpenDbConn $dbConn = fnOpenDbConn(); $sqlc = "SELECT c_instructor FROM evaluations WHERE c_instructor = $pid "; $rSc = $dbConn->execute($sqlc); $num_rows = $rSc->Fields->count(); print "$num_rows"; $rSc->Close(); $rSc = null; $dbConn->Close(); $dbConn = null;
  4. Add a field to the image table called "viewed". When a user hits the page: Select viewed from image. $viewed = $viewed+1 Update image set viewed = $viewed You can also have a date/time stamp in the image table, so you can sort by date.
  5. I've been looking for a solution to this for hours - can someone help? I'm using MS Access as the db DSN-Less, and my SQL looks like this: function fnOpenDbConn() { $db_Conn = new COM("ADODB.Connection"); $db_connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=".$_SERVER['DOCUMENT_ROOT']."/Evaluation/db/eval.mdb;Uid=;Pwd=;DefaultDir=".$_SERVER['DOCUMENT_ROOT']."/Evaluation/db"; $db_Conn->open($db_connstr); return $db_Conn; } //end fnOpenDbConn $sqlc = "SELECT c_instructor FROM evaluations WHERE c_instructor = $pid "; $rSc = $dbConn->execute($sqlc); $rSc->Close(); $rSc = null; $dbConn->Close(); $dbConn = null; All I want to do is count the returned rows. I've tried this: $num_rows = $rSc->Fields->count(); which returns "1". and this: $num_rows = array($rSc); $num_rows = count($num_rows); which also returns "1". This would be easy in MySQL.
  6. I finally fixed it. Not an easy fix. It seems like every time I install php/mysql (about once a year) I have to re-learn all the tricks. The main problem, I think, was not having libmysql.dll in the windows/system32 folder. In the latest php.ini file from 5.2.2 there is no extension=php_mysql.dll line. NEW problem: I can't get the sessions directory to work. I created a folder c:\PHP\sessions, and allowed read/write from within XP, but I still get session errors, such as this from MediaWiki: Failed to write session data (files)....
  7. After getting 5.2.2 installed (using php-5.2.5-win32-installer.msi) and running, I still can't get it to see MySql. This installation doesn't have any dist versions of the INI. Also, one of the main pains in the ass with this installation is that it doesn't automatically copy the ini to the windows directory, but it DOES look for it there. That took me an hour to figure out...
  8. I've been working on this for a while now and still can't seem to get it to work. I want to pass a phrase in the URL that uses an ampersand: "Black & White" And I want to be able to 1) print it as is, and 2) insert it into a link. I think the problem lies in the spaces around the ampersand. I've tried various methods of replacing it with & and &038; and replacing the spaces with %20 or + but it still causes trouble. Note - this looks simple but it isn't. Here's the test code: <?php $a = ""; if (isset($_GET['a'])) { $a = $_GET['a']; } print "a=$a"; $alink = str_replace("&", '&', $a); $alink = str_replace(" ", '+', $a); print "<p><a href=\"test.php?a=$alink\">Test</a><p>"; print " <html> <head></head> <body> <form action=\"test.php\" method=\"GET\" name=\"myform\"> <input type=\"text\" name=\"a\" value=\"$a\"><br /> <input type=\"Submit\" name=\"btnGo\"> </form> </html> "; ?> To see what I mean: 1. Enter Black & White into the field. 2. Click Submit. 3. Click the link that was created. You will see that only "Black" was retained in the link, even though the link variable looks like "test.php?a=black+&+white".
×
×
  • 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.