That stopped the error!
But now nothing displays. I was testing the connection, I'll keep trying with that for now. Thank you Borris.
I am going to create a new thread because this thread is changing topic.
That stopped the error!
But now nothing displays. I was testing the connection, I'll keep trying with that for now. Thank you Borris.
I am going to create a new thread because this thread is changing topic.
Last edited by AdrielGreene; 04-24-2009 at 04:42 PM.
Try adding single quotes around the variable name:
Just a quick suggestion, try it and see, good luckPHP Code:
"SELECT `professional` FROM users WHERE `sub_domain` = '$prac_dir'";
Edit: You should also get into the habit of putting ticks around your column names like I have above, this is useful if there is a reserved word that is the same as one of the column names.
AdrielGreene (04-24-2009)
OK! no more error with the single quotes. but now I have an evolved problem. I want to echo from the array I've created.
And this error appears:Code:<?php $prac_dir = basename(dirname(__FILE__)); include ('/home/Myusername/Mywebsite.com/config.inc.php'); include (MYSQL); $q = "SELECT 'professional' FROM users WHERE 'sub_domain' = '$prac_dir'"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); $_display = mysqli_fetch_array ($r, MYSQLI_ASSOC); echo "$_display['professional']"; ?>
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on line 32
Line 32 isecho "$_display['professional']";
I'm assuming that means there is no value in my array. Is this correct? I'll try playing around with my config file and how I connect for now. Thanks for your input!
Try the following in line 32
It will definitely work (remove the quotes)Code:echo $_display['professional']
This is strange anyway, because
If you assign $something = "something";
and type echo "$something"; in your code it works...
But if you assign $something['something'] = "something";
and use echo "$something['something']" , you will get the exact error....
Check here:
http://bugs.php.net/bug.php?id=28148
AdrielGreene (04-24-2009)
That stopped the error!
But now nothing displays. I was testing the connection, I'll keep trying with that for now. Thank you Borris.
I am going to create a new thread because this thread is changing topic.
Last edited by AdrielGreene; 04-24-2009 at 04:39 PM.
Bookmarks