Stefano Mtangoo 455 Senior Poster

Code Igniter is great, check it out here, http://codeigniter.com

+1 for CI
Simple, loose MVC, fine docs et al

Stefano Mtangoo 455 Senior Poster

AFAIK, passing pointer to class member function need you specify class Name also, i.e

typedef void ( FooClass::*pointerToDoubleTakingFunction ) ( double& );

See this link for more info

Stefano Mtangoo 455 Senior Poster

try this

//integer.h
int x;
int y;
//main.cpp
#include integer.h
#include integer.h
#include <iostream>

int main(){
x=10;
y=11;
std::cout<<x<<" "<<y<<std::endl;
    return 0;
}
Stefano Mtangoo 455 Senior Poster

Man you have PhD in complaining :scared:
why don't you use libraries like JQuery if you do alot of JS?

Have you seen typos in your code? what is dueditorvalue

function getval()
{
	var Editor1 = FCKeditorAPI.GetInstance('editor1') ;
	var editor1value=Editor1.GetHTML( );
	document.getElementById("editor2").value= editor1value ;//assigning value to second editor - this line is not working 
}
Stefano Mtangoo 455 Senior Poster

Check the

OnClick="MyFunction()";

and inside the function open popup with editor

function MyFunction(){
    window.open('url_to_fckeditor_file.php');
}

see here for more

Stefano Mtangoo 455 Senior Poster

Here here Ev. I hate it when people do the work for some lazy-a*. No wonder we get so many fly-by and gimme-gimme posters. I used to enjoy posting here, now it's turned into Kindergarten. Grumble, grumble...

That turns many off, and yes I cannot see a lot of PHP company here. I think Mods have to do something and nail a thread that says If you are lazy enough to escape assignments, don't even register

Stefano Mtangoo 455 Senior Poster

I will throw my 2 cents on this.
1. raw_input() returns string eve if keyboard stroke was of integer.
2.To change things into integer use int() function.
3. if..elif...elif...elif..else gives you branching according to condition

Stefano Mtangoo 455 Senior Poster

I have just started in C + + and I had this program to do: Write a program that inputs two (2) numbers and determines which of the two numbers is the smallest. If the numbers are equal, display a message that they are equal.

error C2447: '{' : missing function header (old-style formal list?)

Here is the program:

#include <iostream>

{

//add function definitions for input and output

int myNumber = 7;

if (myNumber > 4); 
     cout << “A true statement” << endl;
     cout << myNumber << “ is greater than five” << endl;

     if (myNumber == 7); 
          cout << myNumber << “ is a great number.”;
          cout << “It can be divided by 3 or 2 evenly!”;


else 
     cout << “A false statement” << endl;
     cout << myNumber << “ is less than five” 


<< endl;
} 

end quote.

Don't hijack threads. kindly open yours

Stefano Mtangoo 455 Senior Poster

make line 7

float FahrenheitToCelsius( float );

Nope!
It is line 5.

Your signature of function says it takes no argument, and then you use it on line 19 with one argument passed to it and hence the error

Stefano Mtangoo 455 Senior Poster

Sam,
dividing integers truncates the decimal part, one or both of them should be float/double depending on precision of data.

int a, b, sum;//all are ints so the decimal part is truncated
a=10;
b=3;
sum=a/b; //gives 3, truncates the repeating decimal

int c;
double d;
double sum2;
c=10;
d=3.0;
sum2 = c/d; // gives 3.33333.........

double x, y, z;
x=10.0;
y=3.0;
z=x/y; //gives same 3.3333333333..............
Stefano Mtangoo 455 Senior Poster
<?php

$birdies = array('birdie1', 'birdie2', 'birdie3', 'berdie4', 'berdie5', 'berdie6', 'berdie7');

for ($i = 0; $i < 3; $i++) {
    echo $birdies[$i] . "<br />";
}

What do you mean?

nevvermind,
don't do assignment for them,
it goes against very purpose of DW, that is to help people and not to cheat professors :)

Stefano Mtangoo 455 Senior Poster

Ok, I have to do an assignment for cass. The teacher wants us to use a FOR loop to print out only first three variables stored in an array called $birds. How do I use a FOR loop to print out only those first three? And furthermore, how would I use it to print out a specific value in the array that is not in sequence with the rest?

Do your part, man!
You have google and such resources as book. I cannot imagine you cannot get even for loop explanation. That is called laziness. Next time try yourself and when you hit a wall, then ask. We do not do assignments for students

