Jump to content

sayedsohail

Members
  • Posts

    468
  • Joined

  • Last visited

    Never

Everything posted by sayedsohail

  1. Here is the example, just place your sql returned values. hope this helps. regards, <form> <table width='100%' border='1'> <tr> <td>Manufacturer </td> <td><input type='text' name='f_manufact' value='<?php print "$row[make]";?>'> </td> <td>Model </td> <td><input type='text' name='f_model' value='<?php print "$row[model]";?>'> </td> </tr></table></form>
  2. Hi Everyone, I am trying to update record and date field, but it fails although my timestamp echos perfectly. I don't know what to do: my sql client version is 5.0.33 and the model table has got date filed which is model_date. Its been since morning, no success, please help guys. here is my code. million thanks $timestamp = date('Y-m-d', strtotime($displaydate)); echo "The string to date is :$timestamp"; $addsql = "UPDATE models SET make = '$fm', model= '$fmod', description = '$fd' model_date = '$timestamp' WHERE id = '$fid' "; mysql_query($addsql);
  3. I tried the simpliest function, below is the code it keeps on says mysql error check manual. my date field which is f_date have date displayed as 01/01/1970 and on form submit i am trying this function, i have been trying this since morning, stuck. secondly when i tried to display date in human readable format from my sql statement, it just print 01/01/1970, although the date is very recent: here is the code i used to display date in human readable format $fmdate = date('d/m/Y', "$row[model_date]");. Here is my new code for validating date field. list($y, $m, $d) = explode('/', $_POST['f_date']); if(checkdate($m, $d, $y)) { echo 'Good!'; } else { echo 'Bad!'; }
  4. Hello everyone, my checkdate function is not working, here is my code, please help. The $_POST['f_date'] is 01/01/70 function checkData($date) { if (!isset($date) || $date=="") { return false; } list($dd,$mm,$yy)=explode("/",$date); if ($dd!="" && $mm!="" && $yy!="") { return checkdate($mm,$dd,$yy); } return false; } if(!$t=checkData($_POST['f_date'])){ echo "Date is wrong";} else { echo "date is right";}
  5. Hi all, I need some help, in regards to storing $id value into session variable and using in new window, at the moment i am using get statement to capture record id in edit window. any help will be greatly appreciated. I am not sure how to do this, since i got a long list of records in my database. while(list($id, $name) = mysql_fetch_array($result)) { print "<tr> <td>$name</td> <TD><img OnClick="window.open('edit_client.php?rec_No='+ $id)"></td> </tr>"; }
  6. Hope this will help you http://rajshekhar.net/blog/archives/85-Rasmus-30-second-AJAX-Tutorial.html Can I ask you a favor, i am trying to create a pagination using php ajax, and i am stuck, any suggestions or idea would be greatly appreciated (My thread is listed with a subject - How do display data from sql php/ajax). Thanks
  7. just try changing your query syntax from: $sQuery = "Select * from Customers where CustomerId=".$sID; to: $sQuery = "SELECT * from Customers where CustomerId='$sID' "; regards
  8. thanks a million, my display query works fine, now i have a problem of pagination, I don't know how to pass values back and forth from the results, using php ajax. I am able to do it using php which works fine <a href='customers.php?letter=A'>. Any suggestions, please. Thanks for the wonderfull code.
  9. Hi, I just need to know how to use my php drop down list value and call ajax to display data in a grid. Yes indeed, i am able to do it with php but the page refreshing problem. anyone can direct me for this type of example code or suggest something. Please help.
  10. Thank you barand me bad, it worked perfectly with little changes for($p=0;$p<3;++$p) { if(list($id, $name, $address_1, $p_code, $city, $l_line, $mobile) = mysql_fetch_array($sql)) { echo "<tr><td><input type ='radio' value= '$id'></td>"; echo "<td>$name</td>"; echo "<td>$address_1</td>"; echo "<td>$p_code</td>"; echo "<td>$city</td>"; echo "<td>$l_line</td>"; echo "<td>$mobile</td></tr>"; } else { echo "<tr><td colspan='7' align='center'> </td></tr>"; } }
  11. You have taken off the while (list), i need the while statement with (list), please suggest. something.
  12. i am able to repeat the list from sql statement, I wish to print blank tr td even if the records are less than 5 from my sql statement. someone has suggested code below, but its giving an error <?php for($i=0;$i<5;++$i) { if while(list($id, $name) = mysql_fetch_array($sql)) { echo "<tr><td><input type ='radio' value= '$id'></td>"; echo "<td>$name</td></tr>"; } else { echo '<tr><td></td><td></td></tr>'; } } ?>
  13. Hi, I wish to print five rows even if the fetched records are less than 5. here is my code: ?><table><tr> <? while(list($id, $name) = mysql_fetch_array($sql)) { print "<td><input type ='radio' value= '$id'></td>"; print"<td>$name</td></tr>"; } echo "</table>";
  14. thanks jitesh, when i open the popup window, its loosing focus, how do i set focus the popup window and restrict the user from performing other actions on the parent window. please advise.
  15. can you please suggest or refer to any simple code site. please. thanks
  16. Hi, Sorry for my silly question, I have got a form which contains 20 fields, one of the fields is a drop down list box, which contains a sql query results, this results are huge, thus i am worrying for the speed. I thought about an option ie., populating the results in a separate window and onclick method just bringing the select info to my form field. I am able to populate the results in a separate window, but just having problem in select the result from it. Any suggestions, please advise. Thanks
  17. Hi Everyone, My pagination works fine, i would like to add <A-B-C-D-E-F-G-H..-Z> links at the bottom of the page, can you suggest any improvement to the following script below: // how many rows to show per page $rowsPerPage = 10; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $query = "SELECT id, make, model FROM models_view ORDER BY make LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); /* (number of records) */ $test_rows = mysql_num_rows($result); if ($test_rows == 0) { echo "<h4>Sorry there are ($test_rows) models in the database. Please insert models.\n</h4>"; exit; } else { // Perform the rest of the query i.e., display records 24th March 2007 //print the form ?> <form name='myform' method='post'><table name='two' border='1'><tr align='center'> <th class='empty1'></th><th class='empty1'>Make</th><th class='empty1'>Model</th> </tr> <?php $i = 1; while(list($id, $make, $model) = mysql_fetch_array($result)) { print"<td align='center'>$make</td>"; print"<td align='center'>$model</td>"; $i= $i + 1; } echo '</table>'; echo '<br>'; // how many rows we have in database $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); $self = $_SERVER['PHP_SELF']; // creating 'previous' and 'next' link // plus 'first page' and 'last page' link // print 'previous' link only if we're not // on page one if ($pageNum > 1) { $page = $pageNum - 1; $p1 =1; ?> <input type="button" name="Previous" value="Prev" onclick="javascript:void(location.href = '<?php print $self.'?page='.$page; ?>')"/> <input type="button" name="First" value="First" onclick="javascript:void(location.href = '<?php print $self.'?page='.$p1; ?>')"/> <?php } else { ?> <button.Previous = disabled> <button.First = disabled> <?php } if ($pageNum < $maxPage) { $page = $pageNum + 1; ?> <input type="button" name="Next" value="Next" onclick="javascript:void(location.href = '<?php print $self.'?page='.$page; ?>')"/> <input type="button" name="Last" value="Last" onclick="javascript:void(location.href = '<?php print $self.'?page='.$maxPage; ?>')"/> <?php } else { ?> <button.Next = disabled> <button.Last = disabled> <?php } // print the page navigation link echo $first . $prev . " Showing page <strong>$pageNum</strong> of <strong>$maxPage</strong> pages " . $next . $last; echo "<br>&nbsp"; echo "</form>";
  18. Hi everyone, when i tried the above code, its displays 01/01/1970. without the date function it display the date correctly but in unix stamp format. any suggestion. Please help.
  19. Million thanks desithugg, for such wonderfull code.
  20. Hi, I am displaying a table and onclick event of the table row i am highlighting the row, it works fine. but when i refresh the page the clicked row is loosing the background color(highlighted color). Any, idea to keep the highligted row colors when page is refreshed. here is my script: function highlightrow(this){ currentCells = obj.getElementsByTagName('td'); for(var n=0;n<currentCells.length;n++) {currentCells[n].style.backgroundColor = 'silver';} }
  21. This might be any help to you. function resetradio() { currentRadio= document.getElementsByTagName('input'); for (var c=0; c<currentRadio.length;c++) {currentRadio[c].checked=false;} }
  22. Me bad, it works fine now, but when i remove the alert and tries to redirects to new page with all the values its giving error, here is my modified code. echo "<tr onclick=\"passvar(${pageNum}, ${id}, '${name}', this );\">"; function passvar(pan,rec,nam,obj) { var bage = pan; var cid = rec; var cname = nam; //alert("This is your company name"+cname); document.location.href="sitedetail.php?page="+bage+"&cid="+cid"&cname="+cname; // the problem lies here now. }
  23. Million thanks, now the alert works, but when i tried to remove alert and redirect the values to a new page it doesn't. here is my modified code. <?php echo "<tr onclick=\"passvar(${pageNum}, ${id}, ${name}, this );\">"; echo "<td>$id</td<td>$name</td></tr>"; ?> <SCRIPT> here is my javascript function. function passvar(pan,rec,nam,obj) { var bage = pan; var cid = rec; var cname = nam; //alert("This is your company name"+cname); document.location.href="sitedetail.php?page="+bage+"&cid="+cid"&cname="+cname; // the problem is here, since i can't retrieve cname value using $name1 = $_GET['cname']; } </SCRIPT>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.