Search Results

Search found 81 results on 4 pages for 'user225269'.

Page 2/4 | < Previous Page | 1 2 3 4  | Next Page >

  • How to determine errors in java

    - by user225269
    I'm just a java beginner. Do you have any tips there on how to determine errors. I'm trying to connect to mysql derby database. I don't know how to determine the error, there is no red line, but there is a message box that shows up when I try to run the program. All I want to do is to display the first record in the database. All I get is this in the output: E:\Users\users.netbeans\6.8\var\cache\executor-snippets\run.xml:45: package Employees; import java.sql.Statement; import javax.swing.JOptionPane; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.ResultSet; /** * * @author Nrew */ public class Students extends javax.swing.JFrame { Connection con; Statement stmt; ResultSet rs; /** Creates new form Students */ public Students() { initComponents(); DoConnect(); } public void DoConnect(){ try { String host= "jdbc:derby://localhost:1527/YURA"; String uname = "bart"; String pword = "12345"; con = DriverManager.getConnection(host, uname, pword); stmt = con.createStatement( ); String SQL = "SELECT * FROM APP.XROSS"; rs = stmt.executeQuery(SQL); rs.next(); rs.next( ); int ids = rs.getInt("IDNUM"); String idz = Integer.toString(ids); String fname = rs.getString("FNAME"); String lname = rs.getString("LNAME"); String course = rs.getString("COURSE"); String skul = rs.getString("SCHOOL"); String gen = rs.getString("GENDER"); TextIDNUM.setText(idz); TextFNAME.setText(fname); TextLNAME.setText(lname); textCOURSE.setText(course); textSCHOOL.setText(skul); textGENDER.setText(gen); } catch (SQLException err) { JOptionPane.showMessageDialog(Students.this, err.getMessage()); } } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { TextIDNUM = new javax.swing.JTextField(); TextFNAME = new javax.swing.JTextField(); TextLNAME = new javax.swing.JTextField(); textCOURSE = new javax.swing.JTextField(); textSCHOOL = new javax.swing.JTextField(); textGENDER = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(116, 116, 116) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(textGENDER, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(textSCHOOL, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(textCOURSE, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(TextLNAME, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(TextFNAME, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(TextIDNUM, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)) .addContainerGap(243, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(37, 37, 37) .addComponent(TextIDNUM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(TextFNAME, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(TextLNAME, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(textCOURSE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(textSCHOOL, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(textGENDER, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(67, Short.MAX_VALUE)) ); pack(); }// </editor-fold> /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Students().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JTextField TextFNAME; private javax.swing.JTextField TextIDNUM; private javax.swing.JTextField TextLNAME; private javax.swing.JTextField textCOURSE; private javax.swing.JTextField textGENDER; private javax.swing.JTextField textSCHOOL; // End of variables declaration }

    Read the article

  • Problem with datagridvieew in vb.net

    - by user225269
    I'm trying to add a datagridview in vb.net, but it does not allow me to change the connection string or the database that should be imported to connect to it. The only thing that I'm seeing is the previous ms sql database that I connected with datagridview and everytime I click the new connection, the window closes and it leaves me with the datagridview with the previous connection that I have. And its not applicable because, now I want to connect it with mysql. Not ms sql. Its some sort of a cache like feature in vb.net, how do I get rid of it. so that I can add the new connection for mysql? Do I need to reinstall visual studio 2008?

    Read the article

  • How to get data from other php scripts

    - by user225269
    I have 2 files, one is used to view the data in the mysql database, and list it on a table: if($_POST['general'] == 'ADDRESS'){ $result2 = mysql_query("SELECT * FROM student WHERE ADDRESS='$saddress'"); echo "<table border='1'> <tr> <th>IDNO</th> <th>ADDRESS</th> <th>LASTNAME</th> <th>FIRSTNAME</th> <th>VIEW</th> </tr>"; while($row = mysql_fetch_array($result2)) { echo "<tr>"; echo "<td>" . $row['IDNO'] . "</td>"; echo "<td>" . $row['ADDRESS'] . "</td>"; echo "<td>" . $row['LASTNAME'] . "</td>"; echo "<td>" . $row['FIRSTNAME'] . "</td>"; echo "<td><a href='update.php?id=" . $row['IDNO'] . "'>view</a></td>"; echo "</tr>"; } echo "</table>"; } And this one is the update.php which I am working on, I just want to be able to see the data that corresponds to the one the record that I clicked on the first one using the link "view". <?php mysql_select_db("school", $con); $result3 = mysql_query("SELECT * FROM student WHERE IDNO='?'"); ?> <tr> <td width="30" height="35"><font size="3">*I D Number:</td> <td width="30"><input name="idnum" onkeypress="return isNumberKey(event)" type="text" maxlength="5" id='numbers'/ value="<?php echo $row["IDNO"]; ?>"></td> </tr> But I do not know how do I link the two, in such a way that the corresponding data in here: echo "<td><a href='update.php?id=" . $row['IDNO'] . "'>view</a></td>"; would be reflected in here: <td width="30"><input name="idnum" onkeypress="return isNumberKey(event)" type="text" maxlength="5" id='numbers'/ value="<?php echo $row["IDNO"]; ?>"></td> </tr> Please give me an idea on how I can do this, thanks.

    Read the article

  • Form dependency manager javascript

    - by user225269
    Need help in form dependency manager javascript: As you can see the checkbox below depends on either of the two criteria (the info=student or the info=all). I've come up with the code below based on this: DEPENDS ON name [BEING value] [OR name [BEING value]] CONFLICTS WITH name [BEING value] from this site: http://www.dynamicdrive.com/dynamicindex16/formdependency.htm Here's the code: <tr> <td> <input type="hidden" name="yr"> <label> <input type="checkbox" name="yr" value="year" class="DEPENDS ON info BEING student OR info BEING all"> Year</label> </td> </tr> EDIT What do I do?It doesn't work. When I change this: DEPENDS ON info BEING student Into this: DEPENDS ON info BEING student OR info BEING all The checkbox which depends on the radio button to be clicked first before it shows up. Will show up before any of the radio buttons( student, all) will be clicked.

    Read the article

  • parse error in php code

    - by user225269
    I just started php and I want to know how to make this parse error work. This is the error: Parse error: parse error in E:\wamp\www\PHP\create.php on line 22 And here is my code, by the way I'm making a database manipulating system. And I use wampserver and dreamweaver. <?php include 'E:\wamp\www\PHP\connection.php'; $IDNUMBER = $_POST['ID']; $LNAME = $_POST['Lname']; $FNAME = $_POST['Fname']; $MNAME = $_POST['Mname']; $GRADEYR = $_POST['GradeYr']; $ADDRESS = $_POST['Address']; if(!$_POST['submit']) { echo "please fill out the form"; header('Location: E:\wamp\www\PHP\main.php'); } else { mysql_query = "INSERT INTO students (`IDNUMBER`,`LNAME` ,`FNAME` ,`MNAME` ,`GRADEYR` ,`ADDRESS`) VALUES (NULL, '$IDNUMBER', '$LNAME', '$FNAME', '$MNAME', '$GRADEYR', '$ADDRESS')") or die(mysql_error()); echo "User has been added!"; header('E:\wamp\www\PHP\main.php'); } ?> Please help, I'm just a beginner in php.

    Read the article

  • How to hide labels in html

    - by user225269
    I have this code which depends on this javascript from dynamic drive: http://dynamicdrive.com/dynamicindex16/formdependency.htm Its a form dependency manager. Which will show or hide elements depending on what you choose from the forms that are revealed: I don't know why but If I alter the code from this: <td> <label>ID Number<input type="checkbox" name="id" class="DEPENDS ON info BEING student"></label> </td> </tr> To this: <td> <input type="hidden" class="DEPENDS ON info BEING student"> <label style="margin-bottom: 1em; padding-bottom: 1em; border-bottom: 3px silver groove;"></label> <tr> <td> <input type="checkbox" name="id" class="DEPENDS ON info BEING student"><label>ID Number</label> </td> </tr> Note: The only change that I did here is to transfer the label from the left side of the checkbox to the right side so that they will look better. But when I do this. The labels will be visible even if I did not yet click on the button that will make it visible(but without the checkboxes). And when I click on that button, that's the only time when the checkbox will appear on the left side of the labels. The checkbox is ok, but the label is not. And the javascript is working properly. What do I do so that the checkbox and label will go together?

    Read the article

  • error in mysql syntax in vb.net

    - by user225269
    I get this error, while I'm testing the code below: 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 '[student](ID, LASTNAME, FIRSTNAME, SCHOOL) VALUES ('333', 'aaa', 'aaa', 'aaa')' at line 1 I just recycled the code that I used in manipulating ms sql database. So the syntax must be wrong. What might be the correct syntax for adding records into mysql database? Here is my current code: idnum = TextBox1.Text lname = TextBox2.Text fname = TextBox3.Text skul = TextBox4.Text Using sqlcon As New MySqlConnection("Server=localhost; Database=testing;Uid=root;Pwd=nitoryolai123$%^;") sqlcon.Open() Dim sqlcom As New MySqlCommand() sqlcom.Connection = sqlcon sqlcom.CommandText = "INSERT INTO [student](ID, LASTNAME, FIRSTNAME, SCHOOL) VALUES (@ParameterID, @ParameterLastName, @ParameterFirstName, @ParameterSchool)" sqlcom.Parameters.AddWithValue("@ParameterID", TextBox1.Text) sqlcom.Parameters.AddWithValue("@ParameterLastName", TextBox2.Text) sqlcom.Parameters.AddWithValue("@ParameterFirstName", TextBox3.Text) sqlcom.Parameters.AddWithValue("@ParameterSchool", TextBox4.Text) sqlcom.ExecuteNonQuery() End Using Please help, thanks

    Read the article

  • new line in java

    - by user225269
    Java newbie here, I'm having trouble setting a new line in this code: String FnameTextboxText = FnameTextbox.getText(); String LastnameTextboxText = LastnameTextbox.getText(); String CourseTextboxText = CourseTextbox.getText(); Summary.setText("Firstname:" + " " + FnameTextboxText + "\nLastname:" + " " + LastnameTextboxText + "\nCourse:" + " " + CourseTextboxText); Also tried something like: "\n" + "Lastname" But its no good. Do you have any idea on how to make new lines. So that it'll look like this; Firstname: x Lastname: y Course: Z Using netbeans 6.8. On windows.

    Read the article

  • How to load the rest of the data in mysql in php

    - by user225269
    I have trouble figuring out how do I load the rest of the data in html. Here is my code: <?php $con = mysql_connect("localhost","root","nitoryolai123$%^"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $con); $result = mysql_query("SELECT * FROM student WHERE IDNO='$_GET['id']'"); ?> <?php while ( $row = mysql_fetch_array($result) ) { ?> <table class="a" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D3D3D3"> <tr> <form name="formcheck" method="post" action="updateact.php" onsubmit="return formCheck(this);"> <td> <table border="0" cellpadding="3" cellspacing="1" bgcolor=""> <tr> <td colspan="16" height="25" style="background:#5C915C; color:white; border:white 1px solid; text-align: left"><strong><font size="2">Update Students</td> <tr> <td width="30" height="35"><font size="2">*I D Number:</td> <td width="30"><input name="idnum" onkeypress="return isNumberKey(event)" type="text" maxlength="5" id='numbers'/ value="<?php echo $_GET['id']; ?>"></td> </tr> <tr> <td width="30" height="35"><font size="2">*Year:</td> <td width="30"><input name="yr" onkeypress="return isNumberKey(event)" type="text" maxlength="5" id='numbers'/ value="<?php echo $row["YEAR"]; ?>"></td> this is the part where I am getting the error: mysql_select_db("school", $con); $result = mysql_query("SELECT * FROM student WHERE IDNO='$_GET['id']'"); ? What do you recommend that I could do so that I can also load the ID Numbers corresponding data into the other forms?

    Read the article

  • any suggestions on this css print problem

    - by user225269
    I have this code on my print.css: #header, #tae, #nav, .noprint {display: none;} width: 100%; margin: 0; float: none; In order not to display the elements within those div tags. But I don't know with the code below why it isn't cooperating. If I place the div tags on it. And then I hit the print button. I see no output. Here it is: <div id="tae"> <table border="0" align="center" cellpadding="0" cellspacing="0" class="bg1"> <tr> <td class="text1" style="height: 50px;">xd627 information management system</td> </tr> <tr> <td class="bg5"><table border="0" cellspacing="0" cellpadding="0" style="height: 62px; padding-top: 15px;"> <tr align="center"> <td><a href="userpage.php" class="link1">Homepage</a></td> <td><a href="RegStuds.php" class="link1">Database</a></td> <td><a href="#" class="link1">About</a></td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </table></td> </tr> <tr> <td valign="top" class="bg6">&nbsp;</td> </tr> <tr> <td><table width="780" border="0" cellspacing="0" cellpadding="0"> <tr valign="top"> <td width="20">&nbsp;</td> <td width="297"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="images/spacer.gif" alt="" width="30" height="30" /></td> </tr> </tr> <tr> <td class="text2"> </div> <div id="max"> <?php //some php code in here showing a mysql table. ?> </div> What's wrong with my code? Does the php script depend on the one where I put the div tag in? What do I do? All I want to show up in my page when printed is the mysql table. I'm using Universal Document Converter to simulate printing.

    Read the article

  • How to compare a string with an option value

    - by user225269
    I have this html form which has options: <tr> <td width="30" height="35"><font size="3">*List:</td> <td width="30"><input name="specific" type="text" id="specific" maxlength="25" value=""> </td> <td><font size="3">*By:</td> <td> <select name="general" id="general"> <font size="3"> <option value="YEAR">Year</option> <option value="ADDRESS">Address</option> </select></td></td> </tr> And I'm trying to have this as the form action: if ('{$_POST["ADDRESS"]}'="ADDRESS") Which will compare if the value in the option in the html form matches the word "Address". If it matches then it will execute this query: $saddress= mysql_real_escape_string($_POST['specific']);<--this is the input form where the user will put the specific address to search. mysql_query("SELECT * FROM student WHERE ADDRESS='$saddress'"); Please I need help in here, I thinks its wrong: if ('{$_POST["ADDRESS"]}'="ADDRESS")

    Read the article

  • How to disable back button in browser using javascript or any script

    - by user225269
    Im using wamp server for my php scripts. And Im having difficulties on the logout code. Every time I click on the logout link and then click on the back button on web browser it still shows the page which can only be access by the user who is logged in. I have this code at the beginning of the index.php which is called by the log out link to destroy the session: <?php session_start(); session_destroy(); ?> And I have this at the beginning of the user page: <? session_start(); if(!session_is_registered(myusername)){ header("location:login.php"); } ?> I don't know why the userpage can still be access after the user has logged out. So I'm thinking of disabling the back button when the user has logged out. Please help.

    Read the article

  • having trouble in mysql if statement

    - by user225269
    I just want to simplify what I am doing before, having multiple php files for all data to be listed. Here is my html form: <table border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D3D3D3"> <tr> <form name="formcheck" method="post" action="list.php" onsubmit="return formCheck(this);"> <td> <table border="0" cellpadding="3" cellspacing="1" bgcolor=""> <tr> <td colspan="16" height="25" style="background:#5C915C; color:white; border:white 1px solid; text-align: left"><strong><font size="3">List Students</td> </tr> <tr> <td width="30" height="35"><font size="3">*List:</td> <td width="30"><input name="specific" type="text" id="specific" maxlength="25" value=""> </td> <td><font size="3">*By:</td> <td> <select name="general" id="general"> <font size="3"> <option>Year</option> <option>Address</option> </select></td></td> </tr> <tr> <td width="10"><input align="right" type="submit" name="Submit" value="Submit" > </td> </tr> </form> </table> And here's the form action: <?php $con = mysql_connect("localhost","root","nitoryolai123$%^"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $con); $gyear= $_POST['general']; if ("YEAR"==$_POST['general']) { $result = mysql_query("SELECT * FROM student WHERE YEAR='{$_POST["specific"]}'"); echo "<table border='1'> <tr> <th>IDNO</th> <th>YEAR</th> <th>LASTNAME</th> <th>FIRSTNAME</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['IDNO'] . "</td>"; echo "<td>" . $row['YEAR'] . "</td>"; echo "<td>" . $row['LASTNAME'] . "</td>"; echo "<td>" . $row['FIRSTNAME'] . "</td>"; echo "</tr>"; } echo "</table>"; } mysql_close($con); ?> Please help, how do I equate the YEAR(column in mysql database) and the option box(general). if ("YEAR"==$_POST['general']) please correct me if I'm wrong.

    Read the article

  • need help on php if statement

    - by user225269
    <?php if (!isset($_SESSION['loginAdmin']) || ($_SESSION['loginAdmin'] == '')) { header ("Location: loginam.php"); } else { include('head2.php'); } if (!isset($_SESSION['login']) || ($_SESSION['login'] == '')) { header ("Location: login.php"); } else { include('head3.php'); } ?> I'm really stuck at this problem. What I want to do is to be able to redirect the user to another page base on the information entered. My problem is: if this statement is true: else { include('head3.php'); } This one would also be true: if (!isset($_SESSION['loginAdmin']) || ($_SESSION['loginAdmin'] == '')) { header ("Location: loginam.php"); } Leading me to the login page whether I'm admin or just ordinary user. Is it possible two separate the two if statements so that if this is true: else { include('head3.php'); } Then this statement shouldn't get in the way and redirect me back to the login page: if (!isset($_SESSION['loginAdmin']) || ($_SESSION['loginAdmin'] == '')) { header ("Location: loginam.php"); }

    Read the article

  • How to populate html combo box with mysql data

    - by user225269
    Please help, I'm having trouble loading mysql data on the combo box. The data that I'm loading is 1 column from a table. Here is my current code, and it crashed firefox for some reason: <td colspan=”2?>Religion</TD> <td> <select name="REL" onClick="submitCboSemester();"> <?php $query_disp="SELECT * FROM Religion ORDER BY RID"; $result_disp = mysql_query($query_disp, $conn); while($query_data = mysql_fetch_array($result_disp)) { ?> <option value="<? echo $query_data["RID"]; ?>"<?php if ($query_data["RID"]==$_POST['REL']) {?>selected<? } ?>><? echo $query_data["RELIGION"]; ?></option> <? } ?> </select> </td> The column is RELIGION and it ID is RID How do I populate the combo box with all the data in the column RELIGION

    Read the article

  • Problem updating values in combobox in vb.net

    - by user225269
    I have this code, but I have a problem. When I update but do not really made any changes to the value and press the update button, the data becomes null. And it will seem that I deleted the value. I've taught of a solution, that is to add both combobox1.selectedtext and combobox1.selecteditem to the function. But it doesn't work. combobox1.selecteditem is working when you try to alter the values when you update. But will save a null value when you don't alter the values using the combobox combobox1.selectedtext will save the data into the database even without altering. But will not save the data if you try to alter it. -And I incorporated both of them, but still only one is performing, and I think it is the one that I added first: Dim shikai As New Updater Try shikai.id = TextBox1.Text shikai.fname = TextBox2.Text shikai.mi = TextBox3.Text shikai.lname = TextBox4.Text shikai.ad = TextBox5.Text shikai.contact = TextBox9.Text shikai.year = ComboBox1.SelectedText shikai.section = ComboBox2.SelectedText shikai.gender = ComboBox3.SelectedText shikai.religion = ComboBox4.SelectedText shikai.year = ComboBox1.SelectedItem shikai.section = ComboBox2.SelectedItem shikai.gender = ComboBox3.SelectedItem shikai.religion = ComboBox4.SelectedItem shikai.bday = TextBox6.Text shikai.updates() MsgBox("Successfully updated!") Please help, what would be a simple workaround to solve this problem?

    Read the article

  • number only html form

    - by user225269
    what is the code if you want that only number should be inputted in an html textbox. If you input letters there will be no letter that would show. If you input numbers, the numbers would show, please help

    Read the article

  • How to load mysql data on separate forms

    - by user225269
    I used this code to add the data in the mysql table. But I do not know how to separate them because they are only stored in one column: $birthday = mysql_real_escape_string($_POST['yyyy'] . '-' . $_POST['mm'] . '-' . $_POST['dd']); How do I load them in here, so that the month, day, and year will be separated: <tr> <td><font size="2">Birthday</td> <td> <select title="- Select Month -" name="mm" id="mm" class="" > <option value="" >--Month--</option> <option value="1" >Jan</option> <option value="2" >Feb</option> <option value="3" >Mar</option> <option value="4" >Apr</option> <option value="5" >May</option> <option value="6" >Jun</option> <option value="7" >Jul</option> <option value="8" >Aug</option> <option value="9" >Sep</option> <option value="10" >Oct</option> <option value="11" >Nov</option> <option value="12" >Dec</option> </select> <input title="Day" type="text" onkeypress="return isNumberKey(event)" name="dd" value="" size="1" maxlength="2" id='numbers'/ > <input title="Year" type="text" onkeypress="return isNumberKey(event)" name="yyyy" value="" size="1" maxlength="4" id='numbers'/> </td> </tr> Please help.

    Read the article

  • How to compare filename of uploaded file and string

    - by user225269
    I use this code to upload image files in xammp server: <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 100000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file, File must be less than 100Kb in size with .jpg, .jpeg, or .gif file extension"; } ?> What do I do to compare the file name of the uploaded files with the text inputted by the user? My goal is to be able to compare the user input(ID number) and the file name of the image file which should also be an ID number. So that I will be able to display the image that corresponds with the ID Number provided. What do I need to do?Please give me an idea on how can I achieve this. Thanks

    Read the article

  • how to open another window and close the window that calls it

    - by user225269
    I have this code in userpage.php: <script langauge="JavaScript"><!-- function newWindow(fileName,windowName) { msgWindow=window.open(fileName,windowName); } //--></script> <a href="javascript:newWindow('1.html','window1')">Logout</a> And this code at index.php: <script language="JavaScript"><!-- function newWindow(fileName,windowName) { msgWindow=window.open(fileName,windowName); } function replaceURL(fileName) { newWindow(fileName,'window2'); self.close(); } //--></script> What Im trying to do is to call another window that show index.php. Calling it with the userpage.php. But the script doesn't close the window that calls it. Its a logout link. Because when I press back button after logging out. I end up seeing the page which only the user that has logged in can access

    Read the article

  • Can not issue data manipulation statements with executeQuery in java

    - by user225269
    I'm trying to insert records in mysql database using java, What do I place in this code so that I could insert records: String id; String name; String school; String gender; String lang; Scanner inputs = new Scanner(System.in); System.out.println("Input id:"); id=inputs.next(); System.out.println("Input name:"); name=inputs.next(); System.out.println("Input school:"); school= inputs.next(); System.out.println("Input gender:"); gender= inputs.next(); System.out.println("Input lang:"); lang=inputs.next(); Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/employee_record", "root", "MyPassword"); PreparedStatement statement = con.prepareStatement("insert into employee values('id', 'name', 'school', 'gender', 'lang');"); statement.executeUpdate();

    Read the article

  • Post and get at the same time in php

    - by user225269
    Do you have any suggestions with my problem. I need to use get and post at the same time. Get because I need to output what the user has typed. And post because I need to access the mysql database in relation to that input. It looks something like this: <form name="x" method="get" action="x.php"> <input name="year" type="text"> <select name="general" id="general"> <font size="3"> <option value="YEAR">Year</option> </form> This will output the contents of mysql depending on what the user will check: <form name="y" method="post" action"y.php"> <input name="fname" type="checkbox"> </form> And the form action of those two combined will look something like this: <?php if($_POST['general'] == 'YEAR'){ ?> <?php echo $_GET["year"]; ?> <?php $result2 = mysql_query("SELECT * FROM student WHERE student.YEAR='$syear'"); ?> <table border='1'> <tr> <?php if ( $ShowLastName ) { ?><th>LASTNAME</th><?php } ?> <?php if ( $ShowFirstName ) { ?><th>FIRSTNAME</th><?php } ?> </tr> <?php while ( $row = mysql_fetch_array($result2) ) { if (!$result2) { } ?> <tr> <td><?php echo $row['IDNO']?> </td> <td><?php echo $row['YEAR'] ?> </td> <?php if ( $ShowLastName ) { echo('<td>'.$row['LASTNAME'].'</td>'); } ?></td> <?php if ( $ShowFirstName ) { echo('<td>'.$row['FIRSTNAME'].'</td>'); } ?> I really get lots of undefined errors when I do this. What can you recommend that I should do in order to get the value inputted by the user together with the mysql data.

    Read the article

< Previous Page | 1 2 3 4  | Next Page >