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

If you install gcc or Dev-C++ you might be able to compile it ok. I

AD,
DevCpp died way back and its MinGW version is likely to be outdates. I know two actively developed IDE both with Mingw bundle and both supports vc compiler too. They are like Essau and Jacob you know: CodeLite and Code::Blocks

EDIT:
I was a bit quick and slipped on previous post.
I think DevCPP site should close and let wxDevC++ be its successor as it is actively developed

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

Here is simple form,
take it as assignment and play with it to use update and other queries.
Use it as your toy for learning

<?php
$first_name = $_POST['fname'];
$last_name = $_POST['lname'];
$email_name = $_POST['email'];

$sql = "INSERT INTO address(firstname, lastname, email) VALUES('$first_name', '$last_name','$email_name')";
mysql_query($sql);

?>
 
<html>
	<body>
		<form action<?=$_SERVER['PHP_SELF']?> method="POST">
			<input type="text", name="fname" />
			<input type="text", name="lname" />
			<input type="text", name="email" />
			<input type="submit", value="Send" />
		</form>
	</body>
	
</html>
Stefano Mtangoo 455 Senior Poster

Thread is dead old and marked solved!
Start new thread!

Stefano Mtangoo 455 Senior Poster

:D I Already did , and nearly finished the program in QT Sockets instead of WinSockets
Thanks a lot man.

You are welcome

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

:$ sorry for that again.
how may i edit or delete this post?

thanks.

Just translate for us and state why you posted and that is enough.
And.. which language is that?
then sa baba is ilalabas nya yung results. at kapag naclick mo yung certain result then nafifill in nya yung form na tumawag sa kanya :D

Stefano Mtangoo 455 Senior Poster

Thanks and it works

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

where do you insert date picker?
Did you meant to post the above code?

Stefano Mtangoo 455 Senior Poster

why no write Java class and call it object there?

class HelpJava{
	public void printMe(String name, PrintWriter out){
		out.print('Hello: '+name);		
	}
	
}
<%
PrintWriter out = request.getPrintWriter();
 HelpJava obj = new HelpJava();
 obj.printMe("Stefano", out);
%>
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

Hi,
I have a page where I include another page passed via url
Url is something like

http://www.daniweb.com/newthread.jsp?page=24

and I get the variable as

String thePage = request.getParameter("page") ;

Now I want to include it in my page and the code below doesn't work. I have googled and I cannot understand why I cannot get relevant result. Please help

<jsp:include page=<%=thePage%> flush="true"></jsp:include>
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

Hi,
look at bass library.
It is the best out there for free project. you need a good buky for commercial though!
Otherwise, look at given library for example libmad for mp3 et al

Stefano Mtangoo 455 Senior Poster

Since no body have answered, I will pretend it to be unclear, let me get to the heart where I hit a wall. I know how to get stuffs from DB, and I know how to use them (In normal app) but have never done UI-BLL-DAL application and I was wondering how I can implement that. Main issue is what should BLL send and what should DAL return.

Many articles just say I should not send queries/concatenated query strings and they don't say what should I do as alternative. They talk about structure but i'm yet to find an article on how to actually d it.

Many examples are .Net specific, ADO.NET etc. I cannot find any example in C/C++ or Python, PHP which I'm conversant

If You have not understood my question/point I'll be happy to clarify

Stefano Mtangoo 455 Senior Poster

Hi,
I'm trying to develop application with separation of UI/BL/DAL.
I have read a lot of theories and I'm trying to develop a blue print for my application.
I have no problem in UI thing. But I have problem with designing Data Access Layer.
It will basically be a SQLite database backend (I may add other backends as well as XML).
Now I don't know how to write class(es) to do the DAL. So please help me get on it, perhaps with very simple example.

Thanks

Stefano Mtangoo 455 Senior Poster

what about destroy the active session?
To log user out will depend on login mechanism

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

