I use this almost on a daily basis, and yet I can't commit it to memory. So I don't have to go searching for it each time I need to write it… $databaseName = "YOURDATABASENAME"; $dbconnection = mysql_connect("localhost", "DATABASE-USERNAME", "DATABASE-PASSWORD") or die ('I can?t connect to the database.'); mysql_select_db($databaseName,$dbconnection); $value = "SOMEVALUE"; $query = sprintf("SELECT […]
Just wanted to store some code I use a lot and am tired of looking up 😉 In some of the scripts I work on, I create a field for a timestamp. For that field I insert the PHP value: time() When recalling that value, it's just an ugly looking UNIX timestamp, so to format […]
Comments Off on Date Time
I posted how to do this in ASP, but since I needed something similar in PHP for that last post, I thought I'd post the PHP version as well. This script snippet will play back everything that was just submitted in the form (code found in the each function page in the PHP manual.)
Let's say you have some optional items to your form. (Maybe extra address info) and your form is long enough as it is. You can pop up a secondary form, where the user can enter their extra info, and have it saved to the main form and submitted with the main form. (see example here)
I talked about stored procedures here the other day. Today, I needed to create a page that would call one of those stored procedures (the selecting one) and display all data from a table. This code is very plug-and-play-ish – very little needs to be modified (that is, as long as you're using MS SQL […]
I've been learning about stored procedures and calling them from ASP pages. So just wanted to jot down some examples/templates… (note from my technical editor, Mike: This code is specific to MS SQL Server and probably wouldn't work with other databases.)
Comments Off on writing and using stored procedures
A simple little ASP snippet. If you want to see what's coming over from your method="POST" form – here's a bit of code that will loop through everything, show you the variable name and it's value: for each x in request.form() response.write(x & ": " & request.form(x) & "<br>" ) next if you're using method="GET" […]