
pandu
Members-
Posts
37 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
pandu's Achievements

Member (2/5)
0
Reputation
-
I totally agree! Having a single post on tools and what they are used for, would really be useful. It would also save time for gurus who can just point to the link.
-
Anti-Moronic thanks for all the great suggestions on tools and advice! I am going thru the link on db normalization.
-
Thanks BlueSkyIS. What is your approach to the database design?
-
Hello, This is a repost of a thread that I posted earlier (http://www.phpfreaks.com/forums/php-coding-help/advice-on-how-to-convert-idea-to-code/new/?topicseen#new). I wanted to get more feedback and so am posting again. I am seeking advice on what is the best way to go from idea to code. I know there is an intermediate step where a developer figures out the design (not graphics design but the architecture), the database structure, the algorithm, etc. I read somewhere that the best way to go from idea to code is to draw a flowchart. But flowchart does not seem to be good for object-oriented programming (which I am getting familiar with at the moment). Somewhere I also read that for every requirement, start by creating a table and then refine. Are there other design techniques? I would appreciate all ideas and links on this matter. TIA
-
Thanks anti-moronic. Once I get some guidance on how to approach a problem, I am able to code it up. But its going from idea to some sort of design plan, that I get stuck at. Perhaps, its just one of those things that comes with experience? I would like to hear more ideas and suggestions on how you guys come up with a design/architecture - not just for the requirements I mentioned above but for any of your own projects. TIA
-
Hello, New to PHP and have so far been able to make some good progress on learning to code. However, I get stuck when converting an idea into code. I recently built this simple web app called ezsynonym.com. It simply queries a table of words and then results the relevant synonyms. Now I want to add more features such as 1. allowing users to rate the synonym results and 2. allowing users to submit better synonyms. But I am drawing a blank on going from above requirements to coding. What do developers do when they come across requirements? How do you break down a requirement into design, into algorithm, database structure, ec. TIA
-
Im trying to make my form remember the last input made by user, so I wrote the following and I get a syntax error on the input line. The error is: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\ezsynonym\index.php on line 90 <form id="searchform" method="post" action="index.php"> <input id="input" name="synonymsearch" type="text" value="<?php echo $_POST['synonymsearch']; ?>" maxlength="400px" /> </form> TIA
-
Thanks blueskylS. I heard there is some security problem with using isset. Is that right?
-
Hi, I have an undefined index problem and not sure how to fix it. I dont want to turn off errors - I would like to learn how to actually fix this problem. It happens in line 13 which is marked below with //line 13 comment. The exact error is: Notice: Undefined index: synonymsearch in C:\wamp\www\ezsynonym\index.php on line 13 TIA. <?php //start buffering output ob_start(); include("db.php"); $mysqli = new mysqli($dbServer, $dbUser, $dbPass, $dbName); //report any errors on screen for debugging //echo "connection errors: " . mysql_error() . "<BR>"; //STORE THE USER INPUT IN VARIABLES $strErrorResults = ""; $strWordResults = ""; //line 13 - this is where the error happens. $queryWord = $_REQUEST['synonymsearch']; if ($queryWord == "" || $queryWord == "Search Synonym") { $strWordResults = "Enter a word to search for"; } else { //search for target word in wordlist $result = $mysqli->query("select * from wordlist where word='{$queryWord}'"); if ($result->num_rows > 0) { //extract the target word's primary key $word_arr = $result->fetch_array(MYSQLI_ASSOC); $word_id = $word_arr['pri']; //search for target word's primary key in the links table's wordid column $synonymQuery = "select * from links where wordid='{$word_id}'"; $synonymResult = $mysqli->query($synonymQuery); $arrKeys = array(); //create an array if ($synonymResult->num_rows > 0) { //grab the corresponding synonym ids and store into the array while ($row = $synonymResult->fetch_array(MYSQLI_ASSOC)) { $arrKeys[] = $row['synid']; } } foreach ($arrKeys as $value) { $sQuery = "select * from wordlist where pri='{$value}'"; $result = $mysqli->query($sQuery); $result_arr = $result->fetch_array(MYSQLI_ASSOC); // echo $result_arr['word']; $strWordResults .= <<<END <div id="results-left"><a href="index.php?synonymsearch={$result_arr['word']}"> {$result_arr['word']} </a></div><br/><br/> END; } // end for } // end if else { //word does not exist in the database $strErrorResults .= <<<END <p>failure... word does not exist in the system</p> END; } } print <<<END <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="style.css" type="text/css" media="screen"> <link rel="icon" href="favicon.ico" type="image/x-icon"> <title>ezSyonym</title> </head> <body> <div id="header"> <a href="index.php"><img src="images/logo-final.gif"></a> </div> <div id="content"> <div id="left-col"> <div id="searchbox"> <form id="searchform" method="post" action="index.php"> <input id="input" name="synonymsearch" type="text" value="Search Synonym" maxlength="400px" /> </form> </div> <div id="search-results"> {$strErrorResults} {$strWordResults} </div> </div> <div id="right-col"> <div id="sidebar"> </div> </div> </div> <div id="footer"></div> </body> </html> END; //send data to the browser ob_end_flush(); ?>
-
Here is the full code: <html> <head></head> <body> <form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="post" enctype="multipart/form-data"> <br/><br/> Choose a file to upload:<br/> <input type="file" name="upload_file"> <br/> <input type="submit" name="submit" value="submit"> </form> </body> </html>
-
ok - I figured out the problem - it was with the way the form was trying to call itself. So I changed the following <form action="<?=PHP_SELF?>" method="post" enctype="multipart/form-data"> To <form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="post" enctype="multipart/form-data"> But now I get the error that "no file chosen" even though I selected a file to upload and clicked submit.
-
I am trying to run the following code to upload a file. (WAMP using Win XP). Once I select the file and click submit I get the error: "Forbidden... You don't have permission to access /< on this server." with URL http://localhost/<?=$PHP_SELF?> Code is below: <form action="<?=$PHP_SELF?>" method="post" enctype="multipart/form-data"> <br/><br/> Choose a file to upload:<br/> <input type="file" name="upload_file"> <br/> <input type="submit" name="submit" value="submit"> </form> TIA
-
That makes sense. Thanks for the clarification.
-
Hello, I am trying to understand how the time is changed from one time zone to the other in the code below. All I see is that the time zone is changed and then the date function seems to "magically" update the time. But when I read the PHP manual for the date function, all the date function does is format output. So not sure how the change is happening. Would appreciate your insights. Thanks. $time_zones = array("Asia/Tokyo","Asia/Hong_Kong","Asia/Dacca","Asia/Kuwait","Africa/Cairo","Europe/Paris","Europe/Madrid","Europe/London","America/New_York","America/Los_Angeles","America/Chicago"); if ($_GET["start_time"] != NULL){ $start_time_input = $_GET["start_time"]; $start_tz = $_GET["start_tz"]; $end_tz = $_GET["end_tz"]; date_default_timezone_set($start_tz); $start_time = strtotime($start_time_input); echo "<strong>"; echo date("h:i:sA",$start_time)."\n"; echo "</strong>"; echo "in $start_tz becomes "; echo "<strong> "; date_default_timezone_set($end_tz); echo date("h:i:sA",$start_time)."\n"; echo "</strong>"; echo " in $end_tz.</p><hr />"; } ?>
-
Running on windows using XAMPP