
ArshSingh
Members-
Posts
49 -
Joined
-
Last visited
ArshSingh's Achievements

Member (2/5)
0
Reputation
-
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
there was nuthing to do rewrite things , noob me was using while loop . thnx to kicken now all is working good and smoothly . kicken 's answer worked -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
please see this screenshot for columns: http://prntscr.com/5l52ip -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
yes im working on localhost and also my db is on local as i'm using MAMP PRO for mac ,, and btw , i do have also other functions which are working with databse and doing their work successfully and getting the result from database expect this one. will get you the columns structure. -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
it's already integer. -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
yes i do get same value for those variables -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
i'm not getting the $_GET from an input , it's directly from url in this way : locahost/easy/u/5 also the output of $_GET is : string(1) "5" -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
as always result is "NULL" there is a user with id : 5 , but it returns NULL with variable value , and with static number in execute() it resutnr the result with user details (this is what need to come as result). -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
this is what i get on var_dump of $user_id string(1) "5" -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
this is a var_dump of query : object(stdClass)#7 (5) { ["username"]=> string(5) "admin" ["email"]=> string(15) "[email protected]" ["profile_pic"]=> string(14) "1419529017.jpg" ["id"]=> string(1) "5" ["active"]=> string(3) "Yes" -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
Well sorry if i'm not able to explain the situation a bit more in detail , as i too don't have any other clue of what is happening. Anyway thanks for the help and this is a result of query after putting static number value in query : object(stdClass)#7 (5) { ["username"]=> string(5) "admin" ["email"]=> string(15) "[email protected]" ["profile_pic"]=> string(14) "1419529017.jpg" ["id"]=> string(1) "5" ["active"]=> string(3) "Yes" -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
if return $user_det is not inside while loop and no result comes from query it gives me undefined $user_det variable error but with an static number value '5' it works smoothly , i'm returning this array as i'm working on different structure and i don't want to use : $row['username] something like this. i'm converting the array to object as i need the array to work in the following way : $user->username not like this : $user[0]['username'] , it's just part of my program structure , including and excluding everything we come back to the odd problem : why it is reacting in that way , and not returning and result if used variable at the place of static number value. -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
Well result of var_dump is : string 0 '5' -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
when using $user it returns "NULL" but when i put static value '5' it returns the array with all details. and what do you mean with : Did you notice the key difference in your two statements? -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
When i put a static value to : $stmt->execute(array(':user_id'=>$user)); -> $stmt->execute(array(':user_id'=>'5')); it works and returns the result , and this is what i'm submiting to the function profile_view() , and i have also done _ var_dump of $user before query and it shows me the correct vaulue of what $_GET is getting from url. -
PHP PDO variable not working in query but static value works
ArshSingh replied to ArshSingh's topic in PHP Coding Help
inside function i'm declaring that $user = $user_id; and this does not seems to be connected the problem at all