martin5211 37 Posting Whiz in Training

How could you compete against a company with 1600 employees and 100 million users (myspace). What are you, lost your mind?

Will Gresham commented: Fairly pointless bumping a almost 3 year old thread... +0
martin5211 37 Posting Whiz in Training

with a jQuery toggle() event you can switch the css display properties easily, to hide/unhide divs, or use an accordion type, with nice effects.

So, you can make the three views on PHP, each of them enclosed on a single div, then use of unobtrusive javascript to generate an accordion view:

http://docs.jquery.com/UI/Accordion

Naaptol uses tabs for views, easy achievable with jQuery too:

http://docs.jquery.com/UI/Tabs

martin5211 37 Posting Whiz in Training

I'm on mac platform, I liked TextMate, then Coda and now Espresso, it's very organized and fast for small websites. I tried PHP Eclipse but it's slow to deploy, configure a project.
I tried Aptana too, doesn't work very well on my mac, Aptana works on Windows.
An equivalent of Coda on Windows could be PHP Designer .

martin5211 37 Posting Whiz in Training

Notepad or TextEdit, faster, drag&drop of text, really easy to use.

martin5211 37 Posting Whiz in Training

I'm looking at your code, the method used in your form and mysql variables is ok, but into the form code, the survey code is commented into <!-- ... --> tags, remove it.

Add value="<?php echo $_GET['center']?>" into the input tags, should be something like:

<input type="text" maxlength="2" size="3" name="center" value="<?php echo $_GET['center']?>" />-<input type="text" name="custID" maxlength="5" size="10" value="<?php echo $_GET['custID']?>" />

Now, you can use /pre_venture.php?center=10&custID=1 in your link

If you want to hide that input elements, use this instead of above code:

<input type="hidden" name="center" value="<?php echo $_GET['center']?>" />
<input type="hidden" name="custID" value="<?php echo $_GET['custID']?>" />

On the PHP submission code, you use only $_POST instead of $_POST['center'] on the first value. Is that ok?

JRSofty commented: Good post. You could have also mentioned the use of the $_REQUEST since she is mixing both $_POST and $_GET usage in her page. +2
martin5211 37 Posting Whiz in Training

Try $_GET instead of $_POST to get parameters every time you use URL method.

Also, try to remove the single quotes on the SQL query. Use it on the array index.

$sql= sprintf("INSERT INTO pre_vent (center, custID, yStart, yAcquired, yOther, comments)
VALUES
('%s','%s', ... )", 
   mysql_real_escape_string($_GET['center']),
   mysql_real_escape_string($_GET['custID']),
... );
martin5211 37 Posting Whiz in Training