I'm sorry, I get your point :)

No problem :)

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

Thats using a 15 year old compiler. Get with the modernization and use visual studio or something.

CodeLite is my suggestion. Man, it have no express edition ;)

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

heyy thnxxxzz... itz worky bt i dont need to get all fields in the form.. there are another text fields also. thn how i get only set of text fields that i want.

Looping in this case is impractical because you will need a lot if if..else if..
Just retrieve them using normal way

$myVar = $_POST['myVariable'];
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

where is for loop? I can't see it in your code!

Stefano Mtangoo 455 Senior Poster

Did you got solution?

Stefano Mtangoo 455 Senior Poster

I'm sorry but this code is wrong too. The header must be on the top I believe. it should be:

if($submit1 == "Create")  header("Location:script1.php");

if($submit1 == "Delete") header("Location:script2.php");    

echo'<form name="form1" method="post">';
echo '<div>';
echo '<input type="submit" name="submit1" id="submit1" value="Create">';
echo '</div>'."\n";
echo '<div>';
echo '<input type="submit" name="submit1" id="submit1" value="Delete">';
echo '</div>'."\n";

Please check your solutions before sending them to the forum.

Cheers

purposely so that he can learn from "headers already sent" :)

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

Honestly, I have not understood exactly what you want

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

2) Make one of them a DLL

And it must be C DLL as C++ DLL consists of name mangling which differ among compilers.
Or you can export class using C-functions

Stefano Mtangoo 455 Senior Poster

plz tell me how can i make software of calculator in c++.
from smartboy shahzaib

Ego doesn't help. Your own post proves otherwise.
Smart people cannot be anybody because only nobody is smart enough and wait a minute you are somebody!

Stop arrogance and do something

Stefano Mtangoo 455 Senior Poster

No way you can do this with traditional PHP. Only way is AJAX. In that way you can check the variables and report error without moving. I will suggest you check JQuery JS library with simplified AJAX calls

Stefano Mtangoo 455 Senior Poster

I have a form which will have to call two different php scripts based on the click of 2 submit buttons. Below is a sample of what I have so far

<?php
echo'<form name="form1" method="post">';
echo '<div>';
echo '<input type="submit" name="submit1" id="submit1" value="Create">';
echo '</div>'."\n";
echo '<div>';
echo '<input type="submit" name="submit1" id="submit1" value="Delete">';
echo '</div>'."\n";

if(isset($_POST["submit1"])) {
  	header("Location:script1.php");
  }
  else if(isset($_POST["submit1"])) {
  	header("Location:script2.php");    
}
?>

This doesn't seem to be working. Help please

Use code below and credits goes to this guy

echo'<form name="form1" method="post">';
echo '<div>';
echo '<input type="submit" name="submit1" id="submit1" value="Create">';
echo '</div>'."\n";
echo '<div>';
echo '<input type="submit" name="submit1" id="submit1" value="Delete">';
echo '</div>'."\n";

if($submit1 == "Create")
{
  header("Location:script1.php");
}
else
if($submit1 == "Delete")
{
 header("Location:script2.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

Thanks Hielo, i totally forgot to put some variable that would receive returned value. To display retrieved data, one simple for loop worked just fine:

for($i=0; $i<5; $i++){
    echo $data[$i]['title'].'<br />'.$data[$i]['body'].'<br />'..etc.;
}

Worked with that Query? :icon_eek:
I'm curious what kind of DB you are using!

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

i using turbo c

Yeah, that is why! Many students are forced to use that old man :)

Stefano Mtangoo 455 Senior Poster

You can, but you need function woth two parameters:

friend time operator + (time& left, time& right);

AFAIK, any function can be declared friend function. Here are some links on the two subjects:
http://www.ee.ed.ac.uk/~sasg/Computers/Prog/Cpp/cpp6.html
http://learning-computer-programming.blogspot.com/2007/08/operator-overloading-using-friend.html