We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,524 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

get part of row name in php query

how to get part of col name in query. for ex:

les say i have these rows in table:
id    name      last     address
1     dave      da       new york
2     rand      ra       ohio
3     random     a       new

now i want to get rows where address has a word new in it.

$s=mysql_query("SELECT * FROM 'table' WHERE address ='new'");

so output should be 1st and last row.

2
Contributors
1
Reply
1 Hour
Discussion Span
4 Months Ago
Last Updated
2
Views
Question
Answered
hwoarang69
Posting Pro
569 posts since Feb 2012
Reputation Points: 6
Solved Threads: 0
Skill Endorsements: 7
$s=mysql_query("SELECT * FROM 'table' WHERE address LIKE '%new%'");

$numrows - mysql_num_rows($s);
for ($i=0;$i<$numrows;$i++) {
    $temp=mysql_fetch_array($s);
    extract ($temp);
}
tiggsy
Junior Poster
131 posts since Jul 2009
Reputation Points: 16
Solved Threads: 10
Skill Endorsements: 2
Question Answered as of 4 Months Ago by tiggsy

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0536 seconds using 2.64MB