xylex
Members-
Posts
292 -
Joined
-
Last visited
Everything posted by xylex
-
You need to store the record first, then get the id that was set when the record was stored. For mysql, you want to use mysql_insert_id()/mysqli_insert_id(); If you try to get the next number first, you setup a race condition where multiple threads could go at the same time and get the same number as the next insert id, but only one of them would actually use that number when the records are inserted.
-
Well i would not call it lazy when i've been searching for hours to find the answer and didn't. Thanks to the other person who responded and didn't call my issue lazy. LMAO That one was great.
-
[SOLVED] Problem with My Pagination. Can You See What's Wrong?
xylex replied to Fluoresce's topic in PHP Coding Help
URL's wrong. movie_categories.php?cat_id=horror?pageno=2 should be movie_categories.php?cat_id=horror&pageno=2 -
Do a subselect of the post count and order by that? And mysql_real_escape_string() only secures you on quoted values, and you're not quoted in the order by clause there. Use a whitelist of values instead.
-
I would really recommend starting with writing plugins for systems that have good structure, well commented code, stable development, etc. You're going to be learning a lot from the code you're working with, and it's a lot better to learn good habits and then adapt to working with a horrible code base like OSCommerce than the other way around. But to answer your original question, there's really only so many ways to to structure an application with slight variations, so once you start working with a lot of different systems and get comfortable with them, picking up a new one and understanding it isn't an issue.
-
Corbin- I think that there are a lot of people in a similar situation as you. I've been doing PHP for awhile now, just passed my 10 year mark on my first PHP site...talk about crappy code . There are a few people in my area that are a similar situation as yourself that I meet with on a weekly/bi-weekly basis for an hour or two to on the cheap just to go over any issues that they run into, help plan system design, and do some code review with them to catch any issues. I know a few other experienced guys who do the same, it's a good way for us to see a variety of code and teaching/explaining something always gives you a better understanding. I'm sure that you could find someone around you that would be willing to do that too. Maybe try asking at a meetup group or posting on a local dev board.
-
You need to use curl instead of file_get_contents, and add the headers like curl_set_opt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7) Gecko/2009030516 Ubuntu/9.04 (jaunty) Firefox/3.0.7');
-
If all you want is a proxy, then you should probably just install one on the server and use that. PHP/Apache's probably the wrong way to go for this.
-
Looking from what I think you're trying to do, your error is in $subgroup = mysql_query($subgrouprank); while (list($subgroups) = mysql_fetch_row($subgroup)){ echo $subgroups; } $users = "SELECT data1, data2 FROM users WHERE level = 20 AND subgroup = $subgroups"; Would work better as $subgroups = array(); $subgroup = mysql_query($subgrouprank); while (mysql_fetch_row($subgroup){ $subgroups[] = $subgroup; } $subgroups = implode(', ' , $subgroups); $users = "SELECT data1, data2 FROM users WHERE level = 20 AND subgroup IN ($subgroups); " But why aren't you just doing a join on this to do it in one query $sql = ' SELECT data1, data2 FROM users JOIN subgroups ON (subgroups.id = users.subgroup) JOIN groups ON (groups.id = subgroups.group) WHERE user.level = 20 AND groups.rank = 20 ';
-
I just use the cell phone/ethernet cord/salad bowl method.
-
You're trying to setup a many to many relationship schema. Try Table of books Table of characters Table of book id's and character id's And query for your sublists.
-
Kill the float:left; on .panel, no need for it there and float doesn't cause the parent div to expand without a clear div like racer x said.
-
Can you share the rendered HTML?
-
No need for regex, php gives you filter functions for this. http://us.php.net/manual/en/function.filter-var.php filter_var($string, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
-
Templating is really just DOM element iteration and tag replacement. If you make a DOM based templating system that mimics the behavior of a library like jquery, you minimize the need for frontend guys to learn a new syntax. I'd recommend reading up on the DOM libraries, specifically DOM and SimpleXML, and go with a DOM based templating engine. I know this isn't the most processor efficient code, but in terms of project maintainability, it's a heck of a lot easier to find a good XHTML/JS coder than a good XHTML/JS/PHP coder.
-
Partnership oppurtunites from broke "successful" entrepreneurs
xylex posted a topic in Miscellaneous
Lately, I've been seeing a lot of the "partnership" no pay stuff in online classifieds containing something along the lines of "I have successfully grown and sold a startup before" or "I have successfully built up and sold 3 websites previously" either preceded or followed something about how they don't have any money to pay a developer for their new startup so it would be equity only. The lack of money for the new startup really shows a lack of success in previous business, so who are they thinking will buy that crap? -
Have you checked your memory_limit, upload_max_filesize and post_max_size settings to make sure you're not hitting something there?
-
What are you talking about!?! It was great, classic X-Files. If you followed the show, you would know that there were standalone episodes, and then the conspiracy, black oil ones. The standalone ones rarely had anything to do with aliens.
-
http://xkcd.com/323/
-
RegEx to add inline css (style tag) to link tag (<a>)
xylex replied to everisk's topic in Regex Help
Any particular reason you're trying to do this with regex and not an XML library? -
SQL Injection http://www.communitycouch.net/index.php?action=viewboard&board=1a`%20JOIN%20`1b
-
I'm not sure that this is the right place to request those types of favors........ Other than the template, is there anything that you've customized with PHPBB? If not, then just make sure you keep the script current.
-
REST is just another way of saying that you're using URL parameters. You can pass in an XML string as a value for one of the parameters, then parse it out if you wanted to, but I'm not sure why you would do this. XML is typically used for SOAP based services, not REST. If you're looking to go the SOAP route, look at NuSoap, Zend, the of course the built in stuff in PHP.
-
[SOLVED] DOMDocument::create_cdata_section() is not working in php 5.2.3
xylex replied to aniesh82's topic in PHP Coding Help
Try createCDATASection() In the manual, you want the stuff under DOM, not DOM XML. Confusing, I know. -
I don't think MyISAM supports fk constraints. Try using InnoDB.