- Strength to Increase Rep
- +5
- Strength to Decrease Rep
- -1
- Upvotes Received
- 9
- Posts with Upvotes
- 7
- Upvoting Members
- 9
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Senior PHP/Mysql developer, senior CSS, JavaScript - jQuery and AJAX developer
- Interests
- New media, movies, swimming, going out
Re: [code=php]<?php $string = 'But i am not looking this simple one. what i am looking here is i searched a keyword (for eg php ). After searching I got some results from the database. if the result has a keyword php, then that all (php) word should be highlited. please … | |
Re: Your regex pattern has two problems: 1. it has * as the character counter, which means "0 or any number of charcaters frm the class". This means that a string containing even none (0) of your characters will match your expression 2. you didn't specify that there cannot be other … | |
Re: try mysql_fetch_assoc instead of mysql_fetch_array | |
Re: Are you sure you have records that match all the joins at the same time? Cause there is nothing wrong with the query. Try using LEFT JOIN instead of JOIN and see what it returns. This will return all the rows in your clients table and either fields with data … | |
Re: This works, of course, but it's not a very elegant solution and if you have many checkboxes on the page than (say 50) you will have to write that code 50 times, which I don't think you'll like :) So, another easier solution is to set the names of the … | |
Re: Counting for locations: [CODE=mysql] SELECT COUNT(*), fieldID, fieldValue FROM itemfield WHERE fieldID = 8 GROUP BY fieldValue [/CODE] just change the fieldID with the ID of other counting criteria (dwelling type, make, etc) | |
| Re: If this si what you want - to have all the attribute values in a comma separated string - then you just have to do an implode (no loop) to $attribute: [CODE=php] $att_ref = implode(",", $attribute); [/CODE] But id don't understand why you don't just assign the whole $attribute array … |
Re: Use array_slice function Read here how: [URL="http://php.net/manual/en/function.array-slice.php"]http://php.net/manual/en/function.array-slice.php[/URL] You should read the php manual first and learn th basic stuff from there, and then go and start programming! | |
Re: mysql_query("DELETE p.*, t1.*, t2.*, t3.*, t4.*, t5.*, t6.* FROM product AS p, table_1 AS t1, table_2 AS t2, table_3 AS t3, table_4 AS t4, table_5 AS t5, table_6 AS t6 WHERE p.id = $product_id AND t1.product_id = $product_id AND t2.product_id = $product_id AND t3.product_id = $product_id AND t4.product_id = $product_id … | |
Re: You would probably have to loop through the resultset and assign each row to an array; you can't just split the resultset; it might be easier/faster to just have to queries with their own resultset | |
Re: Why do you have to use replace? Cant you just append the random password to the and of the string without XXXXX ? Like this [CODE=php] <?php $password = rand(12345,98765); $stringtoparse = 'Your new password is ' . $password; echo $stringtoparse; ?> [/CODE] | |
Re: Hi, Have you found a solution for this yet? If not, then... 1. can you put the three tables in a zip and attach them here so I can replicate them locally and try some changes? and 2. 'gold' in this query is just an example for any dynamic input … | |
Re: Actually, what colweb said will not end up with what you want, since your implode will put a comma between elements from each row, but will results from different rows wil not have a comma between them. The double values you get is from the fact that you use mysql_fetch_array … | |
Re: Here's a very simple mysql solution: [CODE=php] <?php mysql_query('UPDATE dealers AS d, (SELECT agent, COUNT(*) AS agentcount, registration_timestamp FROM users GROUP BY agent) AS u SET d.thisperiodusercount = u.agentcount + d.usercountbalance WHERE d.username = u.agent AND u.registration_timestamp > d.registration_timestamp AND u.registration_timestamp < d.expiredtime') or die(mysql_error()); [/CODE] I'd suggest you don't … | |
Re: That's because the graph class you use to output the image is trying to set some image headers, but you already outputed some stuff (from your print commands) before it, which php don't allow. So: 1. This should fix your error: remove all the prints before phpgraphlib.php; leave only the … | |
Re: It's probably because you don't have the $dbc available inside that function; you have to either pass it as a parameter to the function like: function($dbc) { .... or set it as a global variable inside that function like: function() { global $dbc; ..... | |
Re: [CODE=mysql]UPDATE user AS u, thread AS t, threadoffering AS to SET u.points = u.points * 1.05 WHERE t.threadid = to.threadid AND to.year = 2010 AND to.season = 'spring' AND t.threadLocation = CS AND to.user = u.userid AND u.userid > 1 [/CODE] You have to join somehow user table to threadoffering … | |
Re: You can find it in the php manual if you do a little search :) Here is that code adjusted to what you need: [php] <?php /// here is your database connection /// than the query $result = mysql_query ("select field_1, field_2, field_3 from table") or die (mysql_error()); $filename = … | |
Re: You can do it like that, but that's not the optimised way to do it. You have what is called multiple-to-multiple relationship (many users with many hobbies). So the principle to connect one to the other is to have a table that defines each one (one table for users and … | |
Re: Actually, [B]kkeith29[/B] example doesn't load new content in the original page; it just reloads the page with a parameter passed through the $_GET variable, and shows some text as a response of that parameter. Since php is a server side script, which means it is processed on the server and … | |
Re: Try this: [CODE]<a>a href="results.php?fl=A">A</a> <a>a href="results.php?fl=B">B</a>[/CODE] [CODE] $fl =$_GET['fl']; // fl - First Letter if (preg_match('#^[a-z]{1}$#i',$fl)) { // check if it is an allowed value - letters from a to z in lower/upper case $result = mysql_query("SELECT id,high_school FROM high_schools WHERE high_school LIKE '$fl%'"; ...... } [/CODE] For that code … | |
Re: Or you can simply ad [PHP]header('refresh:10; url=same_page.php');[/PHP] | |
Re: You have a problem in the way your query string is written (because of the way you wrote it, you missed some spaces, between [B]auth[/B] and [B]where[/B] and between [B]'$userid'[/B] and [B]and[/B]: [code]$query="select * from auth" ."where name='$userid'" ."and pass=password('$password')";[/code] this query is, in fact, this: [code]$query="select * from authwhere … | |
Re: First of all, why do you require the "Wordsarray.php" file in each cycle of the while loop? You should include (require) that file only once, before the loop and than do the while loop. Than, about your error, I can only guess here, since you didn't provide the $normal and … | |
Re: [quote]$item = [B][COLOR=green]mysql_fetch_array[/COLOR][COLOR=green]([/COLOR][/B]$item_query[B][COLOR=green])[/COLOR][/B];[/quote] means $item is an array an you cannot put an array in an echo statement; this is why you get nothing. You need to use $item['name_of_mysql_column'] in your "echo...." You also have a sintax error: in [quote]$foo =& creature_stats[B][COLOR=green]([/COLOR][/B] item, $id_creature [B][COLOR=green])[/COLOR][/B];[/quote] since item is a variable, … | |
Re: $random_array = [COLOR=#810081]array_rand[/COLOR]($sAdText, 3); | |
Re: If you use mod_rewrite, why don't you use it all the way??? RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([0-9]+)/$ index.php?act=$1&task=$2&game=$3 or RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([0-9]+).html$ index.php?act=$1&task=$2&game=$3 That would be: mysite.com/games/play/534/ or mysite.com/games/play/534.html or whatever other variation of that you want ;) | |
Re: Here's a statistic from one of my sites, but I can tell you that is about the same from all my other sites: [B]1024x768 (45.9%)[/B] [B]1280x800 (12.3%)[/B] [B]800x600 (10.4%)[/B] [B]1280x1024 (9.7%)[/B] [B]1152x864 (3.2%)[/B] [B]1280x768 (2.2%)[/B] [B]1680x1050 (1.9%)[/B] [B]1400x1050 (0.5%)[/B] [B]1280x960 (0.7%)[/B] [B]Others (13.2%)[/B] As you can see, most of the … | |
Re: <title><?php echo $title; ?></title> where $title has a value returned by your php script; for instance: the title of an article from the database, the name of the current category, the name of the site if you are in the homepage etc.; look at this forum for example. | |
Re: You pobably have a sintax (writing) error in your 'header.php' file; check that you have closed all the brackets and parenthesis and also that you have sthe ';" at the end of every line of code etc. Yu also might have a wrong path to the file: '/php/header.php' means the … |