ManiacDan
Staff Alumni-
Posts
2,604 -
Joined
-
Last visited
-
Days Won
10
Everything posted by ManiacDan
-
Help Please Error "unknown Column 'catagory' In 'where Clause"
ManiacDan replied to kate_rose's topic in MySQL Help
Mysql workbench never does that. If there's a setting that does that, turn it off. -
Add an s after the final slash to allow multiple lines.
-
Both datetime and timestamp are valid. Timestamp is slightly smaller to store and slightly faster to calculate, but it's doubtful either of those will ever be your biggest concern. Date is not valid for this, since it doesn't include a time.
-
Help Please Error "unknown Column 'catagory' In 'where Clause"
ManiacDan replied to kate_rose's topic in MySQL Help
That's not even a little bit true. What we're saying is: If you have a column named, literally, `$catagory` that's wrong (two different ways). When you try to do it in PHP, PHP interprets "$catagory" as being an actual PHP variable called $catagory, and tried to rewrite your string. Rename your MySQL columns so there are only letters, numbers, and underscores in them. No dollar signs, no ampersands, no quotes. Just letters and numbers. That way you can be assured that your strings are being built correctly. And fix your spelling now, while your product is young. -
That's not how regular exp<b></b>ressions work. The [] construct means "any of the single characters inside this." [abc] matches a, b, or c. [51|52|53|54|55] means 5,1,2,3,4, or |. You (might) want: $pattern = "/^((51)|(52)|(53)|(54)|(55))([0-9]{14})$/"; That matches one of your 5 starting pairs, then 14 more digits
-
I'm with Jess on this one. It shows very little respect, to me, to assign someone a task which takes longer than 20 minutes as a pre-interview task. Maybe after 2-3 interviews, when they've already spent a couple hours (and hopefully the cost of lunch or dinner) on me, then I'd perform some kind of test, but this example of "spend a lot of time doing work before we'll even deign to interview you" ticks me off. I've had companies do that before, and I decline every time. Right out of college I tried to work for Robert Half, an IT staffing firm. After an entire business day of taking poorly written, out-of-date multiple choice tests they told me that they'd "be in touch" and I never heard from them again. I don't do schoolwork for people anymore, I graduated from college on purpose.
-
Is there data in the source of the page? Do you have error_reporting turned on?
-
He assigns $view1= $_GET['view'], so that's not it.
-
Describe "photos don't load." In the first page? In the second? Does the HTML work? Black image? Broken image? Your have invalid HTML in your index page, there's a >> that shouldn't be there.
-
'foreach' Testing For Strlen($Key) Within A 'while'
ManiacDan replied to rsleventhal's topic in PHP Coding Help
There is no "earlier in the code" for this example, you select data and then print it. If you're not showing us your actual code, there's no way we can help you. You say the data is there when you remove the IF check. That implies that your IF check is failing. Inside that IF check, print out "In the if because strlen('{$value}') is zero<br />"; That should work. your thread title says $key, your code says $value. Are you sure you're checking the right variable? -
The function to split a string into chunks is called chunk_split
-
It has nothing to do with apache, you can't do cross-domain AJAX requests, that's just the rule. You can make a script on your own server which acts as a pass-through for the third-party XML. There are other ways to get around this issue, google around for cross-domain ajax for a solution if you don't want to simply make a page on your server.
-
Rotating Banner Stop Rotating When I Remove A Link.
ManiacDan replied to Beeeeney's topic in Javascript Help
It seems very weird for a company to trust someone with a server-side language capable of deleting files, stealing database contents, entering into infinite loops, or destroying the memory usage of the server, but not trust that same person with client-size javascript which, at worst, will close a user's browser tab. -
Start your hrefs with a slash: href="/blog/about"
-
You need to use preg_quote when you're building your list of suspects. There's a slash in one of them.
- 4 replies
-
- modifier d
- preg_match
-
(and 2 more)
Tagged with:
-
'foreach' Testing For Strlen($Key) Within A 'while'
ManiacDan replied to rsleventhal's topic in PHP Coding Help
Are you sure it's losing the first column? Does the first column have HTML in it? Do you see it when you run the SQL query by hand? -
Accepting a variable "by reference" means putting an ampersand in front of the variable in the function declaration: function myFunction( &$myVariable ) That's a little-used feature which means any changes to $myVariable inside of myFunction() affect the state of the variable OUTSIDE the function, like this: function upper( &$myVariable ) { $myVariable = strtopupper($myVariable); } $a = "abc"; upper($a); echo $a; //prints ABC Foreach is easy, you have the manual for that. Return is also easy, that should be in your book.
-
Is this homework, or can you just use the built in function that already does this?
-
Like I said before, the scroll effect is in a different language, not the one you posted. It's in a whole other file, processed on another computer, and works in a different way. Get firebug or chrome developer tools and check the JS console for errors.
-
Do you have any sort of error_reporting turned on? The bad mysql function call would have thrown a serious error. Turn on error reporting. Also, scrolling of things isn't handled in PHP, only in JS.
-
If Column Contains Only Null Values Remove From Array.
ManiacDan replied to AnalyzeThis's topic in MySQL Help
Very possible, I hadn't thought of that. If that's the case...hmm...there still isn't really a way to drop those tables out of the join. -
If Column Contains Only Null Values Remove From Array.
ManiacDan replied to AnalyzeThis's topic in MySQL Help
I can't tell since you're not telling us the real purpose of these columns, but if these are pizza toppings (or really...anything that repeats like this) it's at most second normal form, when you need third. You can't exclude a column dynamically from your result using SQL. The SELECT clause determines the columns, period. You have to process this in PHP first. You could...nah. I was going to say something about pivot tables, but it's faster to do your query and then filter by empty columns. SQL works on rows, not columns. You can't WHERE against an entire column, only against a row. -
I learned PHP by realizing, at 6:30pm one evening, that my roommate and I had completely forgotten to do our final project for our Exploiting the Information World class, and a fully-functional e-commerce website was due at 7 the next morning. We stayed up all night with him screaming valid PHP syntax at me from across the room while we hacked out what eventually became our first business. Though I did already know a few languages at that point, none were like PHP (except for maybe C++ in terms of syntax). Plus, I learned on PHP4, with the bare minimum of object support. For a less extreme boot camp method, I suggest what you've already been told: make yourself something. A blog is good, if you have stuff to say. A data tracking software if you don't. Make a database of a collection, track your workout, count the number of law breakers you see on your drive to work, do something which manipulates and displays data. Try to do something cool with it, keep tacking on features until it's a huge unmanageable mess, then scrap it and start over.
-
If Column Contains Only Null Values Remove From Array.
ManiacDan replied to AnalyzeThis's topic in MySQL Help
Unfortunately your database seems to be incorrectly designed. You should have a "toppings" table which links to materials so you could easily pull any available toppings. You may have to do this filtering in PHP or some other language since pure SQL may be impossible. -
Turn on error reporting, check the errors, echo mysql_error()