Baseball Posted December 27, 2009 Share Posted December 27, 2009 if (empty($_GET['f'])) { $buthead2 = "cid,"; $buthead = "{$row['cid']}"; } else{ $buthead = "".$_GET['f'].""; $buthead2 = ""; } echo $buthead; Im trying to echo out $row['cid'] so i can put this in a query.. .but this is not working Link to comment https://forums.phpfreaks.com/topic/186426-echo-a-variable-from-a-inside-variable/ Share on other sites More sharing options...
cags Posted December 27, 2009 Share Posted December 27, 2009 I have absolutely no idea what you're trying to do. Both... $buthead = "{$row['cid']}"; $buthead = "".$_GET['f'].""; ...seem to use redundant methods. Whilst the first is valid, why bother placing the value inside a string in that manner when you can just as easily assign $row['cid'] to $buthead using $buthead = $row['cid']. As for the second why bother appending empty strings at the start and the end, this is entirely redundant. You very short explanation of your problem simply states you wish to echo out $row['cid'], which is as simple as echo $row['cid']. I'm assuming that's not what you want, but since there is no explanation of what anything in your code is supposed to do, I can't help you any further without some more accurate information. Link to comment https://forums.phpfreaks.com/topic/186426-echo-a-variable-from-a-inside-variable/#findComment-984502 Share on other sites More sharing options...
Baseball Posted December 27, 2009 Author Share Posted December 27, 2009 I have absolutely no idea what you're trying to do. Both... $buthead = "{$row['cid']}"; $buthead = "".$_GET['f'].""; ...seem to use redundant methods. Whilst the first is valid, why bother placing the value inside a string in that manner when you can just as easily assign $row['cid'] to $buthead using $buthead = $row['cid']. As for the second why bother appending empty strings at the start and the end, this is entirely redundant. You very short explanation of your problem simply states you wish to echo out $row['cid'], which is as simple as echo $row['cid']. I'm assuming that's not what you want, but since there is no explanation of what anything in your code is supposed to do, I can't help you any further without some more accurate information. it's cause i cant put a $name inside a query from a called variable Link to comment https://forums.phpfreaks.com/topic/186426-echo-a-variable-from-a-inside-variable/#findComment-984504 Share on other sites More sharing options...
cags Posted December 27, 2009 Share Posted December 27, 2009 That clarifies it... no more than you did before. If you honestly think you'd understand the problem based on your description so far, you're certainly a cleverer person than myself. You will need to give an example of the actual code your using and explain in what way it is not performing what you wish it to do. Alternatively if you have no idea where to start you should write out in simple English, using complete sentences exactly what you are trying to achieve. For example... I have a form where the user can input a name. I need to take the name entered by the user and run a query on the database to select all rows in the table `users` that have a value in the `name` field that matches the value entered by the user. How can I achieve this? Link to comment https://forums.phpfreaks.com/topic/186426-echo-a-variable-from-a-inside-variable/#findComment-984507 Share on other sites More sharing options...
Baseball Posted December 27, 2009 Author Share Posted December 27, 2009 That clarifies it... no more than you did before. If you honestly think you'd understand the problem based on your description so far, you're certainly a cleverer person than myself. You will need to give an example of the actual code your using and explain in what way it is not performing what you wish it to do. Alternatively if you have no idea where to start you should write out in simple English, using complete sentences exactly what you are trying to achieve. For example... I have a form where the user can input a name. I need to take the name entered by the user and run a query on the database to select all rows in the table `users` that have a value in the `name` field that matches the value entered by the user. How can I achieve this? LOL Link to comment https://forums.phpfreaks.com/topic/186426-echo-a-variable-from-a-inside-variable/#findComment-984509 Share on other sites More sharing options...
cags Posted December 27, 2009 Share Posted December 27, 2009 So I guess you don't actually want any help, fair enough. Link to comment https://forums.phpfreaks.com/topic/186426-echo-a-variable-from-a-inside-variable/#findComment-984517 Share on other sites More sharing options...
Baseball Posted December 27, 2009 Author Share Posted December 27, 2009 So I guess you don't actually want any help, fair enough. No it's not possible u just said anyway Link to comment https://forums.phpfreaks.com/topic/186426-echo-a-variable-from-a-inside-variable/#findComment-984535 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.