Stats: 3,190,207 members, 7,939,862 topics. Date: Wednesday, 04 September 2024 at 01:20 PM |
Nairaland Forum / Science/Technology / Programming / How Do I Add A Variable Within Mysqli Query (1283 Views)
Java Programmers - How Do I Pass Variable Value From A Classa To Another Classb / What The Difference In Local, Global, Static Variable Declearation / Add A Dictionary To A Grid (2) (3) (4)
How Do I Add A Variable Within Mysqli Query by ANTONINEUTRON(m): 1:58pm On Sep 26, 2016 |
Pls Guys I ave hit a stumbling block and i need ur help. Here Is D Query $res = "SELECT * FROM `user` WHERE `userid` = '$userid'" $result = mysqli_query($conn,$res); Now D Problem Is If i loop through $result to get d row result(d user information), I Get Notin. And NB: 1. $userid Is Gotten Thru Global Variable $Post[] Where User Input Thier Id. 2. If I Use Let Say '12' In Place Of $userid It Return D Info. |
Re: How Do I Add A Variable Within Mysqli Query by Dangujba1111: 2:08pm On Sep 26, 2016 |
ANTONINEUTRON: i dont Really understand your question but i think this will solve your problem $result = mysqli_fetch_array($res); $nameyourvariable = $result["yourrow"]; |
Re: How Do I Add A Variable Within Mysqli Query by ANTONINEUTRON(m): 2:14pm On Sep 26, 2016 |
Dangujba1111:It Is Not Displaying D Query(converting It To And Array) That Is D Problem, D Problem Is D Query Isn't Returning Any Result/Info That Will Be Display |
Re: How Do I Add A Variable Within Mysqli Query by Dangujba1111: 5:42pm On Sep 26, 2016 |
ANTONINEUTRON:firstly, you have check if the id exists or not using $check = mysqli_num_rows(mysqli_query($conn, "SELECT * FROM user WHERE userid = '$userid'" ![]() if($check < 1){ echo "No ID exists"; } |
Re: How Do I Add A Variable Within Mysqli Query by noordean(m): 6:43pm On Sep 26, 2016 |
ANTONINEUTRON: 1. Why are you putting the database table and table field userid in quote? They would be seen as strings that way. 2. Your $userid variable shouldn't have quote , it represents integer values. So i think your query should look like this: $res="SELECT * FROM user WHERE userid=$userid" 1 Like |
Re: How Do I Add A Variable Within Mysqli Query by ANTONINEUTRON(m): 9:37pm On Sep 26, 2016 |
noordean:Thanks I'll Try It Right Away |
Re: How Do I Add A Variable Within Mysqli Query by Fulaman198(m): 1:19pm On Jul 14, 2017 |
Please let me know if you are still having any problems. |
(1) (Reply)
Matrix Issues (formula)..please Help Resolve / Connecting To Mysql Database Using Python3? / Ui/ux Design Tools
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 14 |