Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Php/Mysql help

SpaceshipSpaceship
SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by 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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
1
Close
thanks.. ill try that...
 
0
Close
0
Close
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
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back