473,387 Members | 1,624 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 1264
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.