PHP - Question About Whether To Write A Php/mysql App Or Use Access/jet For Short Term
Hey all,
I am in a situation where database management system needs to be up and running very quickly, which would store records of addresses possibly from all the properties in a particular US state. But it would only be 1 US state, not all. These records need to be updated and retrieved for particular campaigns. The programming solution (e.g. PHP) would need to be able to import csv files generated from excel and match the records in the database in order to know which fields to update. It seems like a lot of work to do this from scratch using PHP in the short-term, given time limitations. Hence, I was considering using Microsoft Access as a front end in the interim and then when time is available writing a web-based PHP/MySql application using HTML, CSS, and JavaScript front end to allow users to easily perform data entry. Does anyone think this is a smart course of action? Ideally a web PHP app would be more robust, but considering it needs to be done from scratch, it would be time consuming. There's no right or wrong answer for this. I'm just looking for opinions. Thanks for any response. Similar TutorialsWhat is the best way to handle an auto database check? could php do this without the help of JQUERY or JAVASCRIPT? HI, I have a ms-access file which has linked table. The linked table is connected to a ODBC source (e.g MS-SQL or 3rd Party ODBC Driver). WebPage(php) Apache, connecting to a ODBC DSN of MS-Access, MS-Access is having linked tables. Linked tables as from another ODBC source. On the PHP Page, When I am trying to connect the ms-access odbc dsn , I am able to connect. But when I query any of the linked tables, PHP is not able to query and is failing. Does php has capabilities to read/write to linked tables in ms-access file. Or it is issue with MS-Access Or is it I am missing something. Microsoft says, its an issue of PHP https://social.msdn....forum=accessdev Requesting you to please share your feedback Regards Rajendra Dewani Hi All, I am using PHP 5.3 and storing php session data to the database using session.set_save_handler callbacks. I see that the write method, strangely treats the Class constant as undefined. All the other methods seem to work fine with the class constant. Any reason why this would happen? Please see code below. I get an error "Use of undefined constant db_table in Sessions.php in line". This seems to be happening only with the write api. Can someone please help? Thanks class Sessions { //var $life_time; var $id; var $data; const db_table = 'php_mysql_session'; function PHPSessions() { // Read the maxlifetime setting from PHP //$this->life_time = get_cfg_var("session.gc_maxlifetime"); $this->id = session_id(); $this->data = ''; // Register this object as the session handler session_set_save_handler( array( &$this, "_open" ), array( &$this, "_close" ), array( &$this, "_read" ), array( &$this, "_write" ), array( &$this, "_destroy") , array( &$this, "_gc" ) ); } function _open () // open the session. { Zend_Log::log("opening connection"); global $_sess_db; Zend_Log::log("session db ".$_sess_db); if ($_sess_db = mysql_connect(DB_HOST_READ, DB_USER, DB_PASS)) { return mysql_select_db('TEST_SESSION', $_sess_db); } // If there is a failure return false return FALSE; } // open function _close () // close the db connection here { global $_sess_db; return mysql_close($_sess_db); } // close function _read ($id) // read any data for this session. { global $_sess_db; Zend_Log::log("Session db ".$_sess_db); //$id = mysql_real_escape_string(session_id()); Zend_Log::log("Session Id :" .$id); $sql = "SELECT * FROM ". self::db_table ." WHERE session_id = '$id'"; Zend_Log::log("SQL IS : ".$sql); $data = ''; $result = mysql_query($sql); $a = mysql_num_rows($result); Zend_Log::log("Record count ".$a); if($a > 0) { Zend_Log::log("Record Exists!"); $row = mysql_fetch_assoc($result); $data = $row['session_data']; Zend_Log::log("Fetching session Data ".$data); return $data; } else { Zend_Log::log("No Data ".$data); return ''; } } function _write ($id, $data) // write session data to the database. { global $_sess_db; $newid = mysql_real_escape_string($id); $newdata = mysql_real_escape_string($data); $sql = "REPLACE ". self::db_table ." (session_id,user_id,session_data,date_created) VALUES('$newid', '$userid', '$newdata', 'NOW()')"; $rs = mysql_query($sql); return TRUE; } // write function _destroy ($id) // destroy the specified session. { Zend_Log::log("Destroy method "); return TRUE; } // destroy function _gc ($max_lifetime) // perform garbage collection. { Zend_Log::log("GC Method"); return TRUE; } // gc function _destruct () // ensure session data is written out before classes are destroyed // (see http://bugs.php.net/bug.php?id=33772 for details) { @session_write_close(); } // __destruct // **************************************************************************** } // end class Im developing a registration script and using godaddy as my host. Im getting "Access denied for user 'headstyle1'@'%' to database 'users'" when running the registration script. Is there some kind of permission I have to set? I am trying to make an edit page to edit any of my post...so i designed a manage post page manage-posts.php with the given code: Code: [Select] <?php echo '<form name="frmMain" action="del1.php" method="post" OnSubmit="return onDelete();">'; $objConnect = mysql_connect("hostname","username","password") or die(mysql_error()); $objDB = mysql_select_db("dbname"); $strSQL = "SELECT * FROM text"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); echo '<table width="600" border="1">'; echo '<tr>'; echo '<th width="91"> <div align="center">ID</div></th>'; echo '<th width="91"> <div align="center">Date</div></th>'; echo '<th width="91"> <div align="center">Title</div></th>'; echo '<th width="91"> <div align="center">Author</div></th>'; echo '<th width="30"> <div align="center">Edit</div></th>'; echo '<th width="30"> <div align="center">Select</div></th>'; echo '</tr>'; while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><?=$objResult["id"];?></td> <td><?=$objResult["date"];?></td> <td><?=$objResult["title"];?></td> <td><div align="center"><?=$objResult["author"];?></div></td> <td align="center"><a href="edit.php?NewsID=<?php echo $objResult["id"];?>" name="edit">Edit</a></td> <td align="center"><input type="checkbox" name="chkDel[]" value="<?=$objResult["id"];?>"></td> <input type="hidden" name="id" value="<?=$objResult["id"];?>" /> </tr> <? } echo '</table>'; echo '<input type="submit" name="btnDelete" value="Delete">'; echo '</form>'; and i designed another page edit.php to perform deletion of that particular post with the following code " Code: [Select] <?php $objConnect = mysql_connect("hostname","username","pass") or die(mysql_error()); $objDB = mysql_select_db("dbname"); $strSQL = "SELECT * FROM text"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $objResult = mysql_fetch_array($objQuery); ?> <input type="hidden" name="id" value="<?=$objResult["id"];?>" /> Title : <br /><input type="text" name="title" size="100" maxlength="100" value="<?=$objResult["title"];?>"/> <br /> Date : <br /><input type="text" name="date" size="20" maxlength="12" id="TextBox" value="<?=$objResult["date"];?>"/> <br /> Author : <br /><input type="text" name="author" size="20" maxlength="100" value="<?=$objResult["author"];?>"/> <br /> <br /> <input type="submit" value="Submit" name="submit" /> </p> </form></fieldset></div> But the problem is that i am not able to get that particular post every time whenever i clicked on the respective post's edit link.. i suppose there is any issue in calling the id from the mysql... kindly suggest solutions... thanks in advance... Hi guys, I have a for loop, that queries my database, sometimes, close to 240 times, I want to minmise the DB access - what would be ideal is if I can query a result set, such as this.. Code: [Select] $result = mysql_query($sql,$con); Is it possible for me to now run a query on $result. Such as Code: [Select] select * from sometable where age >= '24' So, rather than access the DB over and over again, I just query the result set, which will be much faster. Any ideas on this one guys? Cheers Zain Hi guys so i want to make page acces to certain ranks. So im thinking for something like this
rank1 -> home.php, admins.php So the ranks are in a database with the page names. So now when someone logs in they will get a certain rank. So now i need to make a function that will check if the rank has access to this page. $curPageName = substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1); This will detect the current page that the logged in person is at now. But now how do i check if the $_SESSION['rank']; (rank1) has the access to get in page admins.php, and obviously to make $_SESSION['rank'];(rank2) redirect from the page admins.php Could someone point me in the right direction? Do i select the ranks and page names from database then put it into a array? Thanks. I have a search form. $req is a keyword or an ID number input by user. As you can see, query checks only for rows where userID matches the current login userID. My question is, how to transform (not independent query for admins) the query to search all rows if user $access is admin (no matter the administrator's own userID). Code: [Select] <?php $userID="something"; (from session) $access="something" (from session / user or admin) $query="SELECT esName, esID, esAddress FROM estates WHERE (esName LIKE '$req' OR esID LIKE '$req') AND userID='$userID'"; mysql_query($query); ?> Thanks in advance Need help ASAP. i need the following form to right to mysql table "table1" and columns "name" "email" and "comment".
<form action="sign.php" method="post" class="pure-form pure-form-stacked"> <fieldset> <label for="name">Your Name</label> <input id="name" type="text" placeholder="Your Name" name="name"> <label for="email">Your Email</label> <input id="email" type="email" placeholder="Your Email" name="email"> <label for="comment">Your Comments</label> <input id="comment" type="text" placeholder="Your Comments" name="comment"> <a href="thanks.html" button type="submit" class="pure-button">SUBMIT</button> </a> </fieldset> </form> My PHP File looks like this: <html> <body> <?php $myUser = "dbuser"; $myPassd = "********"; $myDB = "dbname"; $myserver = "192.168.1.80:3306"; $name = $_POST['name']; $email = $_POST['email']; $comment = $_POST['comment']; // Create connection $dbhandle = mysql_connect($myserver,$myUser,$myPassd) or die("Unable to connect to MySQL"); echo "Connected to MySQL<br>"; //select a database to work with $selected = mysql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); //if (mysqli_connect_errno()) { //echo "Failed to connect to MySQL: " . mysqli_connect_error(); //} //echo "connected"; $sql = "INSERT INTO signatures (name, comment) VALUES ( $name, $comment)"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo "record added"; mysql_close($dbhandle); ?> </body> </html> I also need this to redirect to another html page after it run. Like i said any help would be great because i cant get it to work! Hey php gods! I recently watched a tutorial on how to make a membership system, it all turned out fine n stuff. So i wanted to expand and i found out a way to make a email activation "thingie", by making 2 new rows. 1 called email_code and a second called email_a(a for activate). When the person then registered, he woulld get a email where he should go to a link and write a code that was generate with a rand fuction and placed in the email_code row in the database. Then when the person wrote his username and the code in a form from the link in the email, the email_a would change from 0 to 1 if the username matched to the code he got. (sry for bad english). anyway here is the code: <!DOCTYPE html> <html> <head> <link href="style.css" type="text/css"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Activate email</title> </head> <body> <form action="" method="POST"> Username:<input type="text" name="username"> Code:<input type="text" name="activate"> <input type="submit" name="submit" value="aktiver"> </form> <?php include 'connect.php'; $username = $_POST('username'); $activate = $_POST('activate'); $submit = $_POST('submit'); $query = mysql_query("SELECT username AND email_code FROM user"); while ($row = mysql_fetch_assoc($query)){ $dbusername = $row['username']; $dbcode = $row['email_code']; } if ($_POST['submit']){ if ($username==$dbusername&&$code==$dbcode){ mysql_query("UPDATE users SET email_a = '1' WHERE username = '$username' AND email_code = '$activate'"); echo "Du er blevet aktiveret"; } else echo "Forkert data"; } else ?> </body> </html> Hope you can help me MinG I have a site with a members area that uses sessions. I migrated my DB from MySQL 4 to 5. Now my login page does not work. Please help. Member Login Page: Code: [Select] <?php session_name ('name'); ini_set ('session.use_cookies', 0); session_start(); ?><!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> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="css/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/swfobject/swfobject.js"></script> <script type="text/javascript"> var flashvars = {}; flashvars.xml = "config.xml"; flashvars.font = "font.swf"; var attributes = {}; attributes.wmode = "transparent"; attributes.id = "slider"; swfobject.embedSWF("cu3er.swf", "cu3er-container", "960", "400", "9", "expressInstall.swf", flashvars, attributes); </script> <link href="css/menu.css" rel="stylesheet" type="text/css" /> <style type="text/css"> #apDiv1 { position:absolute; left:592px; top:75px; width:552px; height:53px; z-index:1; } a:visited { color: #5D4580; } a:hover { color: #FFF; } a:active { color: #5D4580; } </style> </head> <body> <div class="main"> <div class="blok_header"> <div class="header"> <div class="rss"><strong>P</strong></div> <div class="clr"></div> <div class="logo"><a href="index.html"><img src="images/logo.jpg" width="211" height="88" border="0" alt="" class="one" /></a></div> <div class="menu"> <ul id="css3menu"> <li class="topfirst"><a href="index.html" title="Home">Home</a></li> <li><a href="#" title=""><span>Omega Psi Phi</span></a> <ul> <li><a href="founders.html" title="Fraternity Founders">Fraternity Founders</a></li> <li><a href="omegahistory.html" title="Fraternity History">Fraternity History</a></li> <li><a href="programs.html" title="Mandated Programs">Mandated Programs</a></li> <li><a href="links.html" title="Links">Links</a></li> </ul> </li> <li><a href="#" title="Phi Gamma Chapter"><span>Phi Gamma Chapter</span></a> <ul> <li><a href="history.html" title="Phi Gamma History">Phi Gamma History</a></li> <li><a href="lineage.html" title="Phi Gamma Lineage">Phi Gamma Lineage</a></li> <li><a href="dedication.html" title="Dedication">Dedication</a></li> <li><a href="calendar.html" title="Calendar">Calendar</a></li> <li><a href="photogallery.html" title="Photo Gallery">Photo Gallery</a></li> <li><a href="members/login.php" title="Member Login">Member Login</a></li> <li><a href="roster.html" title="Chapter Roster">Chapter Roster</a></li> </ul> </li> <li><a href="members/login.php" title="Member Login">Member Login</a></li> <li class="toplast"><a href="contact.html" title="Contact Info.">Contact Info.</a></li> </ul> </div> </div> <div class="clr"></div> <div class="body"> <div class="body_bg"> <h2>Member's Only </h2> <?php if ($_SESSION['membername'] != null) { // print "<META HTTP-EQUIV='Refresh' content='0;URL=updatemember.php'>"; echo "You are already logged in. Please wait to be redirected to the members page, or <a href=\"members.php\">click here</a> if you are not automatically redirected. User name for the session is ".$_SESSION['username'].", the member name is ".$_SESSION['membername']; print "<META HTTP-EQUIV='Refresh' content='5;URL=members.php'>"; //header("Location: members.php"); //exit; } else { ?> <form name="admin" method="post" action="userlogon.php"> <table width="891" border="0" cellspacing="5" cellpadding="5"> <tr> <td height="80" colspan="2" align="left"><p>Please enter you username and password. Don't remember your password, <u><strong><a href="password.php">click here</a></strong></u><strong><a href="password.php"></a></strong>.</td> <td width="360" rowspan="5" align="center" valign="middle"><img src="images/login_image.jpg" width="239" height="314" /></td> </tr> <tr> <td width="257" height="38" align="right"><p><strong>Username:</strong></td> <td width="224" align="left"><input type="text" name="username"></td> </tr> <tr> <td height="38" align="right"><p><strong>Password:</strong></td> <td align="left"><input type="password" name="password"></td> </tr> <tr> <td height="34"> </td> <td align="left"><input type="submit" class="yellowbutton" name="submit" value="Sign In"></td> </tr> <tr> <td colspan="2"><p>To register for a username and password with Phi Gamma, please <u><strong><a href="register.php">click here</a></strong></u><strong><a href="password.php"></a></strong>.</td> </tr> </table> </form> <?php } ?> <p> </p> <div class="clr"></div> </div> <div class="clr"></div> </div> </div> <div class="footer"> <div class="footer_resize"> <p class="center"> <a href="index.html">Home</a> | <a href="contact.html">Contact</a> </p> <div class="clr"></div> </div> <div class="clr"></div> </div> </body> </html> After the credentials are entered the user is returned back to the login page and NOT the member's page. This is the userlogon.php page: Code: [Select] <?php $link = mysql_connect('localhost:/tmp/mysql5.sock', 'dbuser', 'dbpw'); if (!$link) { die('Could not connect: ' . mysql_error()); } //mysql_close($link); if (!mysql_select_db('db_name', $link)) { echo 'Could not select database'; exit; } $username = $HTTP_POST_VARS["username"]; $password = $HTTP_POST_VARS["password"]; $member_id = ''; $role = ''; $firstname = ''; // Formulate Query // This is the best way to perform a SQL query // For more examples, see mysql_real_escape_string() $query = sprintf("SELECT users.member_id, users.username, users.password, users.role, FROM users join members on users.member_id = members.member_id WHERE users.username ='%s' AND users.password='%s'", mysql_real_escape_string($username), mysql_real_escape_string($password)); // Perform Query $result = mysql_query($query); // Check result // This shows the actual query sent to MySQL, and the error. Useful for debugging. if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } // Use result // Attempting to print $result won't allow access to information in the resource // One of the mysql result functions must be used // See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc. while ($row = mysql_fetch_assoc($result)) { $member_id = $row['member_id']; $username = $row['username']; $role = $row['role']; } if ($member_id != ''){ session_start(); $_SESSION['membername'] = $username; $_SESSION['username'] = $username; $_SESSION['memberid'] = $member_id; $_SESSION['role'] = $role; print "<META HTTP-EQUIV='Refresh' content='0;URL=members.php'>"; } else { print "<META HTTP-EQUIV='Refresh' content='0;URL=memberlogin.php'>"; } // Free the resources associated with the result set // This is done automatically at the end of the script mysql_free_result($result); ?> It worked fine before the migration??? Anyone know where the problem is? I have a MySQL database with each record of a person who has registered for an event, I am displaying the information on a web page for a user, but he wants to be able to print out all the records in alphabetical order by last name, first name later on so he will have a hard copy of each person who has registered at the table when they arrive. How can I write each record to a Txt file that he can print out later that will be formated with the record contents along with each fields definition (Ex. Last Name - Smith, First Name - John, etc)? Please help me to solve this error Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'SYSTEM'@'localhost' (using password: NO) in C:\wamp\www\shop-script-free\includes\database\mysql.php on line 13 Warning: mysql_get_server_info() expects parameter 1 to be resource, boolean given in C:\wamp\www\shop-script-free\includes\database\mysql.php on line 14 Access denied for user 'SYSTEM'@'localhost' (using password: NO) Thanks you very much This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=333523.0 I would like to know how to do search terms. For example, someone key in the terms in the text field, and click search, thn it will show the data. I'm sure this is possible, but I'm not having any luck. Code: [Select] $array = array("11:23", "12:46", "13:34", "14:34", "14:85"); if (in_array('12', $array)) { echo "yes"; } else { echo "no"; }} Is 'password' a protected/resevred term in either PHP or HTML? Is this code valid... Quote <li> <label for="password"> <em><img src="images/required.png" alt="required" /></em> Password: </label> <input id="password" name="password" class="text" type="password" /> </li> TomTees Is PHP used to create this type is feature? I already have a MYSQL table set up, how difficult is it to create this sort of feature? On this image, where it says 'filter your results' if a user clicks 'Detached Houses' then only detached houses will be displayed. if a user clicks 'Semi-detached' then only semi detached houses will be shown. Whats the technical term for this type of feature, and can you point me towards any tutorials etc, would really appreciate it. thank you! I've got a search page that spits out results that match the term that was input. Within the results, I want to add a span with a yellow background behind just the search term. I'll show my code, then say my problem Code: [Select] <?php $search = (term in $_GET variable that was searched for); // while loop that goes through all results, $result is the text that the searched term was found in $new_result = str_ireplace($search, "<span style='background:yellow'>$search</span>", $result); echo $new_result; // end while loop ?> my problem is that if somebody searches for the word "bob", then if the term "Bob" was found, when it outputs the $new_result, it shows as "bob" with the yellow background. Searching for "Bob" would give the correct results("Bob" with a yellow background), but basically when the output is given, the case of each letter is displayed as it was typed in the search field. Here's the query: Code: [Select] $sql = mysql_query("SELECT * FROM resources WHERE gameCat = '' ORDER BY systemCat,order_id"); I want something to happen when the systemCat changes in the results. Like this: Code: [Select] if($row['systemCat'] CHANGES){ echo '<div id="seperator"></div>'; } Any ideas? Thank you! |