Jump to content

Steve Scrimpshire

  • Posts

  • Joined

  • Last visited

Posts posted by Steve Scrimpshire

  1. I have created a form with a DataGridView that is connected to the appropriate DB and I created a Sub that allows me to edit a row. Once the row is edited, I can see the appropriate changes are made to the DataGridView, but when I close the form and fire it back up, the table is back to its original state before the changes. I have googled and googled and cannot find the right command to actually commit the changes to the DB.


    Can someone give me a little push?

    My database is named MyBusiness with one table called Customer. My form is using MyBusinessDataSet and CustomerTableAdapter.

  2. The TCH guys were talking about install scripts and stuff and when I got online they started talking really vague and telling each other to 'go to the other channel'.

    I think they are planning something else, but when I asked they told me they couldn't say anything yet.

  3. I won't be much help, but I run an SMF Board with maybe 10 active users (25 total) and an average of 4.05 posts per day. Bandwidth usage is about 55 MB/month. Sorry that doesn't help much. I don't know if you can assume 25 times the posts will be 25 times the bandwidth.

  4. To comment a line out in PHP, you put


    at the very beginning of the line. Or put

    /* around the line like this */



    So, what exactly is wrong with using GD Bibliothek? As the default setting it works perfectly fine (for my test run), so an older lady or man or your younger wife would have no problems as far as I can see. Maybe my inexperience doesn't provide me with the knowledge of what benefits ImageMagick would give you, but if it is important to you, you can try going to the 4Images website and asking them if there is anyway to get ImageMagick to work with open_basedir set to /home/username/:/usr/local/sqmail/:/usr/lib/php:/usr/local/lib/php:/tmp on a shared server.


    As far as Fantastico goes, it can't account for every possible server configuration and probably comes with the ability to install all those scripts you see by default. The fact that Fantastico is there at all makes life a whole lot easier. Maybe if you ask, they can disable Fantastico for you in your cPanel.

  5. Maybe this'll get you started:


    $username = "username";
    $password = "password";
    $database = "database";
    $table = "table";
    // Connecting, selecting database
    $link = mysql_connect("localhost", "$username", "$password")
      or die('Could not connect: ' . mysql_error());
    echo 'Connected successfully';
    mysql_select_db("$database") or die('Could not select database');
    // Performing SQL query
    $query = "SELECT * FROM $table";
    $result = mysql_query($query) or die('Query failed: ' . mysql_error());
    // Printing results in HTML
    // echo "<table>\n";
    echo "<html><body>";
    echo "<p>";
    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
      foreach($line as $key => $value) {
       echo "\$$key == $value";
       echo "<br>";
      echo "<p>";
    echo "</body></html>";
    // Free resultset
    // Closing connection


    When I have more time, if you still haven't figured the rest out, I might be able to look deeper into it.

    Although, you could just use phpmyAdmin in your controlpanel:


  6. Just a quick glance because I don't have much time tonight, but a few lines below your error line, there is a function that looks like this:

    function num_rows($query_id=-1){

    if ($quert_id != -1) {



    return mysql_num_rows($this->query_id);



    Note the bold variable name. I don't know if that was just a typo while putting the code here or if it is a typo in your actual code, but it might be worth looking into. Soon, I may have more time to give it an indepth look.


    P.S. If you put your code example inside [ code] [ /code] tags (without the extra spaces, of course) in the forum, your code will stay formatted correctly and be easier to read. Of course, if you want to bold or underline something in your code, you'll have to use [ quote] [ /quote] tags instead, in which case, you'll lose your formatting.

  7. Here's an example of a script I use to keep track of page reads. It uses php-gd, a 1x1 pixel transparent pixel and an alteration to my .htaccess file so I can name the file whatever.png and it still executes as a php script. The only output of the script is the blank.png and the rest is just commands that are executed in the background every time the page loads with the blank.png in it. In your case, you could have it output the ad image and for the link, you could redirect it to another php page briefly that logs the click then redirects them to the ad's site. That way you would have a log of views and a log of clicks. My particular script just creates and updates a counter file and a file that keeps track of ip addresses so I'm not counting the same ip address twice (in case the viewer leaves the page and comes back).

    I could easily update this script for you to do what you need if you like it. Here's my script as I use it:

    $counter_file = "counter6.txt";
    $ipaddresses = "ipaddresses6";
    $script = "Fibonacci";
    if (getenv("HTTP_CLIENT_IP")) {
    $ip = getenv("HTTP_CLIENT_IP");
    else if (getenv("HTTP_X_FORWARDED_FOR")) {
    		 $ip = getenv("HTTP_X_FORWARDED_FOR");
    else if(getenv("REMOTE_ADDR")) {
    		$ip = getenv("REMOTE_ADDR");
    else {
    	  $ip = "UNKNOWN";
    $isthere = "0";
    $somecontent = "$ip\n";
    $filestuff = file("$ipaddresses");
    foreach ($filestuff as $line_num => $line) {
     $line = trim($line);
     $ip = trim($ip); 
     if ($line === $ip)
       $isthere = 1;
    if ($isthere == "0"){
    if (is_writable($ipaddresses)) {
    	if (!$handle = fopen($ipaddresses, 'a')) {
    		echo "Cannot open file ($ipaddresses)";
    	if (fwrite($handle, $somecontent) === FALSE) {
    		echo "Cannot write to file ($filename)";
    // Open the file for reading
    if (!($fp = fopen($counter_file, "r"))) die ("Cannot Open Counter file: $counter_file.");
    // Read 20 characters from the file
    $counter = (int) fread($fp, 20);
    // Close the file
    // Increment the counter
    // Open the file, in write mode
    $fp = fopen($counter_file, "w");
    // Write the new value of counter to the file.
    fwrite($fp, $counter);
    // Close the text file.
    $hostname = gethostbyaddr($ip);
    mail("$to_email", "Someone viewed $script", "IP address: $ip\nHostname: $hostname\nIt has now been viewed $counter times. Cool!\n","From: $submitted_email") or die("error");
    Header ("Content-type: image/png");
    Header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
    Header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
    Header("Pragma: no-cache");
    $img = @ImageCreatefromPNG("blank.png");


    Of course, if you have a lot of banners/ads, you may want to keep track of the statistics in a database rather than a flat file like I do here.

  8. Hmmm. Apparently I waited too long to try and edit. It looks fine in IE6. The logo image is the same size in all 3 browsers, so that's not the issue. It's the other table cells or <divs>, or whatever it's using, that are actually smaller in the other two browsers, putting them behind the image.

  • Create New...