Jump to content

mwq27

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Posts posted by mwq27

  1. After upgrading to apache2.2.6 and php 4.4.7, I can not include any css files on my pages.  I tried making a plain html page with a link to a stylesheet in the <head> tags, and it will not include the file.  The includes work on the older apache 2.0 and php 4.4.1, but not on this newer version.  Has anyone else had this problem and if so, how will i fix this?  thanks

  2. Is it at all possible to install the mysqli extension into PHP4?  Or would I have to upgrade to PHP5?  I just want to be able to use mysql's stored procedures without upgrading to PHP5.  Thanks in advance

  3. HOw could I call the procedure without PHP5?  here is the procedure:

    DELIMITER //

    CREATE PROCEDURE get_partner_link_id_old (IN shopper_link_code VARCHAR(255),OUT partner_code VARCHAR(255), OUT old_partner_id VARCHAR(255))

    BEGIN
    DECLARE OLD_ID, P_CODE VARCHAR(255);
    DECLARE empty INT;
    DECLARE pl_id_cur CURSOR FOR SELECT partner_link_id from shopper_link where code = 'shopper_link_code';

    DECLARE p_code_cur CURSOR FOR SELECT partner_code,type from partner_link where partner_link_id = 'old_partner_id';

    DECLARE CONTINUE HANDLER FOR NOT FOUND
    SET empty = 1;

    SET empty = 0;
    OPEN pl_id_cur;

    FETCH pl_id_cur INTO OLD_ID;
    IF empty = 0 THEN
    CLOSE pl_id_cur;

    SET old_partner_id = OLD_ID;

    OPEN p_code_cur;
    FETCH p_code_cur INTO P_CODE;
    CLOSE p_code_cur;
    SET partner_code = P_CODE;
    END IF;


    END;//

    DELIMITER ;//
  4. Whenever I hit submit from the HTML form, I get a blank screen on the php page.  There is something wrong with my code and I just cant figure it out. 
    Here is the code [code]<?php

    echo 'HWHEEADONASOIOAIDHOIAD';

    $host = 'localhost';
    $user = 'root';
    $pass = 'xxxxx';
    $dbname = 'pecs';

    $link = mysql_connect($host, $user, $pass);

    if(!$link)
    {
    die("Could not connect: " .mysql_error());
    }
    mysql_select_db($dbname, $link) or die (" Database not found." . mysql_error());


    $email = $_POST['email'];


    $name = $_POST['name'];

    $title = $_POST['title'];

    $address = $_POST['address'];

    $city = $_POST['city'];

    $state = $_POST['state'];

    $zip = $_POST['zip'];

    $phone = $_POST['phone'];

    $org = $_POST['org'];

    $regreg = $_POST['regreg'];

    $stureg = $_POST['stureg'];


    if(empty($email) || empty($name) || empty($address) || empty($city) || empty($state) || empty($zip) || empty($phone) || empty($org))
        {
        echo 'you didnt fill in all the required fields! go back and do it again...';
      //  echo "<a href=\"javascript:history.go(-1);\">&laquo; back</a>";
        } else {

              // Check to make sure its a valid email, and already exists

            if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {

                $check_email = "SELECT * FROM regform WHERE email='$email'";

                    $result = mysql_query($check_email) or die (mysql_error());


                        if (mysql_num_rows($result) > 0) {

                            $email = FALSE;

                            echo 'That email is already being used!<br />';

                        }
    //if a radio button hasnt been selected
    if(!isset($regreg) && !isset($stureg))
    {
    echo 'Please select whether you student registration or regular registration.'; }
    else {

    //set variable to the right radio button
    if(!isset($regreg))
    {
    $regreg = $_POST['stureg'];
    }
    else $regreg = $_POST['regreg'];

    $sql = mysql_query("insert into regform (name, org, title, address, city, state, zip, phone, email, regbef) values ('$name', '$org', '$title', '$address', '$city', '$state', '$zip', '$phone', '$email', '$regreg')");
    $result = mysql_query($sql);

    if(!result)
    echo 'could not register you try again';
    //throw new Exception('Could not register you, try again');
    else
    echo 'Success!!';

    }


    ?>
    [/code]

    Could someone please tell me what is wrong here.  Thanks
  5. Here is my code now.  It keeps telling me that the extension is wrong, when the file in the directory is a .csv file.  Please help

    [code]<?php


    mysql_connect($host,$user,$pass) or die("Unable to connect to database");
    @mysql_select_db("$database") or die ("Unable to select database $database");
      $file_types_array = array(".csv");
        $limitedext = array(".csv"); //Extensions you want files uploaded limited to. also you can use:  //array(".gif",".jpg",".jpeg",".png",".txt",".nfo",".doc",".rtf",".htm",".dmg",".zip",".rar",".gz",".exe");
      //chdir ("csv/");
      $curdir =  ("/home/dvdblurb/public_html/joomla/php/csv/");
      // $dir = opendir($curdir);
     
      if ($handle = opendir($curdir))
     
    {
          while (false !== ($filename = readdir($handle))) {
      //echo $filename;
    //$split = explode (".", $files);
    //$check = $split[0];
    // $origfilename = $_FILES["file"]["name"][$key];
          //  $filearray[] = $filename;
     
    $filename_array = explode(".", $filename);
    $c = count($filename_array);
    echo $c;
    if($filename_array[$c] !== "csv") { die("error message"); }




    //Set valid extension to TRUE




    /* $filename = explode(".", $filename);
            $filenameext = $filename[count($filename)-1];
            unset($filename[count($filename)-1]);
            $filename = implode(".", $filename);
            $filename = substr($filename, 0, 15).".".$filenameext;
            $file_ext_allow = FALSE;
    for($x=0;$x<=count($file_types_array);$x++){
    if($filenameext==$file_types_array[$x])
              {
                $file_ext_allow = TRUE;
             
    }
    //$ext = '.csv';
    }

    }*/

    //if(strpos($files, $ext) === true){
    $filearray[] = $filename;
    $length = count($filearray);

    // $filesplit = explode(".", $filename);
    //$check_filename = $filesplit[0];

    //closedir($dcontents);
      $fcontents = file ($filename);
      # expects the csv file to be in the same dir as this script with the name g.csv
    for($y=0; $y<=$length; $y++) {

      for($i=1; $i<sizeof($fcontents); $i++) {
          $line = trim($fcontents[$i]);
          $arr = explode(",", $line);
          #if your data is tab separated
          # instead of comma separated,
          # change the ',' above to '\t'
       
          $sql = "insert into $table values ('".
                      implode("','", $arr) ."')";
          mysql_query($sql);
          echo $sql ."<br>\n";
     
          if(mysql_error()) {
            echo mysql_error() ."<br>\n";
          }
      }
      }

    }



    }echo "<a href=upload4.php>Run script again to upload a new file, but first check the file names.</a>";
    ?>[/code]
  6. [code]<?


    mysql_connect($host,$user,$pass) or die("Unable to connect to database");
    @mysql_select_db("$database") or die ("Unable to select database $database");
     
      //chdir ("csv/");
      $curdir =  opendir(".");
     
     
      while($files = readdir($curdir))
    { //$split = explode (".", $files);
    //$check = $split[0];
    $ext = '.csv';
    if(strpos($files, $ext) === true){

    $filearray[] = $files;


    }
    $length = count($filearray);

    // $filesplit = explode(".", $filename);
    //$check_filename = $filesplit[0];

    //closedir($dcontents);
      $fcontents = file ($files);
      # expects the csv file to be in the same dir as this script with the name g.csv
    for($y=0; $y<=$length; $y++) {

      for($i=1; $i<sizeof($fcontents); $i++) {
          $line = trim($fcontents[$i]);
          $arr = explode(",", $line);
          #if your data is tab separated
          # instead of comma separated,
          # change the ',' above to '\t'
       
          $sql = "insert into $table values ('".
                      implode("','", $arr) ."')";
          mysql_query($sql);
          echo $sql ."<br>\n";
     
          if(mysql_error()) {
            echo mysql_error() ."<br>\n";
          }
      }
      }
     
    }echo "<a href=upload4.php>Run script again to upload a new file, but first check the file names.</a>";
    ?>[/code]

    I have been trying to change things aruond a lot and it just wont work.  This file is in a directory called CSV.  The .csv files are also in this directory.
  7. Hi,

    I am stuck in my script.  I have a folder on my server with .csv files in it.  I am writing a php script that will pull all of those files into a mysql database.  My script should locate the directory that holds the .csv files, and break the .csv files up so that the information can be inserted into the Mysql table.  I got it working so that id have to manually enter the file name in the php script to upload it, but I need to be able to upload the entire folder.  Could someone please help me with searching the directory for .csv files and adding them to an array?  thanks
  8. Thanks for the reply, but I still need to be able to have the values of the drop down list to be the data from the MySQL database.  I know I need a query to select the name and the ID from the table, then I need to have a drop down list with the names and a text box (uneditable) for the id's to be displayed.  I think I will still need a javascript function, but I dont know how to create it. 
  9. I am trying to do pretty much the same thing.  I want to have a drop down list with names from a table, and when the user clicks on a name, the ID number associated with that name will appear in a textbox next to the drop down list.  Can someone help me with this?  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.