dbchris Posted May 10, 2011 Share Posted May 10, 2011 I'm barely even starting to understand SQL and I can't find this detail anywhere. I'm using MySQL 5.5 What I'm trying to do is make something display within a SQL code on my page. I'm trying to make this... <name> <points> <location> <type> Turn into this... Name: <name> Points: <points> <location> <type> So basically... Name: Orchard Points: 12 Garden Brush Putting the text "Name: " before the actual name, and putting "Points: " before the amount of points for this. SELECT name FROM `things` WHERE t_id='$t_id' SELECT points FROM `things` WHERE t_id='$t_id' SELECT location FROM `things` WHERE t_id='$t_id' SELECT type FROM `things` WHERE t_id='$t_id' I was told I could do something like make a hashmap that changes a word from its original text, but I don't know how to do any of that. What would I need? Link to comment https://forums.phpfreaks.com/topic/236052-new-to-sql-do-i-need-a-hashmap/ Share on other sites More sharing options...
Maq Posted May 10, 2011 Share Posted May 10, 2011 Not sure exactly what you mean by: I was told I could do something like make a hashmap that changes a word from its original text, but look at Example #1: http://us2.php.net/manual/en/function.mysql-fetch-assoc.php Link to comment https://forums.phpfreaks.com/topic/236052-new-to-sql-do-i-need-a-hashmap/#findComment-1213501 Share on other sites More sharing options...
dbchris Posted May 10, 2011 Author Share Posted May 10, 2011 Not sure exactly what you mean by: I was told I could do something like make a hashmap that changes a word from its original text, but look at Example #1: http://us2.php.net/manual/en/function.mysql-fetch-assoc.php I can barely even understand that that's the basic form I would need to put on my website to display the MySQL information I'd need to show... other than that, I don't see how I can make something like an ITEM TYPE turn into TEXT.... like a mapping that changes "1" to "Point: " and if it's "2" it would change the 2 to "Points: " and display that where the <points> section is in my original example above. Same as if I wanted to change 'thistype' to actually display on the site "This type is: " and change 'thattype' to display "That type is: " Link to comment https://forums.phpfreaks.com/topic/236052-new-to-sql-do-i-need-a-hashmap/#findComment-1213502 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.