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

Mysql Inner Join in Php

Hi Everyone, I have been trying to understand mysql a little further - with some small steps in the right direction.

but I have come across a problem I am unable to fix / get working.

I have a form, that has a variable $country -

I am trying to get the sms text message price for the varible $country

Below is my attempt - to get the sms price

(table field name (price) from tbl (sms_prices))
(table field name (name) from tbl (sms_countries))

$query = "select c.country_id, c.name, p.price
 		from sms_countries c, sms_prices p
 	where
  		c.name = '$country' and
  		c.country_id = p.country_id";	 
			
			$result = mysql_query($query) or die(mysql_error());
			while($row = mysql_fetch_array($result)){
			$smsprice = $row['price'];		
	}

Hope someone can point me in the righr direction and explain where I am going wrong.

Thanks in advance

2
Contributors
2
Replies
39 Minutes
Discussion Span
1 Year Ago
Last Updated
3
Views
Question
Answered
DaveyMoyes
Junior Poster
122 posts since May 2009
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 0

Your query looks just fine to me. What is the problem you have with it? Have you tried it in phpMyAdmin?

pritaeas
Posting Prodigy
Moderator
9,316 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,467
Skill Endorsements: 86

Hi, I have found the issue, country name was incorrect in table - Typo that has cost me 4 hours of head scratching - :) Grrrrrrrrrrrrrrrr

DaveyMoyes
Junior Poster
122 posts since May 2009
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 1 Year Ago by pritaeas

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

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0618 seconds using 2.68MB