sayedsohail
Members-
Posts
468 -
Joined
-
Last visited
Never
Everything posted by sayedsohail
-
[SOLVED] Displaying information in a update form
sayedsohail replied to dark22horse's topic in PHP Coding Help
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> -
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);
-
checkdate function not working.. Please help
sayedsohail replied to sayedsohail's topic in PHP Coding Help
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!'; } -
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";}
-
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>"; }
-
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
-
Retrieving Data from MySQL using PHP and Ajax
sayedsohail replied to lilman's topic in Javascript Help
just try changing your query syntax from: $sQuery = "Select * from Customers where CustomerId=".$sID; to: $sQuery = "SELECT * from Customers where CustomerId='$sID' "; regards -
How to display data from sql using ajax:
sayedsohail replied to sayedsohail's topic in Javascript Help
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. -
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.
-
[SOLVED] print five rows even if records are less than 5
sayedsohail replied to sayedsohail's topic in PHP Coding Help
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>"; } } -
[SOLVED] print five rows even if records are less than 5
sayedsohail replied to sayedsohail's topic in PHP Coding Help
You have taken off the while (list), i need the while statement with (list), please suggest. something. -
[SOLVED] print five rows even if records are less than 5
sayedsohail replied to sayedsohail's topic in PHP Coding Help
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>'; } } ?> -
how to select make/model from populated sql query list?
sayedsohail replied to sayedsohail's topic in PHP Coding Help
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. -
how to select make/model from populated sql query list?
sayedsohail replied to sayedsohail's topic in PHP Coding Help
can you please suggest or refer to any simple code site. please. thanks -
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
-
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> "; echo "</form>";
-
Million thanks desithugg, for such wonderfull code.
-
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';} }
-
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;} }
-
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. }
-
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>