505 Posted Topics

Member Avatar for whiteyoh

If you want to store an object or array in a textual format, you should [URL="http://uk2.php.net/manual/en/function.serialize.php"]serialize[/URL] it before storing and [URL="http://uk2.php.net/manual/en/function.unserialize.php"]unserialize[/URL] it to reverse the process. It looks like what you have is an [URL="http://php.net/manual/en/function.var-export.php"]exported[/URL] array. I'm not aware of a way to import an array in that format, but …

Member Avatar for NettSite
0
117
Member Avatar for vaibhav1983

If you'd like access to MySQL, but don't want to use the command line, you could always install phpMyAdmin. If I recall correctly, it is available through Tasksel also. R.

Member Avatar for blocblue
0
78
Member Avatar for abhi10kumar

Have you tried Googling for your question? Here, [URL="http://lmgtfy.com/?q=redirect+www+to+without+www"]let me[/URL]. First result: [CODE]RewriteCond %{HTTP_HOST} ^www\.abc\.co.in$ [NC] RewriteRule ^(.*)$ http://abc.co.in/$1 [R=301,L][/CODE]

Member Avatar for blocblue
0
74
Member Avatar for bangla

I disagree. If the information is already in the public domain, e.g. in the Yellow Pages, then they have already consented to it being published. If you're talking about publishing someone's private information, then I would agree that approval is required first. If I were in doubt, I would assume …

Member Avatar for bangla
0
186
Member Avatar for ElliottDuke

I wasn't aware you could use && in SQL queries (see line 14). Change it to AND instead. Also, you say you searched the forum; the first post in this forum (at the top of the page tackles the same issue), and [URL="http://www.daniweb.com/forums/search.php?searchid=17731347"]searching for the exact title of your post[/URL] …

Member Avatar for ElliottDuke
0
282
Member Avatar for Nybuler

Can you post the code which validates and inserts the content into the database, and the code that retrieves and displays the content to the webpage? And I assume if the Chinese characters are displaying correctly in the database the tables and fields are using UTF-8 Unicode encoding, and the …

Member Avatar for diafol
0
173
Member Avatar for didi00
Member Avatar for Shantanu88d

[CODE=php] $words = 'Hello world hello world this is hello world'; $words = explode(' ', $words); $frequency = array(); foreach($words as $word) { $word = strtolower($word); if(isset($frequency[$word])) $frequency[$word] += 1; else $frequency[$word] = 1 } echo '<pre>'; print_r($words); echo '</pre>'; [/CODE]

Member Avatar for edwinhermann
0
3K
Member Avatar for geekme

I would expect the issue to be that you do not have Apache and PHP configured correctly. [URL="http://www.linuxforums.org/forum/servers/31190-how-find-out-mod_php5-installed-working.html"]Have you installed mod_php properly[/URL]?

Member Avatar for blocblue
0
175
Member Avatar for bangla

Just use the mysql_affected_rows function. [CODE=php] mysql_connect('host', $username, $password); @mysql_select_db($database) or die('Unable to select database'); $query = "INSERT INTO new VALUES ('$first','$last','$phone','$mobile','$fax','$email','$web')"; mysql_query($query); if(1 === mysql_affected_rows()) echo 'insert passed'; else echo 'insert failed'; mysql_close(); [/CODE]

Member Avatar for charlybones
0
92
Member Avatar for sainigks

You could always add all of the files to the include path, so that they're already loaded into memory. This is how a lot of frameworks operate. [CODE=php] set_include_path(implode(PATH_SEPARATOR, array( '/path/to/classes/directory', get_include_path(), )); [/CODE]

Member Avatar for blocblue
0
109
Member Avatar for iamthwee

I looked into using embedded fonts only last week. Using the @font-face declaration at the top of my stylesheet, the font displayed successfully in all major browsers, including IE6+. I abandoned the idea in the end, because the TTF file was rather large and substantially slowed the page loading. Still, …

Member Avatar for iamthwee
0
150
Member Avatar for Sorcher