I wrote a solution on your previous thread (http://www.daniweb.com/forums/thread186448.html)... this is almost a duplicated one. Why not to continue to develop your issue into your previous thread ?

martin5211 37 Posting Whiz in Training

Hi,

I'm returning to this forum from long time ago... Looking at this issue it isn't difficult at all... just dealing a bit with regular expressions, preg_match_all() should be the function that is worth to use e.g.
to store all links into an array:

$pattern = "/href=\x22([^\x22]*)\x22/";
preg_match_all($pattern, $string, $links);

Then, would be cool to take away javascript stuff from links, populating a new array e.g.

foreach($links[1] as $link){
	if(strpos($link, "javascript") === FALSE){
		$filtered_links[] = $link;
	}	
}

Little tuning would be necessary on the search pattern to extract the names on another array and use of mysql_query() to insert the arrays into a database.

martin5211 37 Posting Whiz in Training

Yeap, two records isn't bigger than one. Maybe, if we talk about ten thousand rows, the maintenance task could take less time. But, my point is more focused on web usability, what is obvious. We can see the "quick reply" feature more as decorative widget by now.

martin5211 37 Posting Whiz in Training

Also, this modification can be useful adding an argument to the ms-dos, avoiding copy&paste each file name:

@echo off
echo -
php -l %1
echo -------
pause
martin5211 37 Posting Whiz in Training

Use a INNER JOIN statement in your SQL query, placing it before WHERE . You may be able to link a common ID field between the two tables and show a result into one set.

martin5211 37 Posting Whiz in Training

I'm using the php executable from Terminal to load the php-gtk code (located in /usr/local/php-gtk in my Mac OS 10.5 after installing this DMG package).

Before compiling the code you can perform php -l code_example.php to check for syntax errors (maybe, we can do it automatically from the editor assigning a macro or menu function). In Windows should work exactly as described here, also it's possible to perform and interpret the code, showing errors and output messages on the MS-DOS prompt using directly php code_example.php alone without -l parameter.

martin5211 37 Posting Whiz in Training

I've fixed your code:

<?php 

if (!class_exists('gtk')) {
    die("Please load the php-gtk2 module in your php.ini\r\n");
}

function pressed()
{
    echo "Hello again - The button was pressed!\n";
}

function pressed2()
{
    echo "Hello again - The button was pressed!\n";
}

 
$window = new GtkWindow();

$window->resize(800,600);
$window->set_title('My Diary');
$window->connect_simple('destroy', array('Gtk', 'main_quit'));


$button1 = new GtkButton('Jan');
$button1->connect_simple('clicked', 'pressed');
$button1parrent = new GtkAlignment(0, 0, 0.01, 0.01);
$button1parrent->add($button1);



$button2 = new GtkButton('February');
$button2->connect_simple('clicked', 'pressed2');
$button2parrent = new GtkAlignment(0, 0, 0.01, 0.01);
$button2parrent->add($button2);


$buttonbox = new GtkVButtonBox();    // or GtkHButtonBox for horizontal placement
$buttonbox->add($button1parrent);
$buttonbox->add($button2parrent);


$window->add($buttonbox);

$window->show_all();
//$window->set_resizable(false);
Gtk::main();
 

?>

I'm learning php-gtk too :) It seems like is mandatory to enclose UI elements into boxes before adding to GtkWindow.

I recommend to read this serie of tutorials:

http://gtk.php.net/manual/en/tutorials.packing.php

martin5211 37 Posting Whiz in Training

That's weird, the question is from which address was downloaded the PHP Developer Tools. There is a version from Zend based on the latest Eclipse 3.4 that could work. Try this:

http://www.zend.com/en/community/pdt

martin5211 37 Posting Whiz in Training

We assume I am not replying to myself but it is better don't complicate things :)

Edit has a expiring time, if you want to add something, think about double or triple posting

Updating instead of creating on this case would be less disk space on servers.

martin5211 37 Posting Whiz in Training

Ten million. Wow! Now this man will get a great compensation to continue getting drunk :) This is best than play a lottery. Find a bug on a US legal system.

martin5211 37 Posting Whiz in Training

Oh... it isn't a stupid thing... Most of strange issues pass through a minimal mistakes like a comma, a quote or writing a location. It's very common for me :)

martin5211 37 Posting Whiz in Training

First of all is more comfortable and transparent to use quick reply feature. Also, the subscribed member will not receive a notice if I made a change.

I learned from now that this forum doesn't suport double-posts merge, like any other user, but for new users always will remain present this issue. The Quick Reply would be useless for some purposes.

martin5211 37 Posting Whiz in Training

That is to say Edit can replace what I'm saying but there is another issue (using edit), if I make edit (not correcting a speech error or code tags, but adding more content) and the other user responds at that moment my new content will be remain above and supposedly answered but it isn't, also the user will not be notified.

I think you're saying that if someone double-posts, the two posts get merged together into one.

That's what I trying to say. Thanks. :)

martin5211 37 Posting Whiz in Training

Would be necessary to check the last post (same user) then update the last message, some modifications on the core.

martin5211 37 Posting Whiz in Training

I'm not talking about edit, but concatenate this post above if anyone doesn't make a reply in this precise moment.

martin5211 37 Posting Whiz in Training

It's a feature that I've seen on other forums, like PsicoFXP (a spanish one) based too on vBulletin. A conversation could be sliced in two parts if anyone reply on that moment, but I think this option adds a more coherent and straightforward communication

martin5211 37 Posting Whiz in Training

I don't know if it's a feature already present for vBulletin, I meaning concatenate only if I made a recent post. If another user make a post, my post will be placed below from that user.

martin5211 37 Posting Whiz in Training

Pinky and The Brain try to take over the world. Hope not by God's wish.

martin5211 37 Posting Whiz in Training

Recently I've seen a small issue when I submitted a new post, I was the last person on the thread, I think the new message should be added to the end of my last post instead of creating a new separated box with avatar/stats.

With this feature I think the site will be more clear and easy to use avoiding these mistakes.

