Jump to content

ma5ect

Members
  • Posts

    57
  • Joined

  • Last visited

    Never

Everything posted by ma5ect

  1. can any1 work out why the second query doesnt work <?php require_once('Connections/mysql_connect.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO `assignment submission sheet` (`Student number`, `Pathway / Course`, `Essay only`, `Marking tutor name`, `Module unit title`, `Module number`, `Assignment title`) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['Student_number'], "int"), GetSQLValueString($_POST['Pathway__Course'], "text"), GetSQLValueString($_POST['Essay_only'], "int"), GetSQLValueString($_POST['Marking_tutor_name'], "text"), GetSQLValueString($_POST['Module_unit_title'], "text"), GetSQLValueString($_POST['Module_number'], "text"), GetSQLValueString($_POST['Assignment_title'], "text")); mysql_select_db($database_mysql_connect, $mysql_connect); $Result1 = mysql_query($insertSQL, $mysql_connect) or die(mysql_error()); $insertGoTo = "submits.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_mysql_connect, $mysql_connect); $query_Recordset1 = "SELECT * FROM `assignment submission sheet`"; $Recordset1 = mysql_query($query_Recordset1, $mysql_connect) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); mysql_select_db($database_mysql_connect, $mysql_connect); $query_Recordset2 = "SELECT * FROM robsfiles"; $Recordset2 = mysql_query($query_Recordset2, $mysql_connect) or die(mysql_error()); $row_Recordset2 = mysql_fetch_assoc($Recordset2); $totalRows_Recordset2 = mysql_num_rows($Recordset2); if(isset($_POST['robsfiles']) && $_FILES['userfile']['size'] > 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } $query = "INSERT INTO robsfiles (name, size, type, content ) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$content')"; mysql_query($query) or die('Error, query failed'); echo "<br>File $fileName uploaded<br>"; } ?>
  2. still doesnt display any results...just blank
  3. oops dat was same code as above... correct code:: <?php require_once('Connections/mysql_connect.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_mysql_connect, $mysql_connect); $query_Recordset2 = "SELECT * FROM `assignment submission sheet`"; $Recordset2 = mysql_query($query_Recordset2, $mysql_connect) or die(mysql_error()); $row_Recordset2 = mysql_fetch_assoc($Recordset2); $totalRows_Recordset2 = mysql_num_rows($Recordset2); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> </body> </html> <?php mysql_free_result($Recordset2); ?>
  4. <?php require_once('Connections/mysql_connect.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) { $insertSQL = sprintf("INSERT INTO `assignment submission sheet` (`Student number`, `Pathway / Course`, `Essay only`, `Marking tutor name`, `Module unit title`, `Module number`, `Assignment title`) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['Student_number'], "int"), GetSQLValueString($_POST['Pathway__Course'], "text"), GetSQLValueString($_POST['Essay_only'], "int"), GetSQLValueString($_POST['Marking_tutor_name'], "text"), GetSQLValueString($_POST['Module_unit_title'], "text"), GetSQLValueString($_POST['Module_number'], "text"), GetSQLValueString($_POST['Assignment_title'], "text")); mysql_select_db($database_mysql_connect, $mysql_connect); $Result1 = mysql_query($insertSQL, $mysql_connect) or die(mysql_error()); $insertGoTo = "gygyui.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO `assignment submission sheet` (`Student number`, `Pathway / Course`, `Essay only`, `Marking tutor name`, `Module unit title`, `Module number`, `Assignment title`) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['Student_number'], "int"), GetSQLValueString($_POST['Pathway__Course'], "text"), GetSQLValueString($_POST['Essay_only'], "int"), GetSQLValueString($_POST['Marking_tutor_name'], "text"), GetSQLValueString($_POST['Module_unit_title'], "text"), GetSQLValueString($_POST['Module_number'], "text"), GetSQLValueString($_POST['Assignment_title'], "text")); mysql_select_db($database_mysql_connect, $mysql_connect); $Result1 = mysql_query($insertSQL, $mysql_connect) or die(mysql_error()); $insertGoTo = "gygyui.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_mysql_connect, $mysql_connect); $query_Recordset2 = "SELECT * FROM `assignment submission sheet`"; $Recordset2 = mysql_query($query_Recordset2, $mysql_connect) or die(mysql_error()); $row_Recordset2 = mysql_fetch_assoc($Recordset2); $totalRows_Recordset2 = mysql_num_rows($Recordset2); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table align="center"> <tr valign="baseline"> <td nowrap="nowrap" align="right">Student number:</td> <td><input name="Student_number" type="text" value="" size="32" maxlength="7" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Pathway / Course:</td> <td><input name="Pathway__Course" type="text" value="" size="32" maxlength="30" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Essay only:</td> <td><input name="Essay_only" type="text" value="" size="32" maxlength="7" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Marking tutor name:</td> <td><input name="Marking_tutor_name" type="text" value="" size="32" maxlength="25" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Module unit title:</td> <td><input name="Module_unit_title" type="text" value="" size="32" maxlength="30" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Module number:</td> <td><input name="Module_number" type="text" value="" size="32" maxlength="10" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Assignment title:</td> <td><input name="Assignment_title" type="text" value="" size="32" maxlength="30" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"> </td> <td><input type="submit" value="Insert record" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> </form> <p> </p> </body> </html> <?php mysql_free_result($Recordset2); ?>
  5. Hi ppl, I am trying to insert records into my database using a form. this works. but after this i would like the records to be displayed onto another page.. the database gets updated but the webpage i want the data to be displayed remains empty....any suggestions.. code so far. <?php require_once('Connections/mysql_connect.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) { $insertSQL = sprintf("INSERT INTO `assignment submission sheet` (`Student number`, `Pathway / Course`, `Essay only`, `Marking tutor name`, `Module unit title`, `Module number`, `Assignment title`) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['Student_number'], "int"), GetSQLValueString($_POST['Pathway__Course'], "text"), GetSQLValueString($_POST['Essay_only'], "int"), GetSQLValueString($_POST['Marking_tutor_name'], "text"), GetSQLValueString($_POST['Module_unit_title'], "text"), GetSQLValueString($_POST['Module_number'], "text"), GetSQLValueString($_POST['Assignment_title'], "text")); mysql_select_db($database_mysql_connect, $mysql_connect); $Result1 = mysql_query($insertSQL, $mysql_connect) or die(mysql_error()); $insertGoTo = "gygyui.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO `assignment submission sheet` (`Student number`, `Pathway / Course`, `Essay only`, `Marking tutor name`, `Module unit title`, `Module number`, `Assignment title`) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['Student_number'], "int"), GetSQLValueString($_POST['Pathway__Course'], "text"), GetSQLValueString($_POST['Essay_only'], "int"), GetSQLValueString($_POST['Marking_tutor_name'], "text"), GetSQLValueString($_POST['Module_unit_title'], "text"), GetSQLValueString($_POST['Module_number'], "text"), GetSQLValueString($_POST['Assignment_title'], "text")); mysql_select_db($database_mysql_connect, $mysql_connect); $Result1 = mysql_query($insertSQL, $mysql_connect) or die(mysql_error()); $insertGoTo = "gygyui.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_mysql_connect, $mysql_connect); $query_Recordset2 = "SELECT * FROM `assignment submission sheet`"; $Recordset2 = mysql_query($query_Recordset2, $mysql_connect) or die(mysql_error()); $row_Recordset2 = mysql_fetch_assoc($Recordset2); $totalRows_Recordset2 = mysql_num_rows($Recordset2); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table align="center"> <tr valign="baseline"> <td nowrap="nowrap" align="right">Student number:</td> <td><input name="Student_number" type="text" value="" size="32" maxlength="7" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Pathway / Course:</td> <td><input name="Pathway__Course" type="text" value="" size="32" maxlength="30" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Essay only:</td> <td><input name="Essay_only" type="text" value="" size="32" maxlength="7" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Marking tutor name:</td> <td><input name="Marking_tutor_name" type="text" value="" size="32" maxlength="25" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Module unit title:</td> <td><input name="Module_unit_title" type="text" value="" size="32" maxlength="30" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Module number:</td> <td><input name="Module_number" type="text" value="" size="32" maxlength="10" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Assignment title:</td> <td><input name="Assignment_title" type="text" value="" size="32" maxlength="30" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"> </td> <td><input type="submit" value="Insert record" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> </form> <p> </p> </body> </html> <?php mysql_free_result($Recordset2); ?>
  6. got it working thanks 4 all da help
  7. when i test the databse with the website it successfully connects and displays all the tables.. cud you suggest another method of connecteing the database with the website..
  8. but i do have that table in the database.. it does exist
  9. check login file: <? $hostname_mysql_connect = "localhost"; $database_mysql_connect = "website_members"; $username_mysql_connect = "root"; $password_mysql_connect = "******"; $tblname_mysql_connect ="members"; $mysql_connect = mysql_pconnect($hostname_mysql_connect, $username_mysql_connect, $password_mysql_connect, $tblname_mysql_connect) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($database_mysql_connect) or die(mysql_error()); $myusername = $_POST['myusername']; $mypassword = $_POST['mypassword']; $sql = "SELECT * FROM $tblname_mysql_connect WHERE username= '$myusername' and passwords='$mypassword'"; $result = mysql_query($sql) or die(mysql_error()); $count = mysql_num_rows($result); if($count==1) { session_register("myusername"); session_register("mypassword"); header("location: login_success_welcome.php"); } else { echo "Wrong Username or Password"; } ?>
  10. sure... $mysql_connect = mysql_pconnect($hostname_mysql_connect, $username_mysql_connect, $password_mysql_connect, $tblname_mysql_connect) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($database_mysql_connect) or die(mysql_error());
  11. Hi ppl.. i have a website setup and a database running with it, everything works fine on my desktop pc and now i am trying to get it working on my laptop.. but i get the following error when running the website could any1 plz suggest something error:Warning: mysql_pconnect() expects parameter 4 to be long, string given in C:\xampp\htdocs\checklogin.php on line 9 Fatal error: in C:\xampp\htdocs\checklogin.php on line 9 many thanks
  12. ok i think i have caused a little bit of confusion.. sorry for being vague...I have a website setup where students can upload files, with uploading these files i also want them to fill out a form stating its there work (name, details etc etc) but at the bottom of the form it needs to be signed off by them..this is what am stuck with.. what could be best way to do this.. hope this clears things up...
  13. what are the other alternatives?? digital signatures? and there's something in dreamweaver (AdobeĀ® Integrated Runtime (AIR)) would that also work?
  14. yes thats exactly wat am lookin for.. but cannot figure out how to do it..
  15. i have a form on my website, i want the user to be able to sign it off before submitting it. any software which will allow me to do this.
  16. is it possible to create an electronic signature on a form using dreamweaver cs3?? regards
  17. great thanx....will this script allow me to open any files that the user uploads..
  18. i have got it to open the files thanx...but 1 problem, the files are all shown in a single line instead of a column...
  19. now the files are displayed all in a line and are not recognised file types.. when i click open the following error appears: Warning: Header may not contain more than a single header, new line detected. in C:\xampp\htdocs\download.php on line 12 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\download.php:12) in C:\xampp\htdocs\download.php on line 13
  20. am sorry i cannot see this...
  21. I have a download script which holds files which have been uploaded by the users.. the files are shown on this page but once i try to open them, nothin happens...any1 help script <?php require_once('Connections/mysql_connect.php'); ?> <?php if(isset($_GET['name'])) { $name = $_GET['name']; $query = "SELECT type, size, content FROM uploadfiles WHERE name = '$name'"; $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); header("Content-Disposition: attachment; filename=$name"); header("Content-length: $size"); header("Content-type: $type"); echo $content; exit; } mysql_select_db($database_mysql_connect, $mysql_connect); $query_Recordset1 = "SELECT * FROM uploadfiles"; $Recordset1 = mysql_query($query_Recordset1, $mysql_connect) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); mysql_free_result($Recordset1); ?> <html> <head> <title>Download File From MySQL</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <? $query = "SELECT name FROM uploadfiles"; $result = mysql_query($query) or die('Error, query failed'); if(mysql_num_rows($result) == 0) { echo "Database is empty <br>"; } else { while(list($name) = mysql_fetch_array($result)) { ?> <a href="download.php?id=<?=$id;?>"><?=$name;?></a> <br> <? } } ?> </body> </html>
  22. I am trying to have a feature within my site which will allow users to upload files and store them into the sql database...after uploaded i would also like them files to be downloaded only by certain users..i am stuck as to how to start with this task..i am using dreamweaver cs3..any tutorials??
  23. Hi PPL, On my website i have setup user log in. once they log in i want to restrict certain users from certain pages.. and on some pages i want the user to enter their username and password again..but i am stuck on how to restrict them.. any user guides on how to tackle this issue..i am using dreamweaver cs3 many thanx
×
×
  • 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.