Jump to content

bishwadeep

Member
  • Posts

    27
  • Joined

  • Last visited

Posts posted by bishwadeep

  1. Hi This might help you.

    ob_start();
    $db = new PDO('mysql:host=localhost;dbname=<SOMEDB>', '<USERNAME>', 'PASSWORD');
    $stmt = $db->prepare("select contenttype, imagedata from images where id=?");
    $stmt->execute(array($_GET['id']));
    $stmt->bindColumn(1, $type, PDO::PARAM_STR, 256);
    $stmt->bindColumn(2, $lob, PDO::PARAM_LOB);
    $stmt->fetch(PDO::FETCH_BOUND);
    ob_clean();
    header("Content-Type: $type");
    echo $lob; // fpassthru reports an error that $lob is not a stream so echo is used in place.
    ob_end_flush();
    

  2. Hi,

    Create a memberdetails.php page and then copy and paste the following code. Then modify according to your requirement.

    <?php
       //connection.php
       /*$id = $_GET['id'];*/
    
       $conn = mysql_connect($host, $user, $pass);
       $selDB = mysql_select_db($db);
       $sql = "select count(*) from info";
       $result = mysql_query($sql);
       $row = mysql_fetch_row($result);
       $numRows = $row[0];
    
            /*if (isset($_GET['id'])){
               $id = (int)$_GET['id'];
           }*/
    
       $sql = "select * from info";
       $result = mysql_query($sql);
       while($row = mysql_fetch_assoc($result)){ ?>
        <table>
        <td><?php echo stripslashes($row['name']). " ";?> <a href="memberdetails.php?id=<?php echo $row['id'];?>">[View Details]</a>
         </td>
         </tr>            
    <?php } ?>  
    

    memberdetails.php page

    <?php 
    //memberdetails.php page
    $id=addslashes($_GET['id']);
    $sql = "select * from info WHERE id='".$_GET['id']."'";
    $result = mysql_query($sql);
    $row=mysql_fetch_assoc($result);
    //now display the details in this page as the details are carried in the $row variable.
    ?>
    

  3. Hi,

    You can use javascript validation in that case.

    Here is a sample for javascript validation.

    <!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>
    <script language="javascript">
    function Formvalidation(form){
    if(form.fname.value==""){
    	alert("Please Enter First Name");
    	form.fname.focus();
    	return false;
    }
    
    if(form.lname.value==""){
    	alert("Please Enter Last Name");
    	form.lname.focus();
    	return false;
    }
    
    //if(form.otherfield.value=="")
    //continue.................
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <form id="form1" name="form1" method="post" action="">
     <table width="100%" border="0" cellspacing="0" cellpadding="3">
       <tr>
         <td width="23%">First Name</td>
         <td width="77%"><label for="name"></label>
         <input type="text" name="fname" id="fname" /></td>
       </tr>
       <tr>
         <td>Last Name</td>
         <td><label for="email"></label>
         <input type="text" name="lname" id="lname" /></td>
       </tr>
       <tr>
         <td><input type="submit" name="button" id="button" value="Submit" onclick="return Formvalidation(this.form);"/></td>
         <td> </td>
       </tr>
     </table>
    </form>
    </body>
    </html>
    

  4. hi

    $value= $_GET['id'];
    $query_Recordset1 ="SELECT * FROM colores WHERE id='value'";
    

     

    I think you missed the $ in 'value'.

    if this is not an example then this one below is right.

    $value= $_GET['id'];
    $query_Recordset1 ="SELECT * FROM colores WHERE id='".$value."'";
    

  5. Hi

    you can also validate an email address using regular expressions.

    if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){
    echo "Valid Email Address";
    }else{
    echo "Invalid Email Address";
    }
    

  6. Hi edoplaza,

     

    Since I dont have all the files you have used, I could not test it properly, But i think you can change the values in the $expected array to meet your requirements.

     

    For example: $expected = array('name', 'telefono', 'email','checkindate', 'checkintime', 'checkoutdate', 'checkouttime','adults', 'under4', 'between4and10','comments');

     

    Change the name to Name and telefono to Telephone Number etc.

     

    Then try once and let me know.


  7. <?php
    if(isset($_POST['submit'])){
    // multiple recipients
    $to = 'edoplaza@yahoo.com';
    $subject = 'Feedback form results';

    $message = 'name: '.$_POST['name']."
    ";
    $message.= 'Check in date: '.$_POST['checkindate']."
    ";
    $message.= 'Check out date: '.$_POST['checkoutdate']."
    ";
    $message.= 'Adults: '.$_POST['adults']."
    ";
    $message.= 'Childs: '.$_POST['child']."
    ";
    $message.= 'Comments: '.$_POST['comments']."
    ";

    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

    $headers .= 'From: Birthday Reminder ' . "\r\n";
    mail($to, $subject, $message, $headers);
    }
    ?>

    Name:

    Check in date:

    Check out date:

    Adults:

    Childs:

    Comments:


  8. Hi edoplaza,

    This is because you have test the page several time using the same session.

    In real time this will not be the case. the user will fill the form once and he will close the browser.

     

    if you want to use the page in the realtime mode then you have to clear the browser cookie and session each time after filling the form.

     

    Currently you might notice that there might be same sessionid for different records in the database. This is because you are filling the form multiple times in the same user session.

  9. HI edoplaza,

     

    I think you have a space before your <? starting tag. This type of warning message generally arises when there is a space before the opening tag.

    -----------------------------------------------

    ELIMINATE SPACE HERE <?

     

    ?>

    -----------------------------------------------

  10. Hi edoplaza,

     

    if you want to display the information in the same page where you insert your data then user mysql_insert_id() after you run your insert query which fetches the lates id of data inserted.

     

    If you wish to show the information in different pages then you can do the following.

     

    <?php 
    session_start();
    //add a new row called sessionid in the table and while inserting the value put session_id() for it.
    //eg: 
    insert into your table (name,address,sessionid) values ("abc","bcd",'".session_id()."');
    //then you can take out that record from the database any time until the user closes his browser.
    //eg: 
    select * from your table where sessionid='".session_id()."';
    ?>
    

     

    Remember that this sessionid is valid for only once, this session id is always different for every user and is valid for only one user session.

  11. Hi joomlavideos,

    Can you try this script. I have assumed that the radio will be offair on saturday and sunday. Regarding the time this script takes the server time so you might need to compare the server time and your local time.

    <?php
    $d=date("l");
    $h=date("h");
    
    //offline for saturday and sunday
    if($d=="Saturday" or $d=="Sunday"){
       $img="images/offAir.gif"; //offline image.
    }else{
       if($h >= 4 and $h < 5){
           $img="images/onAir.gif"; //for online image.
       }else{
           $img="images/offAir.gif";//offline after 5pm and before 4pm
       }
    }
    ?>
    
    
    
    
    




  12. Country:


    Animal:





    <?php
    if (isset($_POST['submit']))
    {
    $country = $_POST['country'];
    $animal = $_POST['animal'];

    $db = 'testdb';
    $connection = mysql_connect('localhost','root','test');
    mysql_select_db($db);

    mysql_query("INSERT INTO symbols (country, animal) VALUES('$country', '$animal')");

    $query = "SELECT * FROM symbols ORDER BY id";
    $result = mysql_query($query);

    if (mysql_num_rows($result) >0)
    {
    echo "
    " .$count. " " .$row[1]. " " .$row[2]. "
    ";
    }
    echo "
    ";
    echo mysql_num_rows($result) . " Total No. of Records";

    mysql_free_result($result);
    mysql_close($connection);
    }
    ?>

  13. You have created the mysql query object in the variable($my_q = mysql_query($sql_query);) but you are still using $sql_query

     

     

    $sql_query = "SELECT promoters.username, promoter_sales.package_sold ".

    "FROM promoters, promoter_sales ".

    "WHERE promoters.username = promoter_sales.username";

     

    $my_q = mysql_query($sql_query);

     

    $my_sales;

     

    Wrong:

    while($row = mysql_fetch_array($sql_query,MYSQL_ASSOC)){

    $my_sales = $my_sales . 'Date Sold: ' . $row['date_sold']. "

    Package Sold: ". $row['package_sold'] . '

    ';

    }

     

     

    Right:

    while($row = mysql_fetch_array($my_q, MYSQL_ASSOC)){

    $my_sales = $my_sales . 'Date Sold: ' . $row['date_sold']. "

    Package Sold: ". $row['package_sold'] . '

    ';

    }

×
×
  • Create New...