Top Questions - Ask.WebCheatSheet.com most recent 30 from http://ask.webcheatsheet.com 2010-07-30T13:25:48Z http://ask.webcheatsheet.com/feeds http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://ask.webcheatsheet.com/questions/430/how-do-i-connect-to-data-base-with-easyphp-wamp How do I connect to data base with easyphp/wamp? Alex 2010-03-11T16:54:54Z 2010-07-30T03:23:09Z <p>OK So I have a problem and im stuck with it for more then a week. I have a server,on that server I have Microsoft MSSQL 2005 server with my databses. Im trying to build a website which will be able some how to connect to my mssql server and read the data from the tables. People told me to use easyphp,so I did. The only thing I config there is the "config.inc.php" file.</p> <pre><code>/* Server: localhost [1] */ $i++; $cfg['Servers'][$i]['verbose'] = ''; $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['port'] = '3306'; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'sa'; $cfg['Servers'][$i]['password'] = 'root'; $cfg['Servers'][$i]['hide_db'] = '(mysql|information_schema)'; </code></pre> <p>And I run the next file as a test file to check if I can connect:</p> <pre><code>&lt;?php $dbServer='localhost'; $dbUser='sa'; $dbPass='root'; $dbName='lin2db'; $link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die ("Could not connect"); print "Connected successfully&lt;br&gt;"; mysql_select_db("$dbName") or die("Could not select database"); print "Database selected successfully&lt;br&gt;"; mysql_close($link); ?&gt; </code></pre> <p>And the only thing I get is: Connected successfully Database selected successfully</p> <p>And im sure I connected to an empty data base that I created on myphpadmin homepage. I checked the extention,but I get error on mssql.dll file so I guess maybe that could be the problem. I tried later WAMP.but with wamp I even cannot connect cause it doesnt use MSSQL.</p> <p>Please help me someone with that problem.</p> http://ask.webcheatsheet.com/questions/427/how-to-pass-the-value-from-one-virtual-directory-to-another-virtual-directory-in How to pass the value from one virtual directory to another virtual directory in asp.net? Rajalingam 2010-03-10T01:30:51Z 2010-07-30T02:23:17Z <p>if u know , send the answer.....</p> <pre><code> Thank You </code></pre> http://ask.webcheatsheet.com/questions/257/creating-hierarchical-menus-in-form-in-asp-page creating hierarchical menus in form in ASP page unknown (yahoo) 2009-12-12T19:41:03Z 2010-07-30T01:23:10Z <p>I have an ASP page for a form I'm working on that has 3 modes; review, edit and confirm. I have created and populated arrays to that will be viewed in drop down menus on the form only in edit mode. In review and confirm modes, the user will be able to view (read only) the previously made selections that will be saved in an access db.</p> <p>My issue right now is I haven't been able to get the arrays to come up in the menus.Separately I have tested the arrays and menus in an HTML page and they do work.</p> <p>Any advice? I can provide the code upon request.</p> <p>The following is a sample of the menu code in "Review Mode"</p> <pre><code> &lt;% elseif varMode="EDIT" then %&gt; &lt;select id="Select1" style='width:99%' size="1" name="vehArrayType" onChange="updatevehArrayMake(this.form)" &gt; &lt;option value="0"&gt;None Selected&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Next is a sample of the arrays</p> <pre><code>Dim vehArrayTypeOptions Dim vehArrayMake Dim vehArrayModel Dim vehArraySamClass vehArrayTypeOptions = Array("None Selected", "Bus", "Bus - School", "Car", "Tractor - S/A", "Tractor - S/A Yard", "Tractor - S/A Pick-up/Delivery", "Tractor - S/A Sleeper", "Tractor - T/A", "Tractor - T/A Yard", "Tractor - T/A COE Sleeper", "Tractor - T/A Conv. Sleeper", "Trailer - Dry", "Trailer - Flatbed", "Trailer - Reefer", "Truck - Reefer (&gt;26K GVW)", "Truck - Reefer (&gt;16K &amp; &lt;=26K GVW)", "Truck - Reefer (&lt;=16K GVW)", "Truck - S/A Big Bore", "Truck - T/A Big Bore", "Van - Panel or Pickup", "Van - Parcel", "Van - Metro/Sprinter") vehArraySamClass = Array() vehArrayMake = Array() vehArrayModel = Array() 'fillDropDownLists('Select1','vehArrayType',null,'0') vehArrayMake["Bus"] = Array("None Selected", "Blue Bird", "Chevrolet", "Eldorado National", "Ford", "Gillig", "GMC", "Miscellaneous Bodies", "Navistar International", "Spartan", "Thomas Built Bus") vehArrayModel["None Selected"] = Array("") vehArrayModel["Blue Bird"] = Array("GMCV6600S", "MPV") vehArrayModel["Chevrolet"] = Array("3500", "C3500 HD", "4500") vehArrayModel["Eldorado National"] = Array("EZ Rider II") vehArrayModel["Ford"] = Array("E-30 RV Cutaway", "E-450 SD Cutaway", "E-350", "E-350 Stripped", "E-450") vehArrayModel["Gillig"] = Array("Phantom") vehArrayModel["GMC"] = Array("TG33503") vehArrayModel["Miscellaneous Bodies"] = Array("Unknown") vehArrayModel["Navistar International"] = Array("1853", "3200", "3600 4X2", "3700", "3800 4X2", "43002", "CE S-Bus PB105") vehArrayModel["Spartan"] = Array("SP2142 (Dentistry)") vehArrayModel["Thomas Built Bus"] = Array("191TS", "84 Passenger", "CL-960", "Saf-T-Liner", "Transliner") </code></pre> http://ask.webcheatsheet.com/questions/351/form-validation Form Validation Beth 2010-01-27T17:06:46Z 2010-07-30T00:23:10Z <p>I just started using .asp and have used a .asp form on our site. I now want to create another form (a event registration) and it doesn't validate. I simply copied and pasted and used the same form, and changed a few fields. It submits (email) just fine, but doesn't validate at all. Any ideas?</p> <p>Please keep in mind I am VERY new at this!</p> <p>Thank you! Helpless in CO</p> http://ask.webcheatsheet.com/questions/279/php-email-validation PHP Email validation unknown (google) 2009-12-16T21:05:37Z 2010-07-29T21:23:14Z <p>Hello, I was wondering if you could help me in a little problem I have concerning PHP validation. What would be the best way in validating an email address using PHP? </p> <p>Thank you. </p> http://ask.webcheatsheet.com/questions/550/syntax-for-including-php-var-as-field-in-query syntax for including php var as field in query TomTurnerSr 2010-05-27T00:33:53Z 2010-07-29T20:23:21Z <p>What is the syntax for including a php variable - $info - in a mysql query ?</p> <p>for example:</p> <p>$query='UPDATE mp_id3_tags SET filename=".$mp3_name[$count]."';</p> <p>Thanks</p> http://ask.webcheatsheet.com/questions/557/file-upload-to-ftp-server File upload to Ftp server Naveed 2010-06-01T07:17:42Z 2010-07-29T20:23:21Z <p>How to pause file, uploading to ftp server through Php code </p> http://ask.webcheatsheet.com/questions/589/i-need-to-run-my-asp-net-c-project-to-any-computer-without-install-visual-studio I need to run my asp.net c# project to any computer without install visual studio, or run as a .exe file. can i do? please help me Rahul 2010-06-10T10:22:30Z 2010-07-29T19:23:11Z <p>please help to convert my asp.net project to .exe file</p> http://ask.webcheatsheet.com/questions/181/ajax-permanent-connection-to-the-server AJAX permanent connection to the server? iCoder 2009-11-24T12:14:17Z 2010-07-29T18:23:12Z <p>is there any way to open AJAX permanent connection to the server? </p> <p>My programm needs to exchange data with server in real-time, not just every N seconds. </p> <p>Do you know any examples?</p> http://ask.webcheatsheet.com/questions/688/short-european-breaks Short European Breaks unknown (google) 2010-07-29T05:50:51Z 2010-07-29T05:52:21Z <p>What is murder mystery meals?Is it related to some story or kind of meals?...</p> http://ask.webcheatsheet.com/questions/687/php-help-question Php help Question Umair 2010-07-29T05:25:59Z 2010-07-29T05:25:59Z <p>Hi,</p> <p>plz Help me &amp; My Question is</p> <p>How to send email with file attachment in php?</p> <p>plz give me complete code of html &amp; php.</p> <p>Thanks</p> http://ask.webcheatsheet.com/questions/130/phprunner-and-joomla-cms-will-they-work-together PHPRunner and Joomla CMS - Will they work together? infohound 2009-11-20T05:08:21Z 2010-07-29T05:23:09Z <p>Can PHPRunner be used with Joomla 1.5 CMS as for the front end (look and feel of the site)? I feel a bit restricted using a program like PHPRunner because it is not as fluid with the viual appearance and integrating with something like Joomla 1.5 would solve this. </p> <p>I understand that PHPRunner integrates with Smarty templates but the ability to integrate it with Joomla 1.5 templates and CMS would be so much easier and give a lot of needed flexibility. </p> <p>Does anyone know if this is possible?</p> http://ask.webcheatsheet.com/questions/212/access-joomla-session-variables-from-my-code Access Joomla session variables from my code WebCheatSheet 2009-12-01T05:40:05Z 2010-07-29T05:23:09Z <p>I need to run my application outside of Joomla and get access to current logged user info. </p> <p>Is there a way to do so?</p> http://ask.webcheatsheet.com/questions/199/dynamic-preview-for-textarea dynamic preview for textarea iCoder 2009-11-29T22:49:19Z 2010-07-29T00:23:09Z <p>How do I make dynamic preview for textarea like on this site when asking question?</p> http://ask.webcheatsheet.com/questions/349/php-greek-to-utf8 PHP Greek to UTF8 Athanasios Alekizoglou 2010-01-27T11:21:52Z 2010-07-28T23:23:10Z <p>Is there a function to convert Greek characters to UTF8 in PHP? As I've read utf8_encode only supports ISO-8859-1 (latin) character set, and you need to recompile php to include other character set and/or functions to do the conversion.</p> http://ask.webcheatsheet.com/questions/283/reading-the-clean-text-from-pdf-with-php Reading the "clean" text from PDF with PHP unknown (yahoo) 2009-12-18T20:09:08Z 2010-07-28T14:23:16Z <p>While working this script, I see that the sample PDF supplied works great, but when I attempt to use a pdf that I created with either CutePDF or DeskPDF, I get an error. the error I tracked down is:</p> <p>Warning: gzuncompress(): data error in /usr/home/ezizzi/test/pdf2text.php on line 98</p> <p>I assume this is because there is a difference in the file creation methods used by CutePDF and DeskPDF compared to the maker of the pdf used in sample.pdf.</p> <p>Is there a way of testing this?</p> <p>Thanks,</p> <p>Eric</p> http://ask.webcheatsheet.com/questions/685/where-do-we-get-good-cheap-food-in-atlantic-hotel Where do we get good cheap food in Atlantic Hotel? cityhotelatra 2010-07-28T09:27:57Z 2010-07-28T10:01:40Z <p>Atlantic City a Summer Destination, Summer Destination in Atlantic City</p> http://ask.webcheatsheet.com/questions/297/preg-match-need-some-help-on-this Preg_match NEED SOME HELP ON THIS.... ibo 2009-12-29T20:43:10Z 2010-07-28T08:23:09Z <p>Hey.. I have some hard time finding the * in the value... The preg_match should find it.</p> <p>Here is the code... I have put it in a value the * and preg_match should find it, and if it does it should make the echo "Insert a positive number please"; If preg_match do not find the * than output the $value</p> <pre><code>&lt;?php $value2 = -10 * 10; $value = ($value2 - ($value2 + $value2)); if(!$value || $value &gt; 0 || !is_numeric($value) || preg_match("/*/", $value2)) { echo "Insert a positive number please"; } else { echo $value; } ?&gt; </code></pre> http://ask.webcheatsheet.com/questions/684/uploading-video-file uploading video file dinesh 2010-07-28T07:50:24Z 2010-07-28T07:50:24Z <p>hello sir....</p> <p>can u please give the simple understandable coding for uploading the video file using PHP.....</p> http://ask.webcheatsheet.com/questions/392/login-from-with-remember-me-feature-in-php login from with remember me feature in php vinayak 2010-02-22T15:08:13Z 2010-07-28T06:23:07Z <p>help me to create login form. i used checkbox to remember or not as mostly all site use. the probelm is when submit form with no checkbox tick it shows error undefined array element give solution.</p> http://ask.webcheatsheet.com/questions/474/javascript-robot javascript robot sarah 2010-04-15T11:51:06Z 2010-07-28T06:23:07Z <p>hey guys! I need help making this robot game in javascript (notepad++)</p> <p>please HELP! I'm really confused by the functions</p> <p> Robot Invasion 2199 </p> <h2>Robot Invasion 2199</h2> <p></p> PUT THE CONTROL PANEL HERE!!! <p> // GENERAL SUGGESTIONS ABOUT WRITING THIS PROGRAM: // You should test your program before you've finished writing all of the // functions. The newGame, startLevel, and update functions should be your // first priority since they're all involved in displaying the initial state // of the game board. // // Next, work on putting together the control panel for the game so that you // can begin to interact with it. Your next goal should be to get the move // function working so that everything else can be testable. Note that all nine // of the movement buttons (including the pass button) should call the move // function when they are clicked, just with different parameters. // // All the remaining functions can be completed in pretty much any order, and // you'll see the game gradually improve as you write the functions. // // Just remember to keep your cool when writing this program. There are a // bunch of functions to write, but as long as you stay focused on the function // you're writing, each individual part is not that hard.</p> <p>// These variables specify the number of rows and columns in the game board. // Use these variables instead of hard coding the number of rows and columns // in your loops, etc. // i.e. Write: // for(i = 0; i &lt; NUM_ROWS; i++) ... // not: // for(i = 0; i &lt; 15; i++) ... var NUM_ROWS = 15; var NUM_COLS = 25;</p> <p>// Scene is arguably the most important variable in this whole program. It // should be set up as a two-dimensional array (with NUM_ROWS rows and // NUM_COLS columns). This represents the game board, with the scene[i][j] // representing what's in row i, column j. In particular, the entries should // be: // // "." for empty space // "R" for a robot // "S" for a scrap pile // "H" for the hero var scene;</p> <p>// These variables represent the row and column of the hero's location, // respectively. These are more of a conveniece so you don't have to search // for the "H" in the scene array when you need to know where the hero is. var heroRow; var heroCol;</p> <p>// These variables keep track of various aspects of the gameplay. // score is just the number of robots destroyed. // screwdrivers is the number of sonic screwdriver charges left. // fastTeleports is the number of fast teleports remaining. // level is the current level number. // Be sure to reset all of these when a new game starts, and update them at the // appropriate times. var score; var screwdrivers; var fastTeleports; var level;</p> <p>// This function should use a sonic screwdriver if there are still charges // left. The sonic screwdriver turns any robot that is in one of the eight // squares immediately adjacent to the hero into scrap. If there are no charges // left, then this function should instead pop up a dialog box with the message // "Out of sonic screwdrivers!". As with any function that alters the game's // state, this function should call the update function when it has finished. // // Your "Sonic Screwdriver" button should call this function directly. function screwdriver() { // WRITE THIS FUNCTION }</p> <p>// This function should move the hero to a randomly selected location if there // are still fast teleports left. This function MUST NOT move the hero on to // a square that is already occupied by a robot or a scrap pile, although it // can move the hero next to a robot. The number of fast teleports should also // be decreased by one. If there are no fast teleports left, this function // should just pop up a message box saying so. As with any function that alters // the game's state, this function should call the update function when it has // finished. // // HINT: Have a loop that keeps trying random spots until a valid one is found. // HINT: Use the validPosition function to tell if a spot is valid // // Your "Fast Teleport" button s</p> http://ask.webcheatsheet.com/questions/255/javascript-returns-value-to-one-of-the-html-field-in-php Javascript returns value to one of the html field in PHP Noby 2009-12-11T12:01:08Z 2010-07-28T03:23:16Z <p>Main PHP program calls a Javascript specifying a return field. Sub PHP program is called in Javascript which displays some records from database. User select one of the record and Javascript returns the selected value to the specified field in Main PHP program. </p> <p>This will work if the record is selected from the first screen displayed. It seems remember which target field to be returned. In some cases, Sub PHP program may be called more than once, such is, changing record selection criteria, or there are too many records in a screen and needed to limit only a certain records per screen. </p> <p>If the Sub PHP program is called more than once, and the record is selected in the subsequent call. The record is not set in the Main PHP program. It seems losing the target field to be returned. Is there any way to overcome this problem? </p> <p>Attached is the source codes involved in two program:</p> <p>Main PHP (sy1002.php) HTML (using Smarty Template)</p> <p>First function ("browse") calls aa1100b.php program to display record information Second function ("setTargetField") trys to set returned selected values to fields specified When HTML field "usr_address_code" is clicked, javascript "browse" is called</p> <p>sy1002.tpl</p> <pre><code> function browse(start_key_value,targetField,targetField1) { var aryFieldValues = null; var w = window.open('aa1100b.php?adrAddressCode='+start_key_value,'','width=610,height=700,scrollbars=1'); w.targetField = targetField; w.targetField1 = targetField1; w.focus(); return false; } function setTargetField(targetField,targetFieldValue) { if (targetField) { targetField.value = targetFieldValue; } } &lt;form name="ERPsy1002" method="POST" action="sy1002.php"&gt; &lt;td&gt; &lt;input type = "text" name = "usr_address_code" value ="{$strusr_address_code|escape}" style = "ime-mode:disabled" size = "10" maxlength = "10" /&gt; hyperlink here ="#" onclick="return browse(document.ERPsy1002.usr_address_code.value,document.ERPsy1002.usr_address_code,document.ERPsy1002.saveadl_name_language)" {$lblsearch} &lt;/td&gt; </code></pre> <p>Sub PHP (aa1100b.php) HTML (using Smarty Template) Sub PHP access database and display list of records When one of records is selected, javascript "setFieldValues" is called "setFieldValues" calls "setTargetField" in Main PHP returning selected record to specified field</p> <p>aa1100b.tpl</p> <pre><code> function setFieldValues(stradr_address_code,stradl_name_language) { if (opener &amp;&amp; !opener.closed &amp;&amp; opener.setTargetField) { opener.setTargetField(targetField, stradr_address_code); } if (opener &amp;&amp; !opener.closed &amp;&amp; opener.setTargetField) { opener.setTargetField(targetField1, stradl_name_language); } window.close(); opener.focus(); } &lt;form name="Browseaa1100b" method="POST" action="aa1100b.php"&gt; &lt;td width="180px" align="center"&gt; hyperlink here ="#" onclick = "setFieldValues(paradr_address_code {$smarty.foreach.loopTPL.iteration-1}.value,paradl_name_language{$smarty.foreach.loopTPL.iteration-1}.value)" {$database-&gt;get_adr_address_code()} &lt;/td&gt; </code></pre> <p>When aa1100b.php is executed more than once before selecting a record, it does not set a value to the specified field in Main PHP</p> http://ask.webcheatsheet.com/questions/269/how-do-i-secure-mysql-username-password-in-php-include-file How do I secure MySQL username/password in PHP include file? buckwild 2009-12-15T11:24:56Z 2010-07-28T00:23:09Z <p>I have been doing some searches on google and realize i have to put mysql database username and password in a file using a .htaccess: The problem is how do i do that? some say place it in external folder not in web root. How can I also request the details i sent to database on another page, (Like show it on another page) maybe in a div. (Dunno).</p> <p>Please I need a comprehensive guide. Most importantly secure connection to db. A php script that sends the information to db. Request the info back and showed in a div. Thanks in advance</p> http://ask.webcheatsheet.com/questions/683/html-and-asp-sites-can-not-receive-php-snippet HTML and ASP sites can not receive php snippet craig 2010-07-27T20:00:55Z 2010-07-27T20:00:55Z <p>We need to receive customer registrations sent from a program that uses php. How can our website, one id HTML only the other an ASPDotNetStoreFront receive these?</p> http://ask.webcheatsheet.com/questions/344/information-from-checkboxes-and-the-select-statement-to-retrieve-data-from-mysql Information from Checkboxes and the select statement to retrieve data from MySql database Lakshmi 2010-01-24T03:05:24Z 2010-07-27T18:23:11Z <p>Hi,</p> <p>I am able to use checkboxes to select specific columns of the table. I am not able to generate the corresponding select statement. I can use if-else statement to generate a large number of select statements to retrieve specific data. However, with large number of checkboxes the number of permutations becomes very large. How can I have one or small number of statements which can take care of all the possible options.</p> <p>I have a table of cars with id,year,name columns. In order to retrieve different types of information ( such as Id and name only or name and year only or all the three etc...) I can use three checkboxes. But I will need 6 if-else statements with 6 select statements to take into account all possibilities. If I have more checkboxes the possibilities become very large. What should I do to use one or very few select statements.</p> <p>Thank you very much</p> http://ask.webcheatsheet.com/questions/640/unknown-column-error Unknown column error Tim 2010-07-09T18:13:37Z 2010-07-27T16:23:16Z <p>Here is the error I am getting:</p> <p>Unknown column 'Lo' in 'field list'</p> <p>Here is my code. Any suggestions to get rid of this error:</p> <p>global $conn,$dal; $customerID = mysql_insert_id();</p> <p>$strSQLInsert = "insert into Orders (CustomerID, LastName) values (".$customerID.", ".$values["LastName"].")"; db_exec($strSQLInsert,$conn);</p> <p>$rs = $dal->Orders->Query("CustomerID=".$customerID." and LastName=".$values["LastName"],""); $data = db_fetch_array($rs);</p> <p>$idvalue = $data["ID"]; header("Location: Orders_edit.php?editid1=".$idvalue); exit(); </p> http://ask.webcheatsheet.com/questions/345/mail-with-attachment Mail with attachment Bent 2010-01-25T16:31:29Z 2010-07-27T16:23:16Z <p>Hi</p> <p>Tried to use the PHP script to attach a PDF-file - did't seem to work ?</p> <p>Thanks for help !</p> http://ask.webcheatsheet.com/questions/613/simple-php-gallery simple php gallery Raul 2010-06-21T08:36:29Z 2010-07-27T15:23:16Z <p>Hello, I'm new to php and I only recently started going through basic tutorials. </p> <p>Can anyone please help me with a simple tutorial for building a photo gallery? I tried a few but they're quite complicated or I failed in running the script successfully.</p> http://ask.webcheatsheet.com/questions/615/using-php-with-mysql-to-narrow-search-for-large-table-in-mysql-using-a-variable Using PHP with MySql to narrow search for large table in MySql using a variable Greg Reaver 2010-06-22T14:33:15Z 2010-07-27T15:23:16Z <p>I am using Dreamweaver CS4 and have created a PHP document. I have added a form and table to this document and have already set up my 'site' using a mysql datebase which I can already connect to. I want to set up a 'variable' $name using PHP to correspond with MySql table field name 'stockname'. I would like my customers to type into variable '$name' and each stroke of the keboard to narrow the search to my table.field 'stockname'. That field has almost 10,000 items and would take forever for my customer scrool through entire field without using a 'variable' name. </p> <p>Example: $name = inventory.stockname and if stockname is called 'widget', then each time my customer types in 1 letter such as "W" the table (which is already indexed to stockname) would automatically display everything with first letter "W". If I typed in "WID" then it would narrow my customer's search even further etc. etc.</p> <p>What would be the PHP script to attempt this??</p> <p>Regards</p> <p>Greg</p> http://ask.webcheatsheet.com/questions/642/how-do-i-make-php-login-system-for-website-that-connects-to-mssql-with-pass-salt how do i make PHP login system for website that connects to MSSQL with pass salt. silent 2010-07-10T23:45:28Z 2010-07-27T14:23:08Z <p>i am making website with user cp that connects to Mssql with a certain password salt and i was wondering how do i make a secure login script?</p>