Jump to content
Stef's Coding Community


  • Content Count

  • Joined

  • Last visited

Everything posted by bishwadeep

  1. For code debugging i use a dBug class which you can download at http://dbug.ospinto.com/. I think this is the best help while you code php. Example: include("dBug.php"); $a=array('a','b','c'); new Dbug($a);
  2. 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();
  3. 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. ?>
  4. 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>
  5. 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."'";
  6. bishwadeep


    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"; }
  7. 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.
  8. Hi Eduardo, I am glad to hear that your problem is solved. Yes I have seen Mt everest from far away and i am planning to go to the Mt everest base camp. Please remember me if any problem arises. regards, Bishwadeep
  9. Email: Check in date: Check out date: Adults: Childs: Comments:
  10. <?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:
  11. bishwadeep

    Edit and delete

    Hi nagarajanp, Here is what you want. http://www.weberdev.com/get_example-4392.html
  12. 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.
  13. 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 <? ?> -----------------------------------------------
  14. Put your information here: Name: Lastname:
  15. 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.
  16. yes im is right. The short tag value might be off in your php ini settings. That is why the tag is displaying in the browser. <?php echo $img;?> will help in that case.
  17. 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 } } ?>
  18. Hi fazlionline If you are using mysql as a database then you can export your database using phpMyadmin. after you export the database you will get the sql queries of your database, save it somewhere and then import the sql script to the new database.
  19. 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); } ?>
  20. Hi khan.sikki, Using https in wamp is bit difficult. If you need https then you better install xampp.
  21. 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'] . ' '; }
  22. Hi gilbertsavier, Is this what you need? > </pre> <table width="100%"><?=$rs['name']?><?=$rs['address']?><?=$rs['phone']?></table>
  23. Hi groogruxking40 you were missing a single quote before the title in window.open function(your code: Upload' instead of 'Upload'). Here is the corrected code. > >
  • Create New...