martin5211 37 Posting Whiz in Training

Another possibiliy is the ending slash from your base url is too much.

martin5211 37 Posting Whiz in Training

Try to remove the leading slash on the code that generates the link.

martin5211 37 Posting Whiz in Training

There is a little mistake, on your code you're using a comparing operator (double equal signs) instead of assignation (one equal sign). Try with this example:

<?php 

$a = 20;
$a = $a + (-10);

echo $a;

?>

It's the same:

<?php 

$a = 20;
$a += (-10);

echo $a;

?>
martin5211 37 Posting Whiz in Training

Session variables are generated on runtime by the interpreters, so, I think you will get always a different session regardless of it's PHP or Java. Anyway, if you want to pass a Java variable to PHP it's possible through a simple url query when the php script is loaded.

martin5211 37 Posting Whiz in Training

I don't undertand the meaning of your question... Why not to use an incrementing/decrementing operators (e.g. $updown--) or assignment operator. The values inside the braces doesn't contain an assignment operator, so doesn't change their value when the condition is true.

martin5211 37 Posting Whiz in Training

tea, reach, care

ultrarevolutionary

martin5211 37 Posting Whiz in Training

Always enclose PHP stuff into a PHP block. The code should be: <a href="action.php?id=<?php echo $num; ?>">Text to be displayed</a> or in this case printing a variable content: <a href="action.php?id=<?=$num?>">Text to be displayed</a> Ops. Scru and me the same response. You can use the last example too.

martin5211 37 Posting Whiz in Training

ant, anti, establish, disestablish, men, arian, bliss, mental, base

and we could add the word "mentat" from Dune too :-)

Sternocleidomastoid

martin5211 37 Posting Whiz in Training

A forum differs slightly from a custom CMS or a social networking site. The threads and posts can be viewed like the news on a backend. The most important points to get focus are: 1) the ACL or authentication part taking into account the moderators and users, as well as registration and ban process. 2) URL Rewriting, convert thread titles to SEO ones. 3) A parser to interpret BBCode tags on the input. Also the input window can be ornamented with Javascript or using a WYSIWIG editor like FCKeditor or TinyMCE with disabled features to make it very similar to vBulletin editor showed on this site.

For learning purposes (I like pretty much phpBB but seems very entangled) I suggest to start with SMF forum from simplemachines, it's free and open source too. The code, in special about polling features are very clear.

martin5211 37 Posting Whiz in Training

That isn't the American Dream ?? ;-)

I mean, people can get a bit shabby sometimes, but this... is one for the books. It's weird that neighbours didn't perceive the bad smell from this apartment by no means the regular visits of the delivery guy... Take a look at the space key on the computer cleaned tactfully :-)

Very funny.

martin5211 37 Posting Whiz in Training

PHP.net the best reference :-)

Regards

martin5211 37 Posting Whiz in Training

Facebook and another community sites achieves this optimal capacities performing an image scale reduction and using lossless formats like JPEG for every photo uploaded. Data storage can be a concern on higher web sites, I think CPU usage should be another factor to be considered. You can make a heavy amount of CPU load killing the server resources trying to recompress files that already uses a compression on their data. Also, Lempel-Ziv (.gz .zip) compression will give bigger files as a result (if you're using JPEG images).

The GD library would give the essential functions to do image processing like format conversion and reducing images to the maximum visible dimensions into the website template.

digital-ether commented: great answer +6
martin5211 37 Posting Whiz in Training

I think clone is only used to clone object references on PHP 5. For some reason $refToString contained a string or null value result, that's why PHP indicated that error.

martin5211 37 Posting Whiz in Training

Radhika, the problem can be resolved very easy step by step, would be necessary first to make an explode(), separating words using a space delimiter. The result will be an array with each index followed by a word.
Now, inside the function, the for loop will iterate the passed argument (desired words quantity). On each iteration, concatenate a variable passing each array element using as key the variable used into the for loop. Note: Add a space if it's necessary too between each concatenation. Also, due to the array start with zero value, the first passed argument should be decreased once.
After the loop, you will have a variable only with some words passed, you can finally apply strlen() to count the elements.

Good luck :-)

martin5211 37 Posting Whiz in Training

I've added the source at code snippets, using HTML message format at this time.

martin5211 37 Posting Whiz in Training

