Jessica
Staff Alumni-
Posts
8,968 -
Joined
-
Last visited
-
Days Won
41
Everything posted by Jessica
-
So instead of incrementing $count in the loop, just increment it when the answer is correct. Remove $count from your loop structure.
-
*smh* Do you know that $Produce is an object? (And that PHP lines need to end in ; )
-
There is no code to even check their answers, let alone count the correct ones.
-
The same way you access any object's property. You're doing it with $Product.
-
Because you missed the point I made over and over. Your code keeps changing the name on the input. You also keep changing what name you try to use. You don't have to be an expert to understand that a computer thinks "master_plan" and "masterplan" are two different things.
-
PHP MYSQL get a users first name and surname from their user ID
Jessica replied to dannyp100's topic in PHP Coding Help
Look at the query I posted and tell me what is different for mine and yours. You don't NEED separate functions to run separate queries for this. JUST DO ONE QUERY ONLY EVER ONE. -
PHP MYSQL get a users first name and surname from their user ID
Jessica replied to dannyp100's topic in PHP Coding Help
Good job. Post the query for me? -
Also, I wouldn't call Yii easy to learn.
-
Nevermind. *smh*
-
PHP MYSQL get a users first name and surname from their user ID
Jessica replied to dannyp100's topic in PHP Coding Help
userID is a column. userID is a column. Does userID = userID? Yes, on EVERY SINGLE ROW. Does 1=1? Yes, on EVERY SINGLE ROW. Does 'bob' = 'bob'? Yes, on EVERY SINGLE ROW. See a theme? You did it correctly for the first query: "SELECT * FROM gn_messages WHERE messageTo = $messageTo AND messageDeleted = '0' ORDER BY messageDate DESC" Now add your inner join to that query. "SELECT gn_messages.*, CONCAT(userFirstName, ' ', userSurname) AS full_name FROM gn_messages INNER JOIN gn_users ON gn_users.user_id = gn_messages.messageTo -- assuming you want the user's name who it is to. You'll need to do this join AGAIN to get the sender's name as well. WHERE messageTo = $messageTo AND messageDeleted = '0' ORDER BY messageDate DESC" On a totally unrelated note I suggest picking a naming convention and sticking with it. Switching from camelCase to underscores_and_back is really annoying. -
We use Yii as a base for the framework at my work, and I like it okay. It's very heavy on the memory usage though, or at least the way we've implemented it.
-
PHP MYSQL get a users first name and surname from their user ID
Jessica replied to dannyp100's topic in PHP Coding Help
$query = ("SELECT CONCAT(userFirstName, ' ', userSurname) AS full_name FROM gn_users WHERE userID = userID"); userID will always be equal to userID Come on. You need to make this one query with an INNER JOIN. See my post above. -
You need to post the code that you're having trouble with, and be a lot more specific about your question. You are confused about how to retrieve data? Or display it?
-
PHP MYSQL get a users first name and surname from their user ID
Jessica replied to dannyp100's topic in PHP Coding Help
Well for one, your function echos the text, not returns it. You also have random PHP inside a string. You can put variables inside a string, you can't put entire exp<b></b>ressions and functions inside them and have it work. Edit: If you keep changing it we can't help you. Now your code is using $return before it's defined. Read your error messages and attempt them. The HUGE problem is that you're running a query inside a loop by doing this. You should INNER JOIN the gn_messages table to the gn_users table and do ONE query. -
OP: you need to learn basic debugging. You completely missed the point I was trying to make, and unless you go back and understand what you were doing wrong, it'll happen again.
-
PHP MYSQL get a users first name and surname from their user ID
Jessica replied to dannyp100's topic in PHP Coding Help
That's not valid PHP. Is that your actual code? It has syntax errors. You can't just start writing HTML without either putting it in a string or exiting PHP. Please post your *actual* code. -
PHP MYSQL get a users first name and surname from their user ID
Jessica replied to dannyp100's topic in PHP Coding Help
Did you try it? -
PHP MYSQL get a users first name and surname from their user ID
Jessica replied to dannyp100's topic in PHP Coding Help
You can't just concatenate random stuff inside an array key string and expect it to do anything. You can however concat it IN the query. Either of these. SELECT CONCAT_WS(' ', userFirstName, userSurname) AS full_name FROM gn_users -- Rest of query SELECT CONCAT(userFirstName, ' ', userSurname) AS full_name FROM gn_users -- Rest of query -
Kicked you are very right, I stand corrected.
-
I like CakePHP a lot.
-
Yeah I have no idea why I said server. Lol!! Thanks Barand
-
Problem pulling from the datbase and displaying on webpage
Jessica replied to popcop's topic in PHP Coding Help
You need to check for errors. rand is a reserved keyword. -
The original code you posted is VERY different from the code you just now posted. You also posted masterplan and master_plan. Pick one and stick with it. The code I posted works.
-
What makes sense logically?
-
I'd post my real code, not write code that has completely different names which just wastes people's time when you're trying to identify an element by NAME.