Re: [PHP-DB] viewing search result
Hi, Iam new in this , can you tell me how to make the pager.php works? I can't use it... Best Regards, Hadi Tjen Bossek [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] you can use PEAR DB::Pager http://pear.php.net/package/DB_Pager Fedde Van Feggelen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] str_replace(' ','%',$searchwords); $query=select * from table where colom like '%$searchwords%' order by id desc ; $result=mysql_query($query); $numresult=mysql_num_rows($result); Use limit in your select statement. laters, Fedde ~=There's a fine line between genius and insanity. I have erased this line=~ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] viewing search result
Hi Everybody, Please help me in this, I have a search page, when people search they keywords and the result is 50 rows from mysql , how to display them page by page which each page contain 20 results , thanks in advance : str_replace(' ','%',$searchwords); $query=select * from table where colom like '%$searchwords%' order by id desc ; $result=mysql_query($query); $numresult=mysql_num_rows($result); if (mysql_num_rows($hasil) 0 ) { echo (bFound :/b $searchwords brbr); //page display I have tried my own recipe but didn't work while ($data=mysql_fetch_array($result)) { echo ( tr td width=\330px\font size =\3\br$data[colom1]brbr/td td width=\50px\p align =\center\font size =\2\$data[colom2]br/td td width=\50px\p align =\center\font size =\2\$data[colom3]br/td /tr ); Best Regards, Hadi Tjen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Problem with INSERT Query
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all: Well, when i bring out the page with the drop down list it was able to display all tutors' names from tutor_name column. Anyway here's a review of my code (snip) again before i continue: -- - snip $sql = INSERT INTO class (class_code, tutor_name, edu_level, timetable_day, timetable_time) VALUES ('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time' ); ?//retrieve data from DB display in dynamic drop down ? SELECT class=textarea name=tutor_name / ? $sqltutor = mysql_query(SELECT DISTINCT tutor_name FROM tutor ); while ($row = mysql_fetch_array($sqltutor)) { print OPTION VALUE=\$row [tutor_name]. \ SELECTED .$row [tutor_name]. /option ; } $result = $db- query($sql); ? /select ? while($selected_tutor_name == $tutor_name) echo $_POST[tutor_name]; How about if ($tutor_name ){ echo $_POST[tutor_name]; $sql = INSERT INTO class (class_code, tutor_name, edu_level, timetable_day, timetable_time) VALUES ('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time' );} is it working? Hadi ? /snip -- - so when i submit the form, i am suppose to echo the values i have entered into the field and then INSERT the values into DB (Queries stated above). However i was able to echo all other values eg. class_code, edu_level, etc...but not tutor_namesame thing happen when i do an INSERT, all other values are inserted into DB but not $tutor_namewhy is this so???Really need some help here...Anyway i have already specify a name to be reference : SELECT class=textarea name=tutor_name and then I also did an echo of tutor_name being selected: while($selected_tutor_name == $tutor_name) echo $_POST[tutor_name]; All help are greatly appreciated =) Irin. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] password---simple questions but...
Hi, all please help me in this, Iam using MYSQL , my colomn is password varchar(12) insert into tablepassword values ('',password('def')); it is executed, (select * from tablepassword) showing the password is hashed, and then to view the record using 'where' : select * from tablepassword where password=password('def'); display empty set, how to solve this? Thanks in advance. Merry Christmas and Happy New Year Hadi Tjen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] anyone trickier than 'LIKE' ?
Hi all, I have this data (eg.) ..big fat buddy... on the database . If a person enter big buddy in the search form , the ...big fat buddy. data will not be found . Any suggestion ? Thanks in advance. select * from table where data like %keywords%; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] help newbie
Hi , please help this newbie , how to make my database view from [1] [2] [3] [4] [5] [6] [7] [8] to 1 2 34 Thanks very much Hadi require(cobaconfig.php); $numresult = mysql_query(select * from dataiklanbaris order by id desc); $jumlah = mysql_num_rows($numresult); $limit = 20; if (empty($offset)) { $offset = 0; } $query = select * from dataiklanbaris order by id desc limit $offset, $limit; //pembagian halaman dimulai $result = mysql_query($query); $halaman = intval($jumlah/$limit); if ($jumlah%$limit) { $halaman++; } for ($i = 1; $i=$halaman; $i++) { $newoffset=$limit*($i-1); if ($offset != $newoffset) { echo [a href=\lihatiklan.php?offset=$newoffset\$i/a]; } else { echo [$i]; } } //pembagian halaman selesai while ($row = mysql_fetch_array($result)) { echo ( tr td width=\330px\font size =\3\$row[isiiklan]br/td td width=\50px\p align =\center\font size =\2\$row[lt]br/td td width=\50px\p align =\center\font size =\2\$row[lb]br/td td width=\70px\p align =\center\font size =\2\$row[harga]br/td td width=\100px\p align =\center\font size =\2\$row[kecamatan]br/td td width=\100px\p align =\center\font size =\2\$row[kota]br/td td width=\100px\a href=\detail.php?id=$row[id]\ target=\blank\p align =\center\font size =\2\$row[gambar]br/a/td /tr ); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Hi all, how the sript to view like...
I have my database page look like this: [1][2] [3] [4] [5] [6] the problem is when I have my database growing it will be not nice to look at because the number will keep growing, how to make it like this : 1234 Thanks for the help require(cobaconfig.php); $numresult = mysql_query(select * from dataiklanbaris order by id desc); $total = mysql_num_rows($numresult); $limit = 20; if (empty($offset)) { $offset = 0; } $query = select * from table order by id desc limit $offset, $limit; $result = mysql_query($query); $halaman = intval($total/$limit); if ($jumlah%$limit) { $page++; } for ($i = 1; $i=$page; $i++) { $newoffset=$limit*($i-1); if ($offset != $newoffset) { echo [a href=\view.php?offset=$newoffset\$i/a]; } else { echo [$i]; } } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php