Stefano Mtangoo 455 Senior Poster

what are you trying to do?
Please explain what that pie of cake is

Stefano Mtangoo 455 Senior Poster

Thank you man.. yes Im starting it.

Welcome and Mark it solved ;)

Stefano Mtangoo 455 Senior Poster

Thank you for your time.

Welcome :)


Please post your taught on uploadify methods and server credentials

Me? I own no server, no!
Best advice I will give you is start with what you have and expand as needed. Only you need to make files uploaded available for a given period of time before crone scheduled script erases the off!

Stefano Mtangoo 455 Senior Poster

If you face specific problem in your learning just file a thread. I think you should close this for now, if you think "all is over" about this thread ;)

Stefano Mtangoo 455 Senior Poster

I think much of changes will be on server capabilities as well as bandwidth enough to cover the intended customers

Stefano Mtangoo 455 Senior Poster

If you want to know if it is server issue or not try to make PHP file and access it on Url and in the PHP file put just the simple code below

<?php phpinfo();?>
Stefano Mtangoo 455 Senior Poster

Go for PHPBB3. AFAICS, it comes close to VBulletin if you customize it enough!

Stefano Mtangoo 455 Senior Poster

pricing.htm

<div id="para">

<form method="post" action="pricing.php">

<textarea name="pages" value="" rows="1" cols="5"/>
</textarea>

Pictures<input type="radio" name="pictures" value="50">
<input type="radio" name="pictures" value="25" checked>
<input type="radio" name="pictures" value="0"><br>

Literature<input type="radio" name="literatures" value="100">
<input type="radio" name="literatures" value="50" checked>
<input type="radio" name="literatures" value="0"><br>
<br>


Pictures<input type="checkbox" name="picture value="50" ><br>
Page<input type="checkbox" name="literature" value="50" ><br>
Contact Form<input type="checkbox" name="contact" value="100" ><br>

<input type="submit" name="go" value="Calculate" />
</form>

</div>

pricing.php

<html>
<body>

 
<?php

$pages=$_REQUEST['pages'];
$pictures=$_REQUEST['pictures'];
$literatures=$_REQUEST['literatures'];
$picture=$_REQUEST['picture'];
$literature=$_REQUEST['literature'];
$contact=$_REQUEST['contact'];
$total=($pages*$pictures)+($pages*$picture)+($pages*$literatures)+
             ($pages*$literature)+$contact;

echo $total;
?>

</body>

</html>

I hasn't worked at all I even tried to echo $pages and it still doesn't work.

It si good to RTM,
that being said it is not recommended to use request as it will pick contents of $_POST, $_GET, $_COOKIE. So be explicit to avoid problems. So just use $_POST/GET
Post being recommended! See Manual

Stefano Mtangoo 455 Senior Poster

If it doesn't support something and you *must* do it that way, get another IDE temporarily or for good

Stefano Mtangoo 455 Senior Poster

Karibu Daniweb (Welcome to Daniweb)
Since your odyssey is just starting and taking account of your background, PHP code won't make much sense if any at all. I advice you do crash course with PHP and MySQL. you have two "colleges" to learn that. Either Tizag or w3School. After that, you will see how easy that task is becoming :)

Stefano Mtangoo 455 Senior Poster

you do it wrong!

$id = 020303;
$query = "INSERT INTO parent (id, parent_name) VALUES ('$id','$parent_name')"; 
			
$result = mysql_query($query) or  die(mysql_error());  
 
session_start();
$_SESSION['id']=$id;
Stefano Mtangoo 455 Senior Poster

I wonder you want to make a clone of site you haven't reasearched.
Just do you homework and come up with conclusion; either to code yours or use CMS
Check open source CMSes here

Stefano Mtangoo 455 Senior Poster

Darkagn, do I miss something here.
I think you forgot else clause. I stand to be corrected though.
I think if you call the function twice it wont return anything as the MYSQLDB::instance will not be null. Also in C++ you must Delete the instance once used but I think PHP does that for you.

public static function getInstance()
  {
    // this code ensures there is only ever at most one instance of this class
    if (instance == null){
        instance = new MYSQLDB();
		return instance;
	}
	else{
		return instance;
	}
  }
Stefano Mtangoo 455 Senior Poster

Hosted on an external server? I am using WAMP which means my server is my computer. So, does it mean that i can actually run my php-mysql script in my machine without internet connection? thank you!

The meaning is, if all the pages and resources (like images et al) are found in local server then you can use it with no internet connection at all. Otherwise you need internet connection