To generate a PDF into PHP, there are two techniques: PDFLib or FPDF. PDFLib has some restrictions on licencing (commercial applications), I encourage to use FPDF because is free and Open Source, although PDFLib is rough and more complete (use your criterion). At http://fpdf.org there are a place to download the class and good tutorials. Use $_GET or $_POST variables to get the form data depending the form method.

To send the email, mail() function or PHPMailer are commons methods to perform these assignments. Please take care to encode the attachment and the headers, set multipart content type first, then the proper content type and encoding in each part, we could send plain or html text and multiple attachments too.

In this example I've used FPDF and mail() techniques. I don't know if it is better move this code to snippets section.

<?php
// download fpdf class (http://fpdf.org)
require("fpdf153/fpdf.php");

// fpdf object
$pdf=new FPDF();

// generate a simple PDF (for more info, see http://fpdf.org/en/tutorial/)
$pdf->AddPage();
$pdf->SetFont("Arial","B",14);
$pdf->Cell(40,10, "this is a pdf example");

// email stuff
$to = "target@domain.com"; 
$from = "me@domain.com"; 
$subject = "send email with pdf attachment"; 
$message = "Please see the attachment.";

// a random hash will be necessary to send mixed content
$separator = md5(time());

// carriage return type (we use PHP end of line constant)
$eol = PHP_EOL;

// attachment name
$filename = "example.pdf";

// encode data (put attachment in proper format)
$pdfdoc = $pdf->Output("", "S");
$attachment = …
nav33n commented: good post! +8
Roebuc commented: FPDF is perfect, thanks! +1
martin5211 37 Posting Whiz in Training

Submerge a slice of lactal bread into whipped eggs, then brown it with plentiful oil and add salt to taste. A delicious !

martin5211 37 Posting Whiz in Training

- Once you're in heaven, do you get stuck wearing the clothes you were
buried in for eternity?

Maybe, the clothes could be meaningless. We can keep an anthropormophic state or not.

martin5211 37 Posting Whiz in Training

Is that really a utf-8 string ? Seems text garbled, or text encoded differently. To deal with utf-8 content we can use utf8_encode() / utf8_decode() functions.

martin5211 37 Posting Whiz in Training

Touch screen and multi touch UI have some implications / some guidelines you want to follow. Size of buttons (enough to be pushed with a finger), also consider the free space between each elements to avoid accidents e.g. two buttons pressed at the same time. Someone has suggested an effective navigation too, preferably locating a group of buttons into one region, making the UI usability very similar to PDA, mobile phones or kiosks.

martin5211 37 Posting Whiz in Training

Yes, we can create a session variable with $this->Session->write("var_name", "value") and then read it with $this->Session->read("var_name").

A global function (maybe into /app/app_controller.php) to check if the session variable exists and redirect to the Login controller would be almost mandatory. Then into the Login controller we'll need two functions, one to perform a variable comparison with the database and redirect to the main controller / admin panel, and the second function to logout (destroy the session variable using $this->Session->delete("var_name")).

In http://bakery.cakephp.org you will find a lot of tutorials, like obAuth Authentication, you can use it completely or as reference.

Good luck!

martin5211 37 Posting Whiz in Training

Yes, you have two ways to achieve this. 1) Using server-side query with Ajax+PHP or Pure PHP, clicking on a table header cell will reassemble the query again changing ORDER BY. 2) Utilizing a jQuery plugin, there's a very good one, made by Christian Bach (tablesorter).

martin5211 37 Posting Whiz in Training

To show the origin country, a general way is to lookup into a MySQL database with updated IP country ranges, GeoLite Free is a choice. Some commercial databases provide location even into cities. After this, you can use the country code to get their corresponding flag.

To get WHOIS information there are several PHP classes that perform this function.

User agent and Referral URL is easy obtainable through $_SERVER environment variable. Deviating server load to client processing using Javascript to perform this tasks -like in your code- is always better.

martin5211 37 Posting Whiz in Training

Try to debug the code.

Use print_r() to display the variable content before inserting it.

If you are getting some blank values only... common mistakes are an incorrect name of a variable or a source empty.

Use always escaping with single quotes on SQL queries (several times I've applied typographic quotes using cut&paste).

The best is to review the code involved, otherwise, would be most likely that we will be unhelpful on this subject.

martin5211 37 Posting Whiz in Training

the level for my right hand: Very High (140) and High (107) for my left hand... I feel more caffeinated after this exercise.