2,113 Posted Topics
Re: You could use `getmxrr()`: <?php $url = 'daniweb.com'; getmxrr($url, $matches, $weights); print_r($matches); print_r($weights); Docs: http://php.net/getmxrr Regarding `dns_get_record()` what kind of problem do you experience? Can you show your script? > I need to be able to display the srv record below the textbox, the srv record needs to start with … | |
Re: At line `10` there is an error: if (isset($searching) && $searching==yes) the value `yes` is a string not a constant, so change it to: if (isset($searching) && $searching=='yes') At line `82` you wrote: echo $recordObj->mycolumn; But you're retrieving `title`, `content` and `images` from the query, so it should be: echo … | |
Re: That's probably happens because you're trying to access the controller from the application directory instead of using the `index.php` file. If, for example you have a controller named Articles, then try: http://localhost/index.php/articles If this does not help then try to provide more information: * an example of url used to … | |
Re: In addition, you could use a PHP array, for example create **fruits.php**: <?php return array( 'red' => array( 'Cherries', 'Cranberries', 'Pomegranate', ), 'green' => array( 'Avocados', 'Cucumbers', 'Honeydew', ), 'blue' => array( 'Blueberries', 'Fig', 'Plums' ) ); Then you can include it in your script as a configuration file: <?php … ![]() | |
Re: Hi, posting the structures of the tables would help to understand. Right now it seems you just need to select by `av.sku_id`: select av.value, av.id, av.sku_id from product_attr_vals where av.sku_id = '#3103513504350'; But I suppose the value you were referring, i.e. `12.7oz`, is saved somewhere, from the above I don't … | |
Re: Hi, can you show the controller that loads this view? | |
Re: Yep: http://talks.php.net/show/phplondon13/ To browse through the slides use the keyboard arrows. **Note** I suggest Firefox to browse them, Chrome seems to not work fine. | |
Re: Hi, can you explain it a bit more? If I've understood you want to redirect only certain urls basing on regular expressions, correct? Are these slugs (`now-when`, `an-other`) saved into a database? | |
Re: Something like this should work: <!DOCTYPE html> <html> <head> <title>Tabless</title> <style type="text/css"> *{margin:0;padding:0;} .table { display:table; margin:50px auto; width:960px; position:relative; } .tr { display:table-row; margin:10px 0; } .td { display:table-cell; height:30px; } .strong {font-weight:bold;} </style> </head> <body> <div class="table"> <ul class="tr strong"> <li class="td">TEXT</li> <li class="td">TEXT</li> <li class="td">TEXT</li> </ul> <ul … | |
Re: You can use a CSS to format the layout as you want, also read this article: * http://alistapart.com/article/goingtoprint/ it is a bit old but still useful. | |
Re: It seems your SSL domain is not well configured, if you browse to the root `https://nadim.org/` you get the default page. The `index.php` page is missing, the `new2` directory is missing as well. By the way, even switching from HTTPS to HTTP it does not work, you need to complete … | |
Re: Hi, It's normal because 0 equals to 01-01-1970 so, to get previous dates, you will receive negatives values. The problem is that, if you want to store it in MySQL, the `from_unixtimestamp()` function will not handle signed timestamps (i.e. negative values), if you want to display a *datetime* you will … | |
Re: Yes, it can be done. Inside the loop that generates this array place this code: if($loopCount == 1) { if(preg_match("/[0-9]{5}/", $myValue, $match) == 1) { $array_two[$arrayIndex]['zip'] = $match[0]; } else { $array_two[$arrayIndex]['zip'] = 0; } } Full example: foreach ($result as $myValue) { $loopCount = ($loopCount<5) ? $loopCount : 0; … | |
Re: I cannot test right now, but try: return 301 ^(.*)$ $1.php Note that `try_files` is important because it will check if the script exists and will avoid some security issues, for example if somebody uploads a text file `hell.txt` and submit a request like this: GET http://localhost/uploads/hell.txt/o.php If `o.php` does … | |
Re: Hi, have you considered the DateTime library? <?php #$dob = $_GET['dob']; $dob = '29-06-2009'; $at_day = '31-03-'.date('Y'); $dt_dob = new DateTime($dob); $dt_now = new DateTime($at_day); echo "<pre>"; print_r($dt_now->diff($dt_dob)); echo "</pre>"; Outputs: DateInterval Object ( [y] => 4 [m] => 9 [d] => 2 [h] => 0 [i] => 0 [s] … ![]() | |
Re: The loops seem to be fine, the error means that `$array_two` is served as a string not as an array. Check if there is an intermediate step that resets the variable. | |
Re: Add the `readonly` attribute: <input type="text" size="50px" name="page" value="<?php echo $page; ?>" readonly /> But remember that a client can always change the input, so if you do NOT expect changes, because for example you do not enable the editing through javascript, then you must ignore this field when you … | |
Re: Hi, use `dateadd()`: dateadd(hour, 1, candidat_rendezvous_date) * http://technet.microsoft.com/en-us/library/ms186819.aspx | |
Re: Hi, try to remove the white spaces between the addresses in the destination variables `$to` and `$to2`, so these: $to = "email@gmail.com, ".$reg_email; $to2 = "email@gmail.com, admin@xxxxxxx.com"; Should be: $to = "email@gmail.com,".$reg_email; $to2 = "email@gmail.com,admin@xxxxxxx.com"; | |
Re: Hi, this is probably caused by the `mysqli_fetch_array()` at line **16**, it will move the internal pointer to the following row, so the loop will display only the last four items. To include the first one remove line 16, i.e.: $card_data_result = mysqli_fetch_array($card_data); Otherwise simply use the variable: echo $card_data_result['build_name']; … | |
Re: I'm not sure I've understood your request. But if you open the above stylesheet you will see: @font-face { font-family: 'Patua One'; font-style: normal; font-weight: 400; src: local('Patua One'), local('PatuaOne-Regular'), url(http://themes.googleusercontent.com/static/fonts/patuaone/v4/yAXhog6uK3bd3OwBILv_SD8E0i7KZn-EPnyo3HZu7kw.woff) format('woff'); } You can paste the above in your stylesheet and remove the `link` to Google. Then if you … | |
Re: Set the **name** attribute to the input field, otherwise the POST array will not receive it and the if statement will fail. This: <input type="submit" value="Login"> Must be: <input type="submit" name="submit" value="Login"> | |
Re: Remove the semicolon preceding **extension** otherwise the line is considered a comment and remove also the double quotes, so: extension=php_com_dotnet.dll | |
Re: You can write: [icode]$name,$field1,$field2[/icode] without quotes. Bye :) | |
Re: > Or is it destined to default down to Arial a majority of the time (provided the user doesn't have Helvetica Neue or Helvetica installed on their machines)? Correct. But you can include a font from a remote server, check for example at Google Fonts: http://www.google.com/fonts | |
Re: Hi, show the query generated by your script, i.e.: print_r($qry); Then try to run the same query through a mysql client, from shell or by PHPMyAdmin. And add: $res = mysql_query($qry) or die(mysql_error()); To be sure it runs fine. | |
Re: Change it to: SET @date_start = DATE_FORMAT(STR_TO_DATE(@from_date,'%d/%m/%Y'), '%Y-%m-%d'); Full example: > SET @from_date = '29/11/2010'; SET @date_start = DATE_FORMAT(STR_TO_DATE(@from_date, '%d/%m/%Y'), '%Y-%m-%d'); show warnings; select @date_start; Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Empty set (0.00 sec) +-------------+ | @date_start | +-------------+ | 2010-11-29 … | |
Re: The problem is the scope of the function not the `include()`, a function will not consider an external variable unless this is global and you define it inside the function, for example: <?php include 'conn.php'; function q() { global $conn; $stmt = $conn->query("select * from users limit 1"); return $stmt->fetch(PDO::FETCH_ASSOC); … | |
Re: In addition check also this link: http://php.net/migration54 | |
Re: Try with [`imagettfbbox()`](http://php.net/manual/en/function.imagettfbbox.php) as suggested in this comment: * http://php.net/imagettftext#83248 Also, consider to use `mb_strtolower()` and `mb_convert_case()` instead of `strtolower()` and `ucwords()` because the latters will not work correctly with special characters. In your case just use: $name = mb_convert_case($Name, MB_CASE_TITLE, "UTF-8"); Reference: http://php.net/mb_convert_case Bye! | |
Re: You can use dompdf: http://code.google.com/p/dompdf/ Bye! | |
Re: Hi, It should not depend on CodeIgniter, this can relate to the system in which PHP is executed: in the case is not synchronized. Have you tried to display the date time from a CodeIgniter view? If you can, compare it with a simple script, for example: echo date('d-m-Y H:i:s'); … | |
Re: You can use the **Open Graph protocol**: * http://ogp.me/ For example: <html prefix="og: http://ogp.me/ns#"> <head> ... <meta property="og:title" content="Title of this page" /> <meta property="od:description" content="Once upon a time..." /> | |
Re: You're starting the class in `$chimp`, not in `$MailChimp`, so change this: $chimp = $MailChimp->call('lists/subscribe' To: $result = $chimp->call('lists/subscribe' | |
Re: You can use `attributes()`, for example: <?php $file = simplexml_load_file("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"); foreach($file as $key => $value) { echo "Time: ". $value->Cube->attributes()->time . "<br /><br />"; foreach($value->Cube->Cube as $key_1 => $value_1) { echo "Currency: ". $value_1->attributes()->currency . " Rate:". $value_1->attributes()->rate ."<br />"; } } | |
Re: Add the fourth parameter and it will cut the word: wordwrap($string, "80", "<br>", true); * http://php.net/wordwrap | |
Re: Mine is more an idea than a solution: you will probably need the position (in coordinates) inside the state, in order to evaluate the nearest border. For example, in MySQL, having the coordinates of each city, you can query and get the result for the cities in a defined range, … | |
![]() | Re: Hi! It seems to work fine form me, but this: $stmt->$mysqli->bind_param("s", $dbname); $stmt->$mysqli->execute(); should be: $stmt->bind_param("s", $dbname); $stmt->execute(); My example: $stmt = $mysqli->prepare("SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = ?"); $stmt->bind_param("s", $dbname); $stmt->execute(); print_r($stmt); $result = $stmt->get_result(); while($r = $result->fetch_array(MYSQLI_BOTH)) { echo $r[0]; } And outputs: mysqli_stmt Object ( [affected_rows] … ![]() |
Re: Use a **foreach** loop to get the keys and the values: foreach($array as $key => $value) { echo "$key has variable $value"; } You can also use `array_keys()` and `array_values()`, for example: $akeys = array_keys($array); $avalues = array_values($array); for($i = 0; $i < count($array); $i++) { echo "{$akeys[$i]} has variable … | |
Re: Hi, Your script is almost correct but the `session_start()` must be in the first line of the script. So, if for example you're doing everything in the same script, you can write it like this: <?php session_start(); $_SESSION['error'] = null; if (empty($_POST['emailid'])) { $emailid = "Please enter your email id"; … | |
Re: The pattern in the preg match is missing the dash `-`, it should be `[a-zA-Z0-9_-]`, so change the first to: '/(https|http):\/\/(.*?)\/([a-zA-Z0-9_-]{11})/i' And the second to: '/(https|http):\/\/(.*?)\/(embed\/|watch\?v=|(.*?)&v=|v\/|e\/|.+\/|watch.*v=|)([a-zA-Z0-9_-]{11})/i' Because in case of links as `$yt_url = "http://youtu.be/--9oAhOSwpg";` it will not work. | |
| |
Re: This: CASE WHEN minpart=0 THEN CAST(hourpart as nvarchar(200))+':00' ELSE CAST((hourpart-1) as nvarchar(200))+':'+ CAST(minpart as nvarchar(200))END as 'total time' is a statement, like `if-then-else`: * http://technet.microsoft.com/en-us/library/ms181765.aspx if the **minpart** (stands for minute) column value is `0` then **total time** will be `hourpart:00`, if instead the **minpart** is not zero, then the … | |
Re: **@matrixdevuk** be careful with this solution, because `strstr()` will check only for the first occurence of the searched pattern, so if I submit something like this: mydomain.net@evil.org it will pass this check. Docs: http://php.net/strstr | |
Re: Have you defined the variable in the method of the controller? For example: public function getPage($guid) { $data['guid'] = $guid; return View::make('page.form', $data); } | |
Re: Hi, you can do it on your own, read this: * http://httpd.apache.org/docs/2.2/ssl/ssl_faq.html It explains all the steps to create your own certificates and CA. | |
Re: In MySQL you can use a *fulltext search*. Create an index with `skill` column: alter table skills add fulltext skillindx(skill); then you can use queries like this: select * from skills where match(skill) against('mysql'); There are some limitations that can be bypassed if you properly configure the database server. The … | |
Re: I did not tested with Gmail but check the Mailparse library: * http://www.php.net/manual/en/book.mailparse.php | |
Re: If these titles are in database table then you could run an update query to remove them, for example if you have a table like this: CREATE TABLE `lyrics` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=myisam DEFAULT CHARSET=utf8; insert into lyrics … |
The End.