Jump to content

Buglish

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

About Buglish

  • Birthday 03/09/1983

Contact Methods

  • MSN
    buglish@yahoo.com

Profile Information

  • Gender
    Male
  • Location
    South Africa

Buglish's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, Yes I was worried that my first design of sessions looks a bit flimsy or not robust enough. I am new to PHP so I am not sure how to approach this matter. Thanks for the Info.
  2. Hi I have made this basic model for all pages in my website. -Will this be too much overhead processing and improper space utilization? -Is this a terrible way to authenticate the user and have different classes of login functions? [code] <?php session_start();?> <html>     <head>         <title>Title</title>     </head>     <body>             <?php     include "../bin/db.php";     $pagelink = $_GET['pagelink'];     $submit = $_POST['submit'];     $username ="";     $password="";     $loginType=0;            function Learner()     {         global $submit,$pagelink,$username,$password,$loginType;        }         function Guest()     {         global $submit,$pagelink,$username,$password,$loginType;            }         function Instructor()     {         global $submit,$pagelink,$username,$password,$loginType;     }         function Admin()     {         global $submit,$pagelink,$username,$password,$loginType;        }         // -----------Start of Main Code--------         if (!isset($_SESSION)) //Create or retrieve session variables         {                    $_SESSION['username']="Guest";           $_SESSION['password']="Guest";           $_SESSION['logintype']=0;           echo  $_SESSION['username'];           echo  $_SESSION['password'];         }         else         {             ?>             You are Logged on.<br>             <?php           $username = $_SESSION['username'];           $password = $_SESSION['password'];           $loginType = $_SESSION['logintype'];            }                 switch($loginType)         {             case 0 : Guest(); break;             case 1 : Learner(); break;             case 2 : Instructor(); break;             case 3 : Admin(); break;             default : Guest(); break;         }                    ?>                  </body> </html> [/code]
  3. Please help. Now noting works.I reinstalled MySQL 5 and recreated the Database. But not when i try to insert a table using the SQL insert block i get this message mport.php: Missing parameter: import_type (FAQ 2.Cool import.php: Missing parameter: format (FAQ 2.Cool and when I try to remove the database i get this Error SQL query: Documentation SELECT * FROM MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 ------------------ It previously worked. What version did I install incorectly?
  4. None.Its just dont want to do anything.PhpmyAdmin cannot do anything with the DB except add stuff. Ill have to resinstall mySQL and remake the DB.But how do I know this will not happen again? I think it might have been becaus I didnt clode the connection everytime after use. Can that have an affect after i restart?
  5. Its the root user and it has ALL PRIVILEGES.
  6. Hi, I am using PHP5 , MySQL5, Apache 2 My Database was created with phpmyAdmin. Then I inserted with script and phpmyAdmin data into the Database. Now I am Unable to empty or delete or remove any fields out of the Database. Neither a script ot phpmyAdmin can delete. What has blocked the database? I have restarted my pc, Still I am unable to remove anything. Please help me. Regards Bug
  7. Hi I am a newbie at PHP and MySQL. I have this function that is suppose to insert the values into the temp database. I am sure the values are being passed and splited from file(CSV) into the correct variables. But when it must write to database the Data is not writen. Is there something wrong with my syntax? I do get the Last echo, that means all fields has been processed...but still no data in DB. //------------------------------------------------------------------ <?php function breakname($fullnamein)     {     $fullnamebreak = explode(" ",$fullnamein);     //inticate that these variables are the gobal ones not local ones     global $title,$initials,$surname;     for($p=0;$p<3;$p++)     { switch($p) { case 0 :$title = $fullnamebreak[$p];break; case 1 :$initials = $fullnamebreak[$p];break; case 2 :$surname = $fullnamebreak[$p];break; } }       } //$link = "/EclipseWorkspace/LPCL101/files/*.php"; //Test File  /EclipseWorkspace/LPCL101/files/eov321_2006.csv //add the refix http to the link to use abolute access $link = "http://localhost/".$link; $parts = explode(" ",$format); //break the input format into parts $db = mysql_connect("localhost","root","password1");//connect to database //open file or catch error $file =  fopen($link, "r") or exit("Unable to open file!<br><br>" . "<a href='extract_data_file.php'>Back</a>"); //create a temp password for student = 12345 $password = 12345; $x=1; //Type holder //Read a line of the file until the end is reached while(!feof($file)) { $line= fgets($file);//read line $linebreak = explode(",",$line );//break up the line for($i=0;$i<3;$i++) { switch($parts[$i]) { case "%name"  : breakname($linebreak[$i]); break; case "%num"  : $lnumber = $linebreak[$i]; break; case "%course": $course = $linebreak[$i]; break; } } //Write line data to database   mysql_select_db("Students",$db);   $sql = "INSERT INTO Students (S_StudentNum,S_Password,S_Surname,S_Title,S_Initials) VALUES ('$lnumber','$password','$surname','$title','$initials')"; $result = mysql_query($sql); //Write line data into Course links mysql_select_db("CourseLinks",$db); $sql = "INSERT INTO CourseLinks (CL_Type,CL_Person,CL_Course) VALUES ('$x','$lnumber','$course')"; $result = mysql_query($sql); } fclose($file); echo "Thank you! Information updated.<br>"; ?>
×
×
  • 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.