1,376 Posted Topics
Re: Although as previously mentioned, you may use arrays to select a language, that may not always be a possible option if other users submit content. To solve this with a bit of extra cpu, you may use the google translator via php without leaving the website. The script is as … | |
Re: If you meen to check 4 more fields in the mysql query then you will need to specify them in one long string like the following: [CODE=php]mysql_query('SELECT * from dbname WHERE type="'.mysql_real_escape_string($type).'" AND location="'.mysql_real_escape_string($location).'" AND gender="'.mysql_real_escape_string($gender).'" AND married="'.mysql_real_escape_string($married).'" AND photo="'.mysql_real_escape_string($photo).'"');[/CODE] I think that's what your talking about - is there … | |
Re: Try this: [CODE=php]<? $result=mysql_query('SELECT * FROM `table`'); $fields=mysql_fetch_array($result); foreach($fields AS $field) { $string.=$field; } unset($field); $kilobites=strlen($string); $kilobites=$kilobites/1024; echo $kilobites; ?>[/CODE] Basically the string length is the number of bytes and there are 1024 bytes in a kilobite. | |
Re: From what I have read in the past, it is best to use Ajax to do the job. Although I don't know the first thing about ajax that's just what people have been told is the better option because with ajax you can retrieve the data from mysql via client … | |
Re: Well I think what phpbb does is it writes to a text file each username as they log in and removes their username from that text file when they log out. Then to display the list of usernames, phpbb then simply just retrieves the contents of that text file with … | |
Re: Why not just set the session cookie to expire 10 minutes after login. Below is a example of what you would need to place into your login processor: [CODE=php]setcookie(session_name(), $_COOKIE[session_name()], time()+600, '/');[/CODE] Also note that code needs to go after session_start(); | |
Re: Try the following: [CODE=php]<td> <? $no = 1; echo '<div id="pic">'; while( $no < 6 ) { $pic = "pic".$no; $R4[$pic]=''; echo $pic; ?> <script> album(); </script> <img src="images/journeys/gallery/<? echo $R4["$pic"]; ?>" width="200" height="200" /> <script> album_hide(); </script> <? $no+= 1; $pic= ""; } ?> </div></td>[/CODE] | |
Re: I strongly believe in evolution and I even suspected of a simular thing happening (common ancestry) before I even heard the first thing about evolution. And the southpark clip is very funny in the way it explains it. But unfortunately only 40% of Americans believe in evolution because it contradicts … | |
I am planning to setup a website but need flash movies. So I was thinking of perhaps paying for a developer to develop some flash moves and a viewer but have no idea how much it will cost. Does anybody know how much it would cost for each of the … | |
Re: [QUOTE=helpm3;829575]Hi. I have an internet problem. I am using a laptop at home and it is saying that my wireless connection is connected, but i cannot use any of my web browsers. Although I cant use my web browsers I can still download things on limewire. Limewire is the only … | |
Re: Well php does not directly write to excel files however people in the past have written libraries to handle excel files. Some time ago I had to write to excel, searched and searched then found the best one seems to be located at [URL="http://phpexcel.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=10715"]http://phpexcel.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=10715[/URL] And the download I used was … | |
Re: Try the following: [CODE=php]<?php function showproducts($catid, $page, $currentpage, $newpage) { $query = "Select count(prodid) from products where catid = $catid"; $result = mysql_query($query); $row = mysql_fetch_array($result); if ($row[0] == 0) { echo "<h2><br>Sorry, there are no products in this category</h2>\n"; } else { $thispage = $page; $totrecords = $row[0]; $recordsperpage … | |
I have being trying to make a javascript code that will show different submenus depending on what was selected on the previous menu. Although my script has no bugs according to Internet Explorer it seems to not work in IE nor Crome. Can anybody see what's wrong with this code … | |
Re: Well I have the same annoying error under my php-gtk compilation and as far as I am aware the only way around it is to uninstall the library and recompile the library via command line. But for me since I have about 7 modules with that error it would be … | |
Re: The way I would do for performance and speed is as follows: [CODE=php]$tmp =$_REQUEST["check1"]; $tmp .=',' . $_REQUEST["check2"]; $tmp .=',' . $_REQUEST["check3"]; $tmp = str_replace(',,',',',$tmp); //now to turn into an array $darray = explode(',',$tmp); //now to display the array echo '<xmp>'; print_r($darray); echo '</xmp>'; [/CODE] | |
Hi, I have a website full of code snippets at [URL="http://syntax.cwarn23.info/PHP:_Contents"]http://syntax.cwarn23.info/PHP:_Contents[/URL] but I need some ideas of small scripts that I can make for the example list. So there are some examples of what I have done at that link but I don't want the examples to be too complex. … | |
Re: Or you use xampp or install the services individually. In any case, as a biginner I would recommend using a program called [URL="http://notepad-plus.sourceforge.net/uk/site.htm"]notepad++[/URL] and the wikipedia article about it is at: [URL="http://en.wikipedia.org/wiki/Notepad%2B%2B"]http://en.wikipedia.org/wiki/Notepad%2B%2B[/URL] The advantage with a boosted version of notepad is that it contains a syntax highlighter making code more … | |
Re: Well actually, there is a phrase error or bug in that code and should be the following: [CODE=php]<?php error_reporting(E_ALL ^ E_NOTICE); //this has been fixed $to = 'whom@yahoo.com'; $subject = 'The Playboys!'; $message = ' <html> <head> <title>TESTING!</title> </head> <body> <p>Playboy in the Philippines</p> <table> <tr> <th>Name</th><th>Sex</th><th>Age</th><th>Vitamin</th> </tr> <tr> <td>Tukmol</td><td>Twice … | |
Re: I just checked the script and very buggy in my opinion. I've debuged it and is as follows: [CODE=php] $query3 = "SELECT size, in_stock, colour, itemline_id FROM itemline WHERE item_id = '" . mysql_real_escape_string($row['item_id']) . "'"; $result3 = mysql_query($query3) or die(mysql_error()); echo "test" . mysql_num_rows($result3); echo "<form method='post' action='ppp.php'><select name='id'>"; … | |
Re: [QUOTE=forzadraco;838236][code]mail($to,"Discount offer",$message,"From: noreply@bisnis-indonesia.biz\n MIME-Version: 1.0\n Content-type: text/html; charset=iso-8859-1 \n Reply-To: promo@bisnis-indonesia.biz\nX-Mailer: PHP/");[/code] why is not didn't work [url]www.bisnis-indonesia.biz[/url] ? server problem or code problem ?[/QUOTE] Try the following: [CODE=php]mail($to,"Discount offer",$message,"From: noreply@bisnis-indonesia.biz\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nReply-To: promo@bisnis-indonesia.biz\nX-Mailer: PHP/\r\n");[/CODE] | |
Re: [QUOTE]but have not been able to learn it to program from scratch.[/QUOTE] Well I was like that when I started but found a really useful recourse at [URL="http://www.php.net"]http://www.php.net[/URL] where I found all the recourses I needed to memorise the basics of php. Also if you are into books, try a … | |
Re: I agree with kkeith29 because below is an example of what happens when you put real php in the function: [CODE=php]<?php function myfunction(){ die("The script has now ended."); return 0; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script language="javascript" type="text/javascript"> function ILovePHP() { b = … | |
Re: Well preg match will do the job. Try the following: [CODE=php]<? preg_match_all('/\<object(.*)\<\/object\>/is',$page_contents,$tmp); $matches=$tmp[0]; unset($tmp); //display the first one on the page echo $matches[0]; ?>[/CODE] | |
Re: I have attached to this reply a script that will validate both for displaying on the webpage and for mysql queries. Couldn't post it due to the daniweb validator. | |
Re: If you are talking about retrieving data from a dictionary webpage where you need to enter into a box one word at a time and storing earch word and meaning in a database then that should be really simple. If the keyword is shown in the url bar then you … | |
Re: [QUOTE=lifeworks;837638]Hi If you are including a block of code into each page, but you only want it to show on one page, a simple fix would be to retrieve the url, explode it and find the last chunk - if it is 'index.php', then show the flash block, otherwise do … | |
Re: In my opinion the first 9 lines are written poorly and should be replaced with the following: [CODE=php]// Orginal file is $final_file $ext = end(explode('.', $final_file)); if(strtolower($ext) == 'jpg' || strtolower($ext) == 'jpeg'){ $ext_new = 'jpeg'; } elseif (strtolower($ext) == 'gif'){ $ext_new = 'gif'; } else { die ('Invalid Extension.'); … | |
Re: Try this: [CODE=html]<html> <body> <form action="test.php" method="get"> <input type="hidden" name="action" value="test"> <input type="submit" value="Test"/> </form> </body> </html>[/CODE] | |
Re: [QUOTE=BzzBee;838504]just go to your ftp and right click on your folder where you want to upload the file and click on CHMOD and change the permissions or manually write the text field 777 for all the permissions[/QUOTE] Also note that some hosts only allow a total of 555 permissions in … | |
Hi, I'm making a site security tester which is basically a bot that scans a selected website for any php security holes such as sql injections then reports them to the user. I have managed to write the bot and all but the last piece left is the function that … | |
Re: AVG - lol I prefer AVAST or even Nortons. Their the better options. | |
Re: Try this: [CODE=php]$realUser_q = mysql_query("SELECT Username FROM my_db WHERE Username = $user ") or die(mysql_error()); $realUser=mysql_fetch_array($realUser_q); //above sets the $realUser[] Array //example usage: $realUser['mysql_column_name'] echo $realUser['Username'];[/CODE] Hope that helps answer the question. | |
Re: [QUOTE=AnDurugkar;836984]Hello Mr I am a developer I have put this info because when somebody gets such error he should know every possibility whenever he searches for it, these threads are always usefull while coding for all time so in my opinion this is not dead and i don't write that … | |
Re: Probably just the images html code being set the the wrong path. Try posting some code in relation to the image(s) that won't load and the locations of the images then it will be a lot easier to provide some additional answers to how the code should be. And also … | |
Re: Although the answer to your second question may vary depending on if you want to do cross-site processing, to post a form to another domain, just set the action field in the form like the following: [CODE]<form action='http://www.you_post_to_domain.com/index.php' method='post'>[/CODE] Hope that helps answer your question. | |
Re: Well welcome to daniweb as I see it's your first post. And I shall explain on why the second box may not work and some of the php basics related to that. When writing php scripts, you need to surround the php code with the [ICODE]<?[/ICODE] and [ICODE]?>[/ICODE] tags. That … | |
Re: Try making the From header address different from the To address. That can sometimes increase the chances of the message being spam. | |
Re: Here is a piece of code with the basic concept for that: [CODE=php]<? echo '<form method="post"> <select name="box1"> <option value="apple">Apple <option value="orange">Orange <option value="lemon">Lemon </select><input type="submit" value="Submit"></form>'; if (isset($_POST['box1'])) { if ($_POST['box1']=='apple') { echo '<form method="post"> <select name="box2"> <option value="1">1 <option value="2">2 <option value="3">3 </select><input type="hidden" name="box1" value="'.$_POST['box1'].'"> <input type="submit" … | |
Re: Try this: [CODE=php]if (strlen($_FILES['file1']['name'])>0) { //// file upload } if (strlen($_FILES['file2']['name'])>0) { //// file upload }[/CODE]And in addition, you can't just name the files file1, file2, file3, file4 on the php side and have it differently in the html form. Make sure that in your html form you have the … | |
Re: Welcome to daniweb. I would suggest placing the value in a hidden field where when the next field is submitted it will then again be added to the $_POST array. So the following is an example: [CODE=php]<?php $req = $_POST['req']; echo '<form>'; for ($i=1; $i <= $req; $i++) { echo … | |
Re: For starters it means your transaction id is invalid or corrupted. If you are using $_POST then you may want to use something like the following to unescape the characters: [CODE=php]$id=stripslashes($_POST['transaction_id']);[/CODE] Also, try to echo the transaction id directly before processing it to make sure the transaction id processed correctly. … | |
Re: Although I don't know a thing about xml but if it is a client side text language then wouldn't you use the following: [CODE=php]echo "var xmlvariable= '$phpvariable';"[/CODE] | |
Re: If you are retrieving the value of just one column then the following will do the trick. Just adjust the $column variable to the column name. [CODE=php]$select=mysql_query("SELECT * from db where name='rajeesh'") or die(mysql_error()); $column='first'; //set the column name for ($key=$column;$row = mysql_fetch_array($select),$val=$row[$column];) { echo "$key -> $val <br>"; }[/CODE] | |
![]() | Re: Try this:[CODE]Options +FollowSymLinks RewriteEngine On RewriteRule ^search/(.*)$ index.php?s=$1&search=Search[/CODE] I haven't tested the above code but should rewrite the url to [url]www.whatever.com/search/SEARCHTERM[/url] |
Re: Well what line does the does the message say the error is on? | |
Re: Try replacing the last couple of lines with the following: [CODE=php]if($sentmail){ $error2 = "Your Password Has Been Sent To Your Email Address."; } else if (isset($sentmail)){ $error3 = "Cannot send password to your e-mail address"; } } ?>[/CODE] Glad to see code tags with syntax properties used on large chunks … | |
Re: Yes and if you wish to view the php files locally then you will need to use a package such as xampp. | |
Re: You have a broken loop statement!! Try the following: [CODE=php]$table_field = 'name'; $result = "select * from table"; while($myrow = mysql_fetch_array($result)) { $text .= $myrow[$table_field] . ", "; // Note: if I use 'name' it works fine... } echo $text;[/CODE] | |
Re: If you use the Post method then the user cannot bookmark the results however, if you use the Get method then the user can bookmark the page. Using the Get method means dumping the data into the url and the data in the url can only contain a maximum of … | |
Re: Well they both are identical when it comes to physical use but the only difference is error reporting. If include() fails then a standard error will be displayed and the page will continue loading however, if require() fails then the entire script fails and the entire page comes to a … |
The End.