Stefano Mtangoo 455 Senior Poster

Hi,
Use JQuery auto complete.
Just get yourself familiar with JQuery and look at autocomplete from JQuery UI

Stefano Mtangoo 455 Senior Poster

It is hard to help with such massive codes.my advice is, make small code based on your above code, and poke with it until it works then incorporate the idea in your big project.

I will help if you reduce to something readable :)

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

hi,

one final thing on this, is sha1 the best form of encrypting/hashing passwords other than paying for an ssl certificate?

Have you heard of salting?
MD5/SHA1 with salting should be okay. In many cases people just use MD5 hashing algorithm

Stefano Mtangoo 455 Senior Poster

here's the sample output:

Storename:
Sales
Date - -


Saving Successful
Action Storename Sales Date
Delete slap1 123123.00 8-8-2010
Delete slap2 2123123.00 8-8-2010
Delete slap3 123142.00 8-8-2010

when delete is selected:

Saving Successful
Action Storename Sales Date
Delete slap1 123123.00 8-8-2010
Delete slap2 2123123.00 8-8-2010
Delete 000000.00 0-0-0

the values are deleted but the table still remains

mysql_query("DROP TABLE table_name");
Stefano Mtangoo 455 Senior Poster

If that advice is good then stop what you are doing :)
Here are good resources but RTM is important!
1. Get acquainted with TCP/IP and sockets in general
2. Get the basics of QT after C++ of course!

Grab QT Book and get head up with the QT Network tutorial. Also QT site have got examples. Please surf through developer section

Stop trying to walk before crawl ;)

Stefano Mtangoo 455 Senior Poster

why using Windows thing in QT, I mean QT is designed to be Xplatform and using windoish stuffs limits the very purpose. If you plan to use it in windows then go for Win32 API, or stay away from windowing and do it QT way :)

Having said so, I suggest Zetcode QT tutorial as one of Good start

Stefano Mtangoo 455 Senior Poster

Why not send link to your user for changing password? The feature is very useful

Stefano Mtangoo 455 Senior Poster

Start by building a while loop that counts up to the entered number. Once you figure that part out, and post your effort, we'll be able to help you more.

I agree, and I suggest you skim through this tutorial to get you head up

Stefano Mtangoo 455 Senior Poster

Just store the words in a std::vector<std::string> and then output the appropriate word with std::cout << words[i]; . You could alternatively use a switch statement.

In the future, please use more descriptive thread titles!

David

I agree with you Dave, but since he said is newbie I think he should start with std::string array[] before moving to STL

Stefano Mtangoo 455 Senior Poster

Your initial statement / request is almost as unrealistic as:
"I am a PHP programmer. I need to build a bridge. I don't have the time to learn all about civil engineering. Just tell me the most common design approaches for building a bridge so I can get on with it."

Nail on head. If you don't know it and you want to use it but you don't wan't to learn it, then you can't do it. I will suggest that you hire someone with time to do it and you pay him/her for that time.

Sorry but that person can't be me, I have no time ;)

Stefano Mtangoo 455 Senior Poster

the code remove the values of my table but my prob now is i dont know how to remove the table (the <tr> and <td>) when i select delete

What do you mean by that?

Stefano Mtangoo 455 Senior Poster

@ Huakalero i want to delete a table and the values on it

Just use Drop Table Sql statement. Dropping table destroys data therein too

Stefano Mtangoo 455 Senior Poster

Now I suspect something is wrong with your if..else
Here is my suggestion:
add the files in the comments below

if($flag=="1"){
    //paste code of first file
}
else{
    //paste code for second file
}

Paste two files differently if you will still face errors

Stefano Mtangoo 455 Senior Poster

PHP.Net Have all you have asked for

Stefano Mtangoo 455 Senior Poster

How do I specify which record/primary key is to update?

One note, when updating primary key, it MUST be Unique. I hope you know that but just reinforcing in case you don't know

Stefano Mtangoo 455 Senior Poster

Now if that is the case I will advice you to make different actions for delete and add files. That is, make one action on form to add_data.php and another action to delete_data.php

Stefano Mtangoo 455 Senior Poster

BTW that code is for PHP 5.x so if you work with PHP 4 it will need slight modification :)

Stefano Mtangoo 455 Senior Poster

i tried those but still i have error., i also tried my new code but everytime i select delete, it adds one more table, how come? here's my code:

