1,376 Posted Topics

Member Avatar for fitse

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 …

Member Avatar for cwarn23
0
206
Member Avatar for rajeesh_rsn

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 …

Member Avatar for JRSofty
0
75
Member Avatar for shadiadiph

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.

Member Avatar for shadiadiph
0
136
Member Avatar for vidhyaponnusamy

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 …

Member Avatar for vidhyaponnusamy
0
94
Member Avatar for Designer_101

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 …

Member Avatar for Designer_101
0
227
Member Avatar for jbh6gc

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();

Member Avatar for Designer_101
0
693
Member Avatar for marjan_m

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]

Member Avatar for cwarn23
0
111
Member Avatar for Ancient Dragon

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 …

Member Avatar for GrimJack
0
1K
Member Avatar for cwarn23

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 …

Member Avatar for Dani
0
118
Member Avatar for wellashley

[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 …

Member Avatar for cwarn23
0
165
Member Avatar for Acute

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 …

Member Avatar for rm_daniweb
0
331
Member Avatar for vanessia_1999

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 …

Member Avatar for vanessia_1999
0
183
Member Avatar for cwarn23

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 …

Member Avatar for cwarn23
0
100
Member Avatar for NicAx64

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 …

Member Avatar for cwarn23
0
124
Member Avatar for queenc

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]

Member Avatar for rm_daniweb
0
162
Member Avatar for cwarn23

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. …

Member Avatar for cwarn23
0
80
Member Avatar for cutieams

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 …

Member Avatar for cwarn23
0
115
Member Avatar for rm_daniweb

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 …

Member Avatar for Upsilon
0
404
Member Avatar for Roybut

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'>"; …

Member Avatar for Roybut
0
102
Member Avatar for forzadraco

[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]

Member Avatar for rm_daniweb
0
149
Member Avatar for duxbrain

[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 …

Member Avatar for nav33n
0
112
Member Avatar for rm_daniweb

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 = …

Member Avatar for Ezzaral
0
13K
Member Avatar for jyotiu

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]

Member Avatar for cwarn23
0
123
Member Avatar for OmniX

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.

Member Avatar for cwarn23
0
216
Member Avatar for tortoiseman

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 …

Member Avatar for tortoiseman
0
138
Member Avatar for vanessia_1999

[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 …

Member Avatar for vanessia_1999
0
114
Member Avatar for rajeesh_rsn

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.'); …

Member Avatar for cwarn23
0
233
Member Avatar for silh

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]

Member Avatar for silh
1
276
Member Avatar for ashafaaiz
Re: php

[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 …

Member Avatar for cwarn23
0
181
Member Avatar for cwarn23

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 …

Member Avatar for cwarn23
0
192
Member Avatar for chrishea
Member Avatar for cwarn23
1
122
Member Avatar for baudday

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.

Member Avatar for nav33n
0
714
Member Avatar for Phaelax

[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 …

Member Avatar for nav33n
0
131
Member Avatar for ryan311

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 …

Member Avatar for ryan311
0
181
Member Avatar for veledrom

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.

Member Avatar for theighost
0
84
Member Avatar for marney25

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 …

Member Avatar for cwarn23
0
83
Member Avatar for Designer_101

Try making the From header address different from the To address. That can sometimes increase the chances of the message being spam.

Member Avatar for samarudge
0
103
Member Avatar for hemasow

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" …

Member Avatar for cwarn23
0
114
Member Avatar for rajeesh_rsn

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 …

Member Avatar for rajeesh_rsn
0
94
Member Avatar for finalsemstudent

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 …

Member Avatar for cwarn23
0
75
Member Avatar for jino

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. …

Member Avatar for cwarn23
0
139
Member Avatar for nickfday

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]

Member Avatar for nickfday
0
2K
Member Avatar for rajeesh_rsn

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]

Member Avatar for cwarn23
0
74
Member Avatar for bthaxor

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]

Member Avatar for cwarn23
0
97
Member Avatar for grunge man
Member Avatar for grunge man
0
109
Member Avatar for prawin@123

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 …

Member Avatar for prawin@123
0
96
Member Avatar for letlet_pogs

Yes and if you wish to view the php files locally then you will need to use a package such as xampp.

Member Avatar for cwarn23
0
62
Member Avatar for OmniX

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]

Member Avatar for OmniX
0
266
Member Avatar for dmanw100

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 …

Member Avatar for cwarn23
0
267
Member Avatar for gagan22

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 …

Member Avatar for nathenastle
0
183

The End.