Why not just work it out when querying the database? The following will check whether there is more than two minutes difference between the Date/Time value, `timed`, and the current time. If it is, the field `lapsed` will be set to 1. Otherwise it'll be 0. [CODE=php] $sql = "SELECT …

Member Avatar for Sorcher
0
185
Member Avatar for hawx

Is your JavaScript function wrapped in: [CODE=javascript] $(function() { // code goes here... }); [/CODE] or [CODE=javascript] (function() { // code goes here... })(); [/CODE]

Member Avatar for levanlong
0
130
Member Avatar for Besherek

I think you need to restructure your cart array: [CODE=php] <?php $_SESSION['cart'] = array(); // Add categories as keys, rather than values $category = 'Tops'; $_SESSION['cart'][$category][] = $productA; $category = 'Trousers'; $_SESSION['cart'][$category][] = $productB; // Loop through your cart foreach($cart as $category => $products): ?> <h2><?php echo $category; ?></h2> <?php …

Member Avatar for Besherek
0
178
Member Avatar for abhi10kumar

This is quite a basic tutorial to help you get started: [url]http://www.tizag.com/mysqlTutorial/mysqljoins.php[/url]

Member Avatar for blocblue
0
100
Member Avatar for abhi10kumar

I have found the [URL="http://phpexcel.codeplex.com/"]PHPExcel[/URL] library useful in the past.

Member Avatar for chrishea
0
48
Member Avatar for lemur

Make them float:left and float:right respectively, and display:inline, or add a fixed width if using display:block;

Member Avatar for blocblue
0
85
Member Avatar for bangla

This sounds like a HTML/CSS issue, rather than PHP. You might get a better response in the HTML/CSS forum. But as Twiss said, if you post your code, please can have a look. If you have a publicly accessible link, that could be helpful too.

Member Avatar for almostbob
0
221
Member Avatar for prem2

Try the [URL="http://php.net/manual/en/function.shell-exec.php"]shell_exec[/URL] function. But use it with caution. R.

Member Avatar for prem2
0
111
Member Avatar for klemme

Regular expressions can be tough to understand. Taking the example you've posted, there are a couple of mistakes: [CODE=php] if(preg_match("/^[a-z\d'\.\-]{2,20}$/i", $_POST['username'])) { // ... } [/CODE] Looking at the expression, you'll see that I have enclosed it in double quotes rather than single. This is to avoid issues with the …

Member Avatar for blocblue
0
161
Member Avatar for l0wr1d3r

From the gist of your post, it doesn't sound as though you know how to accomplish any part of your project whatsoever. Be that the case, are you not perhaps being overly ambitious? If I am wrong in my initial thoughts, perhaps you would care to outline what you have …

Member Avatar for chrishea
0
205
Member Avatar for Number1awa

Have you considered using a JavaScript framework, e.g. jQuery? Frameworks offer a lot of benefits, for one making AJAX requests far easier by handling cross browser compatibility issues, etc. Using jQuery, you could do the following: [CODE=php] <script type="text/javascript"> $(function() { $('div.clickable').click(function(event) { $.get('test.php', {id: $(this).attr('id')}, function(response) { $(this).text(response); //$(this).html(response); …

Member Avatar for diafol
0
121
Member Avatar for Misklahr

If you store the session details in your database, together with a timestamp for when the session was last updated, you could use this together with a cron to delete old files as required. R.

Member Avatar for Misklahr
0
387
Member Avatar for Manny7

If you add a datetime and status field to your table, you could modify your script to only display offers with a status of active. At midnight, retrieve all the new offers as you are now, but instead of deleting the existing offers, insert these new offers alongside them, but …

Member Avatar for blocblue
0
99
Member Avatar for programmer12

You could do something as simple as: [CODE=php] $date = date('Y-m-d', strtotime('3 days ago')); $sql = "SELECT * FROM `table` WHERE `date` >= '{$date}'"; // OR $date = date('Y-m-d', strtotime('7 days ago')); $sql = "SELECT * FROM `table` WHERE `date` >= '{$date}'"; [/CODE] R.

Member Avatar for Stefano Mtangoo
0
105
Member Avatar for toskers25

When I've needed to do this in the past, I always Google for something like: "Object to XML PHP" or "Array to XML PHP". This search yielded the following results: [URL="http://www.sean-barton.co.uk/2009/03/turning-an-array-or-object-into-xml-using-php/"]http://www.sean-barton.co.uk/2009/03/turning-an-array-or-object-into-xml-using-php/[/URL] [URL="http://stackoverflow.com/questions/137021/php-object-as-xml-document"]http://stackoverflow.com/questions/137021/php-object-as-xml-document[/URL]

Member Avatar for blocblue
0
9K
Member Avatar for danielsikes

I would use a combination of the two. You only need to see information about all of the themes when you want to choose the theme to use. If you therefore store the information about each theme within a file, the overhead to parse the files for this information will …

Member Avatar for blocblue
0
160
Member Avatar for kali Annan

We cannot help you unless you post the code and database tables you have written to achieve this so far.

Member Avatar for blocblue
-1
315
Member Avatar for ptara1

Hi, Create a table which stores the opening and closing time for each day of the week. Hence, if the store was open from 08:00 until 12:00 and then 13:00 until 18:00 on Monday through Friday, you could do: id day open close 1 Monday 08:00:00 12:00:00 2 Monday 13:00:00 …

Member Avatar for ptara1
0
395
Member Avatar for dineshsurve

The [URL="http://uk2.php.net/manual/en/function.mysql-query.php"]mysql_query[/URL] function returns false in the event of an error - usually as a result of an error with your query. Try echoing out the query and run it in phpmyadmin or on the command line to check it works. Alternatively, use the [URL="http://uk2.php.net/manual/en/function.mysql-error.php"]mysql_error[/URL] function to display the error. …

Member Avatar for vibhaJ
0
269
Member Avatar for johng123

You could just do something like: [CODE=mysql] UPDATE `tablename` SET `hyperlink` = CONCAT('<a href="', `url`, '" target="', `target`, '">', `showingtext`, '</a>') WHERE `hyperlink` IS NULL OR `hyperlink` = ''; [/CODE] But make sure you back up your tables first, just in case this doesn't do what you want. R.

Member Avatar for johng123
0
399
Member Avatar for oree

Here's an example: [url]http://www.plus2net.com/php_tutorial/ajax_drop_down_list.php[/url] R.

Member Avatar for oree
0
2K
Member Avatar for jakizak

Hi You could try something like the following in a .htaccess file. To work, this will require you to have the apache rewrite module installed and enabled. <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^user/(.*) profile.php?user=$1 </IfModule> This would then rewrite URLs like [url]http://example.com/user/username[/url] to [url]http://example.com/profile.php?user=username[/url] R.

Member Avatar for blocblue
0
356
Member Avatar for -==Zero==-

How about: [CODE=php] $categoryId = 22; $split = new page_split; $split->querystring = "id={$categoryId}"; // The call the other page_split functions afterwards... [/CODE] R.

Member Avatar for -==Zero==-
0
139
Member Avatar for stonybony

Without a form, you don't submit the input field value back to the server, so PHP cannot access the value. You could therefore: a) wrap it in a form and post to two.php, b) use JavaScript to get extract the value. Option A is the more reliable. R.

Member Avatar for stonybony
0
131
Member Avatar for nats01282

Hi, What you need to do is combine your queries into one. [CODE=php] $sql = "SELECT `accounts`.* FROM `accounts` INNER JOIN `friends` ON (`friends`.`uid` = `accounts`.`id`) ORDER BY `created` DESC"; $result = mysql_query($sql); if(0 < mysql_num_rows($result)) { while(($account = mysql_fetch_assoc($result))) { // Use the account information } } [/CODE] Without …

Member Avatar for blocblue
0
84
Member Avatar for ebanbury

[QUOTE=ebanbury;1521480]Hi [CODE]WHERE property_details.prop_price <= '$_POST[prop_pricemin]' AND property_details.prop_price >= '$_POST[prop_pricemax]'[/CODE] [/QUOTE] You have you min and max parameters in the wrong way around: [CODE=mysql]WHERE property_details.prop_price <= 'prop_pricemax' AND property_details.prop_price >= 'prop_pricemin'[/CODE] Also, remember to escape anything coming from the browser before using in your SQL queries to avoid SQL injection attacks. …

Member Avatar for ebanbury
0
104
Member Avatar for JimBobUKII

Hi, Firstly, and most importantly, you're not escaping parameters that come in over the URL before using them in an SQL query. That is a serious security risk. Secondly, are you checking that the user id is set in the session before use? Third, is your table called masterdb? And …

Member Avatar for happytogether
0
156
Member Avatar for tcollins412

Hi, Firstly, do you have to use JavaScript to submit the form? This isn't especially useful for users who do not have JS enabled. The problem I would think is because you have the element "markupcomplete" twice in your source code, on lines 24 and 25. It is possible that …

Member Avatar for varun931
0
285
Member Avatar for doctorphp

Hi, I would suggest that you use MySQL to work out the date intervals. More information can be found [URL="http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html#function_date-add"]here[/URL]. If you then amend the values of your select box to correspond to MySQL interval units, e.g. 1 DAYS, 2 DAYS, ..., 1 WEEKS, 2 WEEKS, 1 MONTHS, etc. You …

Member Avatar for diafol
0
1K
Member Avatar for floatingDivs

Hi, Why not use the latest stable release (3.0.5 I think) and then continue to upgrade the site as and when subsequent stable releases become available? R.

Member Avatar for blocblue
0
86
Member Avatar for blocblue

Hi everyone, As the thread title suggests, I am trying to think of the best way to maintain and synchronise local and remote databases. To explain this more clearly, I'll outline the scenario and my thoughts for tackling the problem. I have a website on a remote server, which obviously …

Member Avatar for blocblue
0
143
Member Avatar for RicardoE

Hi, I know this has been marked as solved, but I was intrigued by the concept. Could you not use a .htaccess file on your server to redirect the request for the image to an HTML, which outputs both a banner image, but also JavaScript, which changes the window location? …

Member Avatar for RicardoE
0
151
Member Avatar for dragostone
Member Avatar for maofree

Hi, I'm not aware of the ability to [I]pass[/I] a variable from PHP to XML. One option to consider is to use PHP to generate the XML file. This would involve setting the correct content type headers so that when the PHP script is called, the resulting output is served …

Member Avatar for maofree
0
338
Member Avatar for weekendrockstar

Hi, I can see your problem. One option would be to do something like: [CODE=php] $id = (int)$_REQUEST['id']; $nextSql = "SELECT * FROM articles WHERE id > {$id} ORDER BY id ASC LIMIT 1"; $prevSql = "SELECT * FROM articles WHERE id < {$id} ORDER BY id DESC LIMIT 1"; …

Member Avatar for blocblue
0
90
Member Avatar for itisnot_me

Hi, A regular expression would be able to offer a suitable solution here. For example: [CODE=php] // This should find all numbers and store them in the array $matches preg_match_all('/^blah:(\d+)$/', $pageContent, $matches); [/CODE] [CODE=php] // This will replace all blah:number with the value of $pageName preg_replace('/^blah:(\d+)&/', $pageName, $pageContent); [/CODE] If …

Member Avatar for nicksontinko
0
115
Member Avatar for amit.hak50
Member Avatar for Xtremefaith

Hi, If you're balance is already cumulative, why do you need to sum it up again? Could you not simply increment it but the desired amount each time? E.g. [CODE=mysql] -- Start balance is 0 UPDATE vendors SET balance = balance + 200 WHERE Code = 'ERL'; -- Balance is …

Member Avatar for Xtremefaith
0
288

The End.