kwesiaryee 0 Newbie Poster

Please can anyone help me with a simple sample on how to populate JCombobox with data(mysql etc) using Java persistence (JPA). I am quite new to this component so I desperately need help with this.

kwesiaryee 0 Newbie Poster

Generally, it will depend on the developer to make any application secure enough, but if I need to choose between JSP, PHP and ASP,... I will choose JSP to be the most secure.

A good developer can create a very secure app with jsp as java in general is based on a secure infrastructure. With the added benefits of JavaFX, the sky is your limit with security and design. but most design cannot be mentioned here as web development uses css and html for design and this has little to do with security.

In my opinion JSP first, when we talk about security. Then followed by PHP because although php is no where close to jsp even at the current php 5.3 (with the all new Object Orientation), its worth learning as its very easy to study and implement. As for ASP, well Microsoft always needs an antivirus,.. that should give you an idea of how porous their security is even on their best app.

I will tell you to be good in php for web and be better with java based app if security is your concern.

Good luck

kwesiaryee 0 Newbie Poster

if the apache is working fine with the php create a php file and insert the following code in it;

<? echo phpinfo() ?>

if scroll through the generated page, if you should not see the mysql among then, try looking at your apache/config/httpd.conf.

kwesiaryee 0 Newbie Poster

What I want to do is to calculate date difference between two fields so that i can present the result in another field and use that result to calculate the total price for a flight before the data is sent to the database...

Can i get help for this please

kwesiaryee 0 Newbie Poster

Hi there,

Can some one help me with the following problem. I need to pass the date to 2000-02-02 date format so that mysql will accept it. The following code is as follows;

function checkdate() {
var begDate = new Date(document.demoform.now.value);
var endDate = new Date(document.demoform.later.value);
var difDate = endDate.getTime() - begDate.getTime();
var days = difDate / (24*60*60*1000);
alert(days);
}

Can someone please help me with how to do this so that I get the 2000-01-01 date partern?

Your help will be really apprecaiated

kwesiaryee 0 Newbie Poster

Hi there,
I am new to JSF and can someon please help me on how to extract the session value wich is the login name of the user for persistence in the backing beans....

I will be most grateful for your respons.

kwesiaryee 0 Newbie Poster

I need desperate help;

I need to extract a user id from mysql database to make the id into a session, i have tried all that i know and it doesn't. My last resort was the following code from DW and it just breaks my design. The code is; <%=(((private_d_data = private_d.getObject("private_id")) == null || private_d.wasNull()) ? "" : private_d_data)%> Does any one knows the best way to work around this.

kwesiaryee 0 Newbie Poster

I am trying to display image files stored in my mysql. It displays alright as a direct php echo, but when i put it in an <img.../> src attribute... I get a cross. The following is the code snippet;

...
$query = mysql_query("SELECT pid, imgdata FROM pix WHERE pid='2'");
    $row = mysql_fetch_array($query);
    $content = $row['imgdata'];
    header('Content-type: image/jpg');
    //echo $content;
?>

<html>
    <title>Sample Pix</title>
    <body>
        <table border="0" cellspacing="4" cellpadding="5">
            <tbody>
                <tr>
                <td><img src=$content width="200" height="170"/>
<!-- <img trial1 src=" echo $row['$content']; ?> trial2 echo $content;--></td>
                </tr>
            </tbody>
        </table>

    </body>
</html>

Any help that will help me display these images quickly in the attribute with the attribute measurement will be very appreciated very much.

kwesiaryee 0 Newbie Poster

Can someone help on how how to build an intranet for my php website for more than two computers, so that all the computers can access the same web content on the local server.
I tried but I got errors telling me the website cannot be accessed even when I used the local server IP address to set it up. I used the tutorials found in the apache software guide.

Help me out, please

kwesiaryee 0 Newbie Poster

:S Hi I need help urgently.. I want to insert data into two mysql tables using just one form. Tried to do it through the following code below, but keep on getting horible errors when i submit. The essence is that the client has to fill all data without moving to another page after each submission.

I really need help PLease.

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
        $insertSQL = sprintf("INSERT INTO educate (applicant_id, ae_level, school, ae_from, ae_to, Qualification, updated_since) VALUES (%s, %s, %s, %s, %s, %s, %s)",
            GetSQLValueString($_POST['applicant_id'], "int"),
            GetSQLValueString($_POST['ae_level'], "text"),
            GetSQLValueString($_POST['school'], "text"),
            GetSQLValueString($_POST['ae_from'], "date"),
            GetSQLValueString($_POST['ae_to'], "date"),
            GetSQLValueString($_POST['Qualification'], "text"),
            GetSQLValueString($_POST['updated_since'], "date"));

       $insertSQL = sprintf("Insert Into reference (applicant_id, ref_one, ref_oneCon, ref_two, ref_twoCon, updated_since) Values(%s, %s, %s, %s, %s, %s)",
            GetSQLValueString($_POST['applicant_id'], "int"),
            GetSQLValueString($_POST['ref_one'], "text"),
            GetSQLValueString($_POST['ref_oneCon'], "text"),
            GetSQLValueString($_POST['ref_two'], "text"),
            GetSQLValueString($_POST[' ref_twoCon'], "text"),
            GetSQLValueString($_POST['updated_since'], "date"));

        mysql_select_db($database_rakes, $rakes);
        $Result1 = mysql_query($insertSQL, $rakes) or die(mysql_error());

        $insertGoTo = "another_job_applicant_entry";
        if (isset($_SERVER['QUERY_STRING'])) {
            $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
            $insertGoTo .= $_SERVER['QUERY_STRING'];
        }
        header(sprintf("Location: %s", $insertGoTo));
    }