<?php

    $username = "root";
    $password = "123456";    
    $hostname = "localhost";
    $db = mysql_connect($hostname, $username, $password)
    or die ("Unable to connect to mySQL".mysql_error());
    mysql_select_db('mynewdbase');

    $flag = $_GET['flag'];                        

if($flag==1)                                        
{
$id = $_GET['id'];
$del = "DELETE FROM newdbase WHERE id = '$id'";
$nres = mysql_query($del);


if(!$nres)                                                    
echo " Failed to delete:" . mysql_error();
else
echo " Deleting successful";
}
?>

<HTML>
<BODY>
<form method = "get" action = "act1.php">
Storename:<input type = "text" name = "store"><br>
Sales <input type = "text" name = "sales"><br>
Date  <input type = "text" name = "year" size = "3" value = "<?php echo date('Y'); ?>">
-<input type = "text" name = "month" size = "3" value = "<?php echo date('m'); ?>">
-<input type = "text" name = "day" size = "3" value = "<?php echo date('d'); ?>"><br>
<input type = "submit" name = "submit" value = "Save">
<input type = "reset" name = "clear" value = "Cancel">
</form>
</BODY>
</HTML>

<?php

    $store = $_GET['store'];
    $sales = $_GET['sales'];
    $year = $_GET['year'];
    $month = $_GET['month'];
    $day = $_GET['day'];

$ans = "INSERT INTO newdbase VALUES ('','$store', '$sales', '$year' ,'$month', '$day')";

    $result = mysql_query($ans);

    if($result!='')                                     
    echo '<br>Saving Successful';
    else
    echo '<br>Failed'. mysql_error();

$queryshow = "SELECT * FROM newdbase";
$result2 = mysql_query($queryshow);
$c = count($result2);
echo '<table border ="1">';
echo '<th>Action</th><th>Storename</th><th>Sales</th><th>Date</th>';
if ($c>0)
    {
    while ($a=mysql_fetch_array($result2))
        {
            echo '<tr>';
            echo '<td><a href = …
Stefano Mtangoo 455 Senior Poster

Here is summary of what happens.
Client (mostly web browser) sends HTTP request to the server. The server processes the request with right file and then returns a response in terms of HTML or JSON et al.
So the Client doesn't know about server code and server about client. They only know of requests and response

see:
http://en.wikipedia.org/wiki/Server-side_scripting
http://www.killerphp.com/videos/serverside_programming_languages/serverside_programming_languages.html

Stefano Mtangoo 455 Senior Poster

Hi hielo & evstevemd,

Wow..!! I didn't knew taht $.ajax has those attributes..!!!:-O Great..!!! I will definitely try it..!!! :)

Thanks a lot. I really appreciate the help you gave me..!!!
Thanks a again..!!!


Cheers
Niranga

Glad I was of help,
I will be happy to see you resolve your issues.
Welcome!

Stefano Mtangoo 455 Senior Poster
$q="select all from news where author id='$id'";

Whuch Kind of database is his?
AFAIK, it should go like this:

$q="SELECT * FROM news WHERE author id='$id'"
Stefano Mtangoo 455 Senior Poster

The code is working now. The change you suggested in addition to few other changes worked. Thanks a ton.. :). Will be posting the working code soon.

And please use code tags. I have found very difficult to follow your code without an editor here

Stefano Mtangoo 455 Senior Poster

Hi hielo & evstevemd,

Thanks a lot for your replies :).

@hielo:
Actually I am having a huge number of PHP files that should be accessed using Ajax. So I have to change the code of each an every PHP file to make it compatible with Ajax requests :(. I was wondering whether there is a solution without touching the PHP files :(. Anyway thanks a lot for taking some time to reply me.

@evstevemd:
I am using jQuery $.post to send Ajax requests. It works fine for non redirecting PHP scripts, but when PHP script calls the redirect function, it works in an unpredictable manner :(. May be I am using it incorrectly :/. I will go through the jQuery documentation and try it again. Thanks a lot for your reply.

If anyone knows how to handle it using jQuery $.post please be kind enough to share it with me :)

Thanks a lot

Hielo have said it well, but I would avoid that code complexity by removing the redirection instruction in my php and just *load* the php file to be redirected to in post callback function; roughly something like below. But for that, you have to "touch" PHP files. If you don't want to touch them, then check Hielo's method. Again, we don't know what the pages does exactly but it is worth to check JQuery append if page.php and redirect.php are to *not* overwrite the content of a div

$.post('page.php',params, function(){ 
   	$('#yourDisplayDiv').load('redirect.php');
  
      });