hello friends im fetching data from table i want to show only one row data on page but its showing all data from the table.please could any body tell me query for that thank u. here is preview of my problem.
<?php $slct=mysql_query("select * from mv" )or die(mysql_error()); while($ftch=mysql_fetch_array($slct)) { ?> <tr> <td>Code.</td> <td> <input name='message' type="password" value="Your verifation code is <?=$ftch['cod'] ?>" " readonly="readonly"> </td> </tr> <tr> <td width="200">Your Mobile Number</td> <td> <input name='recipient' type='text' maxlength="10" value="<?=$ftch['phn'] ?>" " readonly="readonly"> </td> </tr> <?php } ?> PHP: i don't know how to make validation for this to show that only particular cod and number from db.
<?php $slct=mysql_query("select * from mv" )or die(mysql_error()); $ftch=mysql_fetch_array($slct); { ?> <tr> <td>Code.</td> <td> <input name='message' type="password" value="Your verifation code is <?=$ftch['cod'] ?>" " readonly="readonly"> </td> </tr> <tr> <td width="200">Your Mobile Number</td> <td> <input name='recipient' type='text' maxlength="10" value="<?=$ftch['phn'] ?>" " readonly="readonly"> </td> </tr> PHP: No need to loop, also consider using full php tags - it will be better in the long run.
if you want to show only single data then do not use while loop only pass the primary key to mysql query
<?php $slct=mysql_query("select * from mv where cod='$cod' AND phn='$phn'" )or die(mysql_error()); $ftch=mysql_fetch_array($slct); ?> PHP: im using AND to fetch both values but its not working.only first value is showing.
if code and phone no in same table id code phone no 1 123 12345678 then use only id where id= 1 or 2 or 3 like that
no dear its not working.here is the whole coding how im fetching the data. <? session_start() or die (); ?> <?php include ("db_connect.php"); ?> <?php $slct=mysql_query("select * from mv where cod='$cod' AND phn='$phn'" )or die(mysql_error()); $ftch=mysql_fetch_array($slct); ?> <html> <script src="SpryValidationTextField.js" type="text/javascript"></script> <link href="SpryValidationTextField.css" rel="stylesheet" type="text/css"> <script src="SpryValidationTextarea.js" type="text/javascript"></script> <link href="SpryValidationTextarea.css" rel="stylesheet" type="text/css"> <title>Send Free Sms</title> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="images/style.css" /> <body> <div id="container"> <div id="header"> Send Free Sms </div> <h1></h1> <form method=post action='sendsmscodeforveri.php'> <table width="100%" border=0 cellpadding="5" cellspacing="5"> <tr> <td>Code.</td> <td> <input name='message' type="password" value="Your verifation code is <?=$ftch['cod'] ?>" readonly="readonly" " > </td> </tr> <tr> <td width="200">Your Mobile Number</td> <td> <input name='recipient' type='text' maxlength="10" value="<?=$ftch['phn'] ?>" readonly="readonly"" > </td> </tr> <tr> <td> </td> <td><input type=submit name=submit value=Send></td> </tr> </table> </form> <script type="text/javascript"> <!-- var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "real", {validateOn:["blur", "change"], hint:"XXXXXXXXXX"}); var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1", {maxChars:140, validateOn:["blur", "change"], counterType:"chars_remaining", counterId:"countsprytextarea1", hint:"enter your message here"}); //--> </script> </p> </body> </html> PHP:
here is the code from that value coming. <?php include("db_connect.php"); if(isset($_POST[submit])) { $a=$_POST[cod]; $b=$_POST[phn]; $insrt=mysql_query("insert into mv values(null, '$b')") or die(mysql_error()); ?> <?php } ?> PHP:
if you really need help i can work on your server, but you have to trust me. my gmail id is skywebsol@gmail.com