With the following as the table;

<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
										<table width="100%" border="0" cellspacing="3" cellpadding="3">
										  <tr>
											<td width="50%">

                                                <table width="100%">
                                                    <tr valign="baseline">
                                                    <td nowrap align="right">Applicant:</td>
                                                    <td><select name="applicant_id">
                                                            <?php
                                                                do {
                                                                ?>
                                                            <option value="<?php echo $row_identify['applicant_id']?>" ><?php echo $row_identify['user_name']?></option>
                                                            <?php
                                                            } while ($row_identify = mysql_fetch_assoc($identify));
                                                        ?>
                                                        </select>
                                                    </td>
                                                    <tr>
                                                    <tr valign="baseline">
                                                        <td nowrap align="right">Educational Level:</td>
                                                        <td><select name="ae_level">
                                                                <option value="Doctorate" <?php if (!(strcmp("Doctorate", ""))) {echo "SELECTED";} ?>>Doctorate</option>
                                                                <option value="Masters Degree" <?php if (!(strcmp("Masters Degree", ""))) {echo "SELECTED";} ?>>Masters Degree</option>
                                                                <option value="Post Graduate Diploma" <?php if (!(strcmp("Post …
kwesiaryee 0 Newbie Poster

:S
Hi,
I am terribly stuck with this code. It is suposed to upload my images to the mysql database with the foreign key(property_id). At first it worked, then later started giving serious errors where the web page could not load. I am lost. Can any one help me, solve this...please:confused: . Below is the code snippet.

<form method="post" enctype="multipart/form-data">
                                                                                    <table width="350" border="0" cellpadding="1" cellspacing="1" class="box">
                                                                                        <tr>
                                                                                            <td class="formText">Property Description:&nbsp;&nbsp;
                                                                                                <select name="userfile">
                                                                                                    <?php
                                                                                                        do {
                                                                                                        ?>
                                                                                                    <option value="<?php echo $row_cust['property_id']?>">
                                                                                                        <?php echo $row_cust['description']?>
                                                                                                    </option>
                                                                                                    <?php
                                                                                                    } while ($row_cust = mysql_fetch_assoc($cust));
                                                                                                    $rows = mysql_num_rows($cust);
                                                                                                    if($rows > 0) {
                                                                                                        mysql_data_seek($cust, 0);
                                                                                                        $row_cust = mysql_fetch_assoc($cust);
                                                                                                    }
                                                                                                ?>
                                                                                            </select></td>
                                                                                            <td width="125">                                                                                            </td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td>&nbsp;</td>
                                                                                            <td></td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td width="218">
                                                                                                <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
                                                                                                <input name="userfile" type="file" id="userfile">
                                                                                            </td>
                                                                                            <td width="125"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td class="text" colspan="2">
                                                                                                <?php
                                                                                                    if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)
                                                                                                    {
                                                                                                        $fileName = $_FILES['userfile']['name'];
                                                                                                        $tmpName  = $_FILES['userfile']['tmp_name'];
                                                                                                        $fileSize = $_FILES['userfile']['size'];
                                                                                                        $fileType = $_FILES['userfile']['type'];
                                                                                                        $pid = $_POST['userfile']['property_id'];
                                                                                                
                                                                                                        $fp      = fopen($tmpName, 'r');
                                                                                                        $content = fread($fp, filesize($tmpName));
                                                                                                        $content = addslashes($content);
                                                                                                        fclose($fp);
                                                                                                
                                                                                                        if(!get_magic_quotes_gpc())
                                                                                                        {
                                                                                                            $fileName = addslashes($fileName);
                                                                                                        }
                                                                                                
                                                                                                        include 'library/config.php';
                                                                                                        include 'library/opendb.php';
                                                                                                
                                                                                                        $query = "INSERT INTO upload (property_id, name, size, type, content ) ".
                                                                                                                                                                                                          "VALUES ('$pid', '$fileName', '$fileSize', '$fileType', '$content')";
                                                                                                
                                                                                                        mysql_query($query) or die('Error, query failed'); 

                                                                                                        include 'library/closedb.php';
                                                                                                
                                                                                                        echo "<br>$fileName has been uploaded Successfully <br>";
                                                                                                    }
                                                                                                ?>
                                                                                            </td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td class="text" colspan="2"><a href="submit_thanks.php">Continue</a>, if done with image uploads.</td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td colspan="2">&nbsp;</td>
                                                                                        </tr>
                                                                                    </table>
                                                                                </form>
kwesiaryee 0 Newbie Poster

Hi there,

I desperately need help with this. I need to develop a code to upload an image to mysql database. The upload have to be done with a foreign key attached to the upload. eg.(image_id, image(blob), fileType, date_entered and your_id(foreign key).

please can any one help me with this, a detailed code will be very much appreciated.