NameSilo

Php/Mysql help

Spaceship Spaceship
Watch

Ray

VIP Member
Impact
167
-----SOLVED---------

I am in the middle of creating a search by letter script, except, i have ran into some trouble..

i want the user to be able to click a letter and it show all the results with that letter. no problem.. already done using..

PHP:
$alp=$_GET[a];
while($row = mysql_fetch_array( $result )) {

$word= $row['title'];
$id=$row['id'];


$ab = substr($word, 0, 1); 

$str = strtolower($ab);

if($alp != $str){

}
else{

echo ("<br>" . $id  ."-<a href=\"$id/\">" . $data[0] . "</a>");

}

But, now, i want to make a paging script to page the data, but i cannot due that because i cannot count the mysql data in this way. I do not know how to and i am soo confused. every time i make a paging function i used a mysql count


this is what i believe it would have to look like but, we no its not going to work.. lol
PHP:
select title where title="substr($word, 0, 1)"
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
1
•••
thanks.. ill try that...
 
0
•••
0
•••
i trying it on function one... it worked... im trying it on function 2 now

final code... works... thanks


PHP:
<?php

$alp=$_GET[a];
require("pagerclass.php");
$limit="20";

mysql_connect("localhost", "------------") or die(mysql_error());
mysql_select_db("---------") or die(mysql_error());

$p = new Pager;
$start = $p->findStart($limit);
 

$count = mysql_num_rows(mysql_query("SELECT * FROM drink WHERE LEFT(title,1) = '$alp'"));

$pages = $p->findPages($count, $limit);

$pagelist = $p->pageList($_GET['page'], $pages, $urlqry);
echo $pagelist;


$result = mysql_query("SELECT title,id FROM drink where LEFT(title,1) = '$alp' ORDER BY title ASC LIMIT $start, $limit")
or die(mysql_error());  

while($row = mysql_fetch_array( $result )) {

$word= $row['title'];
$id=$row['id'];

$data = explode(' recipe',$word); 

echo ("<br>" . $id  ."-<a href=\"$id/\">" . $data[0] . "</a>");

} 
?>
 
Last edited:
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back