Jessica
-
Posts
8,968 -
Joined
-
Last visited
-
Days Won
41
Posts posted by Jessica
-
-
Programming is not copying and pasting other people's "codes".
-
Moved to the appropriate forum.
-
Having these questions and answers hard coded. I want to be able to read them from a text file and load the arrays questions with questions from questions.txt while also read answers array from answers.txt. but at the same time maintain my data structures. How should I go abou this?
Why? Why don't you just leave it as is...? Save those two arrays in a file and then include them.
-
Yes, those are two different things.
-
Do not bump your posts.
The quote pretty much explains it as far as what you need to know to use it.
For more information see the PHP manual.
-
I'm not using mysql_ functions. I'm not the OP... I just edited his code, didn't really want to get him side-tracked by replacing his mysql_ functions with mysqli functions.
I'm sure you know there's a real_escape_string function for MySQLi aswell. That's what I meant with this:
Oh... I've been told to use it on each freaking query I make... Well, you learn something every day. Thanks!
You should be using prepared statements in mysqli, NOT escape string.
-
You probably have a typo somewhere. Using strict error reporting and/or a good IDE like NetBeans will help catch it.
-
If you'd explained some of this up front it would have gone a lot faster.
It probably has to do with the configuration of your relationships, which you haven't shown.
I suggest you read the links in my signature on how to get help.
David: counterCache is supposed to handle that count automatically - hence why it's trying to update the userCount automatically when the users table is updated. It's a tool for CakePHP.
-
Not if you're using mysql_ functions, you're not.
-
That makes even less sense. An address has multiple users???
-
Edit: Do the remove command within the loop. Not at the end.
-
i think the answer to this vague question might be to use a reference -
$somekey = 'city'; $root = &$structure[0]['cards'][0]['info'][$somekey]; // form a reference to a point in the structure echo $root['title']; // use one specific value at the referenced point // loop over all values at the referenced point foreach ($root as $key=>$value){ if(!is_array($value)){ echo "Key: $key, Value: $value<br>"; } else { echo "Key: $key, "; foreach($value as $skey=>$svalue){ echo "SubKey: $skey, SubValue: $svalue<br>"; } } }
Why would you bother with three lines of code though?
That's the same as just doing:
echo $structure[0]['cards'][0]['info']['city']['title']
Or:
echo $structure[0]['cards'][0]['info'][$somekey][$someotherkey]
-
That makes no sense. When you delete a user, why would you attempt to update their Address count? You should call that when you delete an ADDRESS, not a user.
-
You shouldn't even be using it anymore. New code should be using mysqli/PDO.
-
PHPFreaks.com Questions, Comments, & Suggestions
This is NOT a help forum! Do not post topics asking for help that are not related to the website.http://www.phpfreaks.com/page/rules-and-terms-of-service
Users will format posts as best as they can by using proper
[/nobbc] or [nobbc]tags and following Proper Code Indentation guidelines.
Users will post relevant code and information to their question(s).
Read the link in my signature on Debugging your SQL. Research using prepared statements.
-
Best practice is to use an auto-incrementing id as your primary key, even if you think usernames will never change.
OP: You haven't posted a question or a problem or any code. You've just posted what you want to happen. Cool story.
-
How should we be able to help? You've posted no code.
You also said it was an UPDATE before, now it's a DELETE? If you don't even know what your code is doing, how should we?
-
Which is it? You want just the count, or you want all the rows?
Sorry, I probably could have been more clear.
I'm not looking to return the results. I just want the count as if that were the query.
That's nearly what I want, however since I'm also displaying a list of results it's just making the counts 1 for each row. I want the sum of all rows with that match.
-
Probably.
-
Could someone possibly let me know how they would go about doing the following:
I'd start by writing some code.
This forum is for help with code you've written. If you need application design advice, we have a forum for that.
-
Yes.
Properly normalize your data, then you can use COUNT() and GROUP BY to get it all in one query.
-
OP: If you always are going to use the first card, is there a reason you have it in an array called 'cards'? Why not just one card?
-
Unless you made your personal computer accessible over the internet, there's no reason to change your local setup.
-
Use an OR clause between those two.
WHERE name ... AND (sms .. OR email .. )
Some php help if you guys dont mind
in PHP Coding Help
Posted
What did the error say?