473,387 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

No errors just help needed ( mysql help )

<?php
echo "a href=\"index.php?alp=a\">A</a> ] "
."- [ <a href=\"index.php?alp=b\">B</a> ] "
."- [ <a href=\"index.php?alp=c\">C</a> ] ";
if (isset($_GET['alp']))
{
// Now what must i make the sql statment so that it will display all
the names that starts with a $_GET['alp'] ( a ) //
// and if i use like then it will display all names that has a 'a'
some where in the word. //

$sql = "SELECT * FROM store_items WHERE name = '$sid'";
$result = $db->sql_query($sql);

while($row = $db->sql_fetchrow($result))
{
$name = $row[name];
}
}
?>
Jul 19 '05 #1
2 1266
Kyle wrote:
// Now what must i make the sql statment so that it will display all
the names that starts with a $_GET['alp'] ( a ) //
// and if i use like then it will display all names that has a 'a'
some where in the word. //


# gives you all rows where name starts with "a"
select * from table where name like 'a%';

# gives you all rows where name contains "a" anywhere inside it
select * from table where name like '%a%';

# gives you all rows that end with "a"
select * from table where name like '%a';

# gives you all rows where name is exactly "a"
select * from table where name = 'a';
Jul 19 '05 #2
Kyle wrote:
// Now what must i make the sql statment so that it will display all
the names that starts with a $_GET['alp'] ( a ) //
// and if i use like then it will display all names that has a 'a'
some where in the word. //


# gives you all rows where name starts with "a"
select * from table where name like 'a%';

# gives you all rows where name contains "a" anywhere inside it
select * from table where name like '%a%';

# gives you all rows that end with "a"
select * from table where name like '%a';

# gives you all rows where name is exactly "a"
select * from table where name = 'a';
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
2
by: PinkBishop | last post by:
Hello All, Hope you can help. Below is the code I use to send data from form to database. Problem is if an apostrophe is entered in cQuestion field or any field for that matter the form...
5
by: news | last post by:
I just installed Slackware 10.1 Still need to install some missing needed libraries, but I think that's unrelated. Every time it boots up, or I try "/etc/rc.d/rc.mysqld start" I get this: ...
13
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
8
by: ImOk | last post by:
I just have a question about trapping and retrying errors especially file locking or database locks or duplicate key errors. Is there a way after you trap an error to retry the same line that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.