
ilikephp
Members-
Posts
350 -
Joined
-
Last visited
Never
Everything posted by ilikephp
-
Hi, I have a problem that I can not fix it :S I have a php search form, it fetches the selected word from mysql and it display it, if I search for: "world" all fields that contains word will appear: 1 The world was... 2 The world is ... (which is working fine) What I want is to add a dynamic link for the founded records so I can click on them and update them. like: 1 The world was... (edit) 2 The world is ... (edit) Any help plz!! Thanks...
-
Hello, I have 2 forms: one that displays all my sql records and the other one search for a specific record. I want for example: if I search for "x' all the "x" be displayed and a link (in the other form) is displayed next to it in order to modify it. (I am using binding in dreamweaver) Can someone help me plz? displays all the records: <?php require_once('../../Connections/Con.php'); ?> <?php mysql_query("SET NAMES 'UTF8'"); $maxRows_Recordset1 = 10; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; mysql_select_db($database_Con, $Con); $query_Recordset1 = "SELECT * FROM bap"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $bapCon) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; ?><!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> </title> </head> <body> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><?php do { ?> <table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="249" height="104"><?php echo $row_Recordset1['child_name_12']; ?></td> <td width="246"><a href="editrecord.php?b_form_number_33=<?php echo $row_Recordset1['b_form_number_33']; ?>">edit</a></td> <td width="305"><a href="Certificate.php?b_form_number_33=<?php echo $row_Recordset1['b_form_number_33']; ?>">cert</a></td> </tr> </table> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?></td> </tr> </table> </body> </html> <?php mysql_free_result($Recordset1); ?> Displays the record searched for only: <?php require_once('../../Connections/Con.php'); ?> <?php mysql_select_db($database_bapCon, $bapCon); $query_Recordset1 = "SELECT * FROM bap"; $Recordset1 = mysql_query($query_Recordset1, $bapCon) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- body { background-image: url(../images/Background44.gif); background-repeat: no-repeat; background-color: #FFFF66; } --> </style></head> <body> <h2>Search</h2> <form name="search" method="post" action=""> Seach for: <input type="text" name="find" /> in <Select NAME="field"> <Option VALUE="child_name_12">Last Name</option> <Option VALUE="lname">Last Name</option> <Option VALUE="info">Profile</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> </body> </html> <?php mysql_free_result($Recordset1); //This is only displayed if they have submitted the form if ($_POST['searching'] =="yes") { echo "<h2>Results</h2><p>"; //If they did not enter a search term we give them an error if ($_POST['find'] == "") { echo "<p>You forgot to enter a search term"; exit; } // Otherwise we connect to our Database mysql_connect("localhost", "****", "****") or die(mysql_error()); mysql_select_db("par ") or die(mysql_error()); // Convert names to UTF8 mysql_query("SET NAMES 'UTF8'"); // We preform a bit of filtering $find = strtoupper(strip_tags(trim($_POST['find']))); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM bap WHERE upper({$_POST['field']}) LIKE'%$find%'"); //And we display the results while($result = mysql_fetch_array( $data )) { echo $result['child_name_12']; echo " "; echo $result['father_family_17']; echo " "; echo "<br>"; echo "<br>"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } ?>
-
GREAT IT WORKS Still have one prob, when I press F12 to check my page I get this error: Notice: Undefined index: searching in C:\www\Prog\search.php on line 14 //This is only displayed if they have submitted the form if ($_POST['searching'] =="yes") {
-
thanks for your help... When I click on search I am getting: Notice: Undefined variable: trim in C:\www\Prog\search.php on line 28 Fatal error: Function name must be a string in C:\www\Prog\search.php on line 28 Which is: // We preform a bit of filtering $find = strtoupper(strip_tags($trim($_POST['find'])));
-
This is my code, now when I click on the search button, the forbidden will not be displayed but now My page is reopened again, and the search code is not generated. <h2>Search</h2> <form name="search" method="post" action=""> Seach for: <input type="text" name="find" /> in <Select NAME="field"> <Option VALUE="fname">First Name</option> <Option VALUE="lname">Last Name</option> <Option VALUE="info">Profile</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> <? //This is only displayed if they have submitted the form if ($searching =="yes") { echo "<h2>Results</h2><p>"; //If they did not enter a search term we give them an error if ($find == "") { echo "<p>You forgot to enter a search term"; exit; } // Otherwise we connect to our Database mysql_connect("localhost", "root", "123456") or die(mysql_error()); mysql_select_db("par") or die(mysql_error()); // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE'%$find%'"); //And we display the results while($result = mysql_fetch_array( $data )) { echo $result['fname']; echo " "; echo $result['lname']; echo "<br>"; echo $result['info']; echo "<br>"; echo "<br>"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } ?>
-
I think that: "<?=$PHP_SELF?>"> is the problem can it be fixed? <form name="search" method="post" action="<?=$PHP_SELF?>">
-
Hi, I have a php search script, when I click on the search, I am getting: 403 Forbidden You don't have permission to access /soft/< on this server How can I fix it plz? Thx in advance...
-
Could you please send me the whole code, because I got lost :S Thank you,
-
I found the error, while trying to search, I got no result! :S I checked that there is a result, what could be the prob plz?
-
Thx for your help! I fixed it, but I received other parse errors, could you please check the whole code, or is there another simple search form? Thx a lot...
-
Hi, I am trying to create a php form to search for some records in mySQL, I found this code, I chaged the required info, but I am getting this error code: Parse error: parse error in C:\www\Ste Therese Prog\searchengine\search.php on line 22 Could you help me plz? The code: <html> <head> <title>designplace.org search script</title> <meta name="author" content="Steve R, http://www.designplace.org/"> </head> <!-- © http://www.designplace.org/ --> <body> <form name="form" action="search.php" method="get"> <input type="text" name="q" /> <input type="submit" name="Submit" value="Search" /> </form> <?php // Get the search variable from URL $var = @$_GET['q'] ; $trimmed = trim($var) //trim whitespace from the stored variable // rows to return $limit=10; // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } // check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } //connect to your database ** EDIT REQUIRED HERE ** mysql_connect("localhost","username","password"); //(host, username, password) //specify database ** EDIT REQUIRED HERE ** mysql_select_db("database") or die("Unable to select database"); //select which database we're using // Build SQL Query $query = "select * from the_table where 1st_field like \"%$trimmed%\" order by 1st_field"; // EDIT HERE and specify your table and field names for the SQL query $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // If we have no results, offer a google search as an alternative if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; // google echo "<p><a href=\"http://www.google.com/search?q=" . $trimmed . "\" target=\"_blank\" title=\"Look up " . $trimmed . " on Google\">Click here</a> to try the search on google</p>"; } // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } // get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); // display what the person searched for echo "<p>You searched for: "" . $var . ""</p>"; // begin to show results set echo "Results"; $count = 1 + $s ; // now you can display the results returned while ($row= mysql_fetch_array($result)) { $title = $row["1st_field"]; echo "$count.) $title" ; $count++ ; } $currPage = (($s/$limit) + 1); //break before paging echo "<br />"; // next we need to do the links to other results if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a>  "; } // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>"; } $a = $s + ($limit) ; if ($a > $numrows) { $a = $numrows ; } $b = $s + 1 ; echo "<p>Showing results $b to $a of $numrows</p>"; ?> <!-- © http://www.designplace.org/ --> </body> </html>
-
so if I want to sell the program and they want the S/W to be locally and not published over the internet, all I have to do is to use operating system features to restrict access to these files? Thank you,
-
Hello, I made a software using php and Mysql and I now that if I want to publish it online in order to fill it with records nobody can access or view my php files (it is secured) The problem is that if I want to keep the software locally the php files will be visible and the sql password will be also visible. What should I do plz? How can I secure my files that on on the local server. Thank you
-
is there a tutorial plz about this? Thx...
-
For example I see in some websites" www.website.com/?php id=5 this id=5 I need to make it.
-
HI, How can I send information to my website using: send by ID method using SQL I think? Thx...
-
I tried to put the codes but I am still viewing the old view that is on the cache :S I put the codes in index.php and in the main.php pages Is there more help plz?
-
thx for your help, I will try it, is there a way to add it in css style?
-
Hi, is there a script to force my website to re-cache each time it is opened? Thx...
-
Not especially msn. Such websites put the info in database and the pages are linked to the database? Is there a tutorial? Thanks,
-
Hello, I think that I have a very easy question. I know how to create a form using php SQL and display the info. BUT the only problem that I have is: In my website, I am linking all the pages with the simple Hyperlink script. I noticed in some websites that the information are displayed from a database. for example: http://www.msn.com/ Is it easy to do it? Is there any tutorial that lets me start do link all my pages using PHP SQL? Thanks,
-
IT WORKS!! THX A LOT Final question: instead of the print button how can I put plz the "print" without a botton? THANKS...
-
I got lost :S If I want only the selected table to be printed directly without being opened in a new window. Is it easy?
-
thanks for your help guys! 1. Is there a way to print a certain table not the whole page? 2. How can the text that will be printed be displayed in a new page before the print out (just to be checked)? Thanks ...
-
if there is a text displayed in my website and somone needs to print this text, he can just click on the PRINT link link to print it out.