802 Posted Topics
Re: Post also the surrounding code as there seems to be now obvious flaw with the snippet. | |
Re: Use preg_replace() to match and format the values supplied by users. Strip the phone numbers of any non-numeric characters first. Apply [CODE]$number = preg_replace( '/[^0-9]/', '', $number ); $number = preg_replace( '/([0-9]{3})([0-9]{3})([0-9]{4})/', '($1) $2-$3', $number ); [/CODE] Likewise for the domain. ![]() | |
Re: If you submit your data in the form of a test case - that is as MySQL statements which can directly entered into the mysql command line interface reproducing your problem, as in my post [url]http://www.daniweb.com/forums/post1492091.html#post1492091[/url] - I'm willing to give it a try. | |
Re: Look at the answer to your first post of this item. ![]() | |
Re: There are numerous ways. For example, you can use the mysql_field_name() function. Or you can alter your script. In the loop, do [CODE]foreach($show as $key => $value) echo "$key: $value\t"; echo "\n"; [/CODE] | |
Re: It's not us who are confused ;-) You can put your php script to sleep for one day (see the sleep function) and let it run unterminated. Or you can use PHP from the command line as a script language and call it from a cronjob. I'd recommend you use … | |
Re: Replace [ICODE]name="date"[/ICODE] by [ICODE]name="date[]"[/ICODE]. Then in send.php walk through the array [ICODE]$_POST['date'][/ICODE] and generate an INSERT query for each element. | |
Re: echo yor $query to see if it contains the expected content. If it does, run in from the mysql command line. | |
Re: 0) Your select box has several HTML errors: [ICODE]name=linklabel=''[/ICODE] should probably read [ICODE]name='linklabel'[/ICODE] Put quotes around all attribute values in HTML. 1) Use the onclick event in JavaScript: [ICODE]<select onclick='document.test.submit()'...> [/ICODE] or something like that - I don't know the necessary javascript by heart. 2) In edit_page.php you get the … | |
Re: It is possible, but it's not a mysql or database problem. The database part is peanuts. The time consuming part is analyzing the target site's interfaces. Many of such sites have provisions against automated usage which would have to be overcome. So if your developers are stuck it's probably this … | |
Re: I assume that with "row names" you mean the column names. You can get them with the functions mysql_field_name and mysql_field_count: [CODE]while ($object = mysql_fetch_object($result) { for ($i = 0; $i < mysql_field_count($result); $i++) { $field_name = mysql_field_name($result, $i); $field = $object->$field_name; ... } }[/CODE] ![]() | |
Re: Use preg_match_all() [CODE]if (preg_match_all( '/A ([0-9]+)/', $paragraph, $matches, PREG_SET_ORDER )){ foreach( $matches as $m ) ... // process $m[1] } } [/CODE] | |
Re: [CODE]select sum(c.pop) from (SELECT pop FROM wi_allbcdata b WHERE b.countyname='Adams' GROUP BY blkidfp00) c;[/CODE] | |
Re: Study regular expressions. You can achieve your goal with the preg_replace() function which can find well-formed links and replace them with the appropriate HTML code. | |
Re: Without having understood the details of your problem, I see that it cannot work: your LEFT JOIN clause does not contain any comparison: [CODE]FROM prod_contacts.cms_contacts LEFT JOIN prod_contacts.cms_table_packholder ON cms_contacts.packholder [/CODE]should probably read [CODE]FROM prod_contacts LEFT JOIN cms_contacts ON cms_contacts.packholder = prod_contacts.packholder[/CODE] | |
Re: First I recommend that you test your variants for speed and efficiency. Then have a look at the EXPLAIN explanations for your update queries which might tell you about some potential inefficencies. Third, I assume you have an unique user/products index. Therefore you could use an INSERT IGNORE query to … | |
Re: When you remove the RewriteRule from .htaccess, you are seeing the .jpg file. If the rule is active, you see the output of the PHP file which is something completely different. You do not need this setup. Instead replace all references to the .jpg file by references to the .php … | |
Re: 1. Add a field "size" to the product table and add a lookup table "sizes" for this field. 2. The standard layout is one table for the invoice and one table for the invoice positions (items) which are linked to the invoice table. | |
Re: Grep all your source code and a database dump of your development database for the Æ’ character. Make sure that the browser recognizes the correct character set (encoding). | |
Re: [CODE]select a.form_num, a.name, b.score, b.ddate from form1 a, form2 b where a.from_num=b.form_num order by b.ddate limit 1; [/CODE] or [CODE]select a.form_num, a.name, b.score, b.ddate from form1 a, form2 b where a.form_num=b.form_num and b.ddate = (select min(ddate) from form2 where form_num=a.form_num) c; [/CODE] | |
Re: Also have a look at the preg functions of PHP which might be much easier to handle than the external grep. | |
Re: Your code has one superfluous loop which you did not notice because of a second error. [ICODE]<? $db_name="mydb"; trim($searchterm); if (!$_GET["searchterm"]) { echo "You haven't entered any word to search.Please, go back and entered it."; exit; } $searchterm = addslashes($searchterm); require("dict.php"); if (!$db) { echo "Error. Can't connect to database.Please … | |
Re: You do not get a PHP error, but a notice. To avoid it, change [CODE]$act = $_GET['act']; //retrives the page action[/CODE] to [CODE]if (isset($_GET['act'])) $act = $_GET['act']; //retrieves the page action[/CODE] I am not sure if the PHP error notice appears before the header is sent to the browser. If … | |
Re: You are selecting the sum instead of the average. Try this instead: [CODE]SELECT m.movie_id, movie_title, movie_release_year, movie_genre, movie_plot, SUM(movie_rate) AS sum_movie_rate, AVG(movie_rate) as average_rating FROM movie m, user_movie_rate r WHERE m.movie_id = r.movie_id and m.movie_id=? [/CODE] | |
Re: Replace "Replay" by "Reply". Replace "\n" by "\r\n". Add a "\r\n" to the first header to separate it from the second. [CODE]$headers = "From: mywebsite.ca\r\nReply-To: Do Not Reply\r\nX-Mailer: PHP/" . phpversion(); $headers .= "\r\nContent-type: text/html; charset=iso-8859-1"; [/CODE] Then try again. | |
Re: There is a lot wrong with this code. Another question is why it is not working as expected. I assume because your pictures are in the pic subdirectory and you are applying the filesize function to a non-existent file in the root directory. Try [CODE]print(filesize("/pic/" . $dirArray[$index])); [/CODE] | |
Re: Use radio buttons. That's what they are for: selection of one of multiple values. | |
Re: Send your users to a script which evaluates the user id and sends a Location: header back to the desired page. But are 01.php and 02.php really substantially different? Would you not be better off with only one script and variable content depending on the user? | |
Re: I suggest you use something like pritaeas' expression in a BEFORE INSERT trigger and store it in a invoice_number field. Instead of using the count(*) function I'd rather check for the highest number in this month and store it in a separate field. In your trigger BEFORE INSERT: [CODE]SET new.invoice_number … | |
Re: To the best of my knowledge MySQL does not have macro or eval capabilities. This means that there is no built-in parser which can evaluate a string expression as program code. You will have to supply this parser yourself. I'd recommend you write a function named "convert" or the like … | |
Re: Have a look at the non-greedy query modifyer, the question mark ?. [CODE]if(preg_match('/^((.*)">)?(.*?)</',$A[1],$B) == 1) die($B[3]); [/CODE] | |
Re: This has nothing to do with Joomla (or with PHP). Just set up a page with four links to four different pages. You can host as much sites and databases on one server as you want. | |
Re: Still better, put the whole HTML code within PHP tags. It's much easier to read and to maintain. [ICODE]<?php for ($i = 0; $i <= 10; $i++) { echo " <tr> <td> <input name='rate$i' id='rate$i' type='text' onkeyup='integeronly(this)' > </td> <td> <input name='qty$i' id='qty$i' type='text' onkeyup='integeronly(this)' > </td> <td> <input name='amt$i' … | |
Re: I don't know wordpress but I would assume they use date type fields for dates. In that case you have to format your input date accordingly: SELECT * FROM 'wp_posts' WHERE 'post_date' < '2010-10-31'; | |
Re: And you haven't read this: [url]http://www.daniweb.com/forums/thread191031.html[/url] | |
Re: You have to convert the array content to string literals. Like in [CODE]SELECT * FROM table WHERE shortcode IN ('a','b','c');[/CODE] | |
Re: array_unique() keeps the indexes intact. If not specified otherwise, these are ascending integers. Try this instead: [CODE]$pid = array_unique($pids); foreach( $pid as $key => $value ) echo "$key: $value<br/>"; [/CODE] | |
Re: Both in Linux and in Windows you can have filenames containing @, so that should not be the reason. It's rather the upload module which does some replacement operations on the filenames. | |
Re: Google for "ocr php". (OCR = Optical Character Recognition) | |
Re: Just put a link in your HTML. If your server is configured properly, it will output a header announcing the file type as Content-type: application/pdf. If the client browser has a pdf plugin activated, it will show the browser in the plugin, otherwise pass it to the operating system which … | |
Re: You do not have to remove the ' but to escape it. Precede it with a backslash. See [url]http://php.net/manual/de/function.mysql-real-escape-string.php[/url] | |
Re: If the field may only have four values, use an enum type. [CODE]create table publisher(name varchar(20), city enum('mumbai','pune','nasik','panji'))[/CODE] | |
Re: This is a question of the server configuration, not a PHP question. Apache servers have to be configured so that PHP files (identified by their extensions) are parsed and executed instead of displayed. You will have to ask your provider to change the server settings accordingly. | |
Re: Maybe you forgot to initialize the session with session_start(). And instead of line 3 it shoud read [CODE] $row = mysql_fetch_row( $r ); [/CODE] | |
Re: I don't know the framework you are using. What is it? The PHP manual does not say that the dir class is not functional in safe mode. Try to use this class instead of your directory iterator. | |
Re: What exactly is your problem? Does propertylisting_details.php?recordID=nnn work? (Replace nnn with any valid record number.) Does $row_rs_search['prop_id'] contain a value? Show the code in propertylisting_details.php where you query the database. | |
Re: Many people tend to store pictures as external files and keep only a reference in the database. I'd rather recommend to storing them in the database in blob fields as you won't have to deal with file or directory names, updating image files and the like. The process for that … ![]() | |
Re: Use a view which shows your calculated column in real-time instead of calculating it beforehand. If you cannot do this (maybe for performance reasons) use a BEFORE INSERT and BEFORE UPDATE trigger which calculates the difference field. |
The End.