•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 403,029 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,851 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 616 | Replies: 14 | Solved
![]() |
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 239
Ah!!! You can do it this way.
This will solve your problem, I am sure.
php Syntax (Toggle Plain Text)
$query = "SELECT SUBSTRING_INDEX(tip,' ',8) as tip FROM tips";
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
•
•
Ah!!! You can do it this way.
This will solve your problem, I am sure.php Syntax (Toggle Plain Text)
$query = "SELECT SUBSTRING_INDEX(tip,' ',8) as tip FROM tips";
Thank you very much, it seems to work now! So the problem was that it was not assigning the SUBSTRING_INDEX result to a variable?
Anthony
"Beneath this mask there is more than flesh. Beneath this mask there is an idea, Mr. Creedy, and ideas are bulletproof." - V
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 239
No.. You are creating an alias for SUBSTRING_INDEX(tip, ' ',8) . Php parser will look for a column name and since you aren't specifying any, it will be empty.
This will return the result under "user defined" column name tip, so that php parser can access it.
•
•
•
•
SUBSTRING_INDEX(tip, ' ',8) as tip
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the PHP Forum
- Previous Thread: PHP Time
- Next Thread: Path Style PHP Arguments



!
Linear Mode