1,741 Posted Topics

Member Avatar for klentoi
Member Avatar for naekur

$result will have a result resource. You need a loop to get all the result. mysql_fetch_array() will fetch only 1 record at a time. [code=php] while($row = mysql_fetch_array($result,MYSQL_NUM)) { print "<pre>"; print_r($row); print "</pre>"; } [/code]

Member Avatar for nav33n
0
165
Member Avatar for emiola

Nothing wrong with the script. Umm.. Check if it enters the loop, [icode]If (isset($_POST['submit'])) { [/icode]. Try mysql_error to know what exactly is the error message. ie., [code=php] $sql = mysql_query("INSERT INTO accesscarduse (SchoolName, SchoolEmail, UserName, pscode) VALUES ('$SchoolName', '$SchoolEmail', '$UserName', '$pscode')") or die (mysql_error()); [/code] Also check if error …

Member Avatar for nav33n
0
242
Member Avatar for dottomm

Nice queries.. But still, that wouldn't solve what OP is looking for.. The still doesn't return the count as 0, if a user doesn't have any posts. I created dummy tables to create the same scenario and I am also clueless ! :S

Member Avatar for dickersonka
0
457
Member Avatar for arnaud257

You need to mention http:// in your hyperlinks. See this for example. [code=php] <?php echo "<a href='www.google.com'>Click here </a><br />"; echo "<a href='http://www.google.com'>Click here too</a>"; ?> [/code]

Member Avatar for arnaud257
0
195
Member Avatar for khr2003

Yeah, possible. Have a hidden field in the form to store the id. When the user clicks submit, update the table :) [code=mysql] update table set orderno='".$_POST['orderno']."' where id='".$_POST['id']."'"; [/code]

Member Avatar for nav33n
0
92
Member Avatar for gagan22

I guess, you don't have enough permissions on tmp directory. Give all the permissions to tmp directory and try again. When you use session_start, it will create a cookie if this option [i]session.use_cookies[/i] is turned on.

Member Avatar for gagan22
0
556
Member Avatar for MDGM

What does your query do ? Query the table 'photos' and for every photo, You are again querying the table 'ratings' if that photo's fbid has a count > 150 ? I didn't get the question or what you actually want. Do these 2 tables have any common 'linking' field …

Member Avatar for nav33n
0
3K
Member Avatar for servis

Use [icode]$action == 'preview' [/icode] and [icode]$action=='submit' [/icode]. Also, mention Form's 'method'. If you don't mention it, I guess, the default method is GET.

Member Avatar for nav33n
0
2K
Member Avatar for Coward

Simply use double quotes. ie., [icode]$num="0024";[/icode] Adding 0 before a number forces php to consider this as a octal number. [url]http://us3.php.net/int[/url]

Member Avatar for nav33n
0
87
Member Avatar for freelancelote

@cwarn23, mail function works fine in if condition. The mail function returns true on success and false on failure. It works just like, [icode]if(empty($var)) { [/icode] @OP, check your spam folder. On many occasions, mails sent using php function lands up in spam folder!

Member Avatar for nav33n
0
264
Member Avatar for rajeesh_rsn

[icode]select * from database [/icode] would work just fine since you want all the records without satisfying any condition :) Btw, 'for' and 'type' are mysql reserve keywords and requires ` to be wrapped around it. like, `for`, `type`.

Member Avatar for verruckt24
0
208
Member Avatar for xor83
Member Avatar for amisenheimer

print "<pre>"; print_r($_POST['checkbox_element_name']; print "</pre>"; Does it print anything ? There is nothing wrong in your code except the checkbox name may be wrong :) Edit: And a thumbs up for using [code] tags in your first post You should close the tag correctly next time. :)

Member Avatar for amisenheimer
0
90
Member Avatar for xilovemusic123x
Member Avatar for shasha821110
Member Avatar for Will Gresham

Hi there! The issue is with innerHTML! Check this link.. [url]http://www.developer-x.com/content/innerhtml/[/url]

Member Avatar for xyzweb
0
336
Member Avatar for gagan22

[url]http://www.daniweb.com/forums/thread177977.html[/url] Multiple threads for the same problem ? Not good.

Member Avatar for nav33n
0
82
Member Avatar for marjan_m
Member Avatar for nav33n
0
173
Member Avatar for OmniX

[quote]In the table there is no value of c and hence nothing is returned What is the value of $b?[/quote] $b will still hold a result resource. Check [i]Return values[/i] here.. [url]http://in.php.net/function.mysql-query[/url]

Member Avatar for OmniX
0
2K
Member Avatar for veledrom

password column is of datatype varchar (I think). Try this. [code=php] $q="UPDATE login SET password='".SHA1('$newPassword')."' WHERE id='$loginID' AND password='".SHA1('$oldPassword')."'"; [/code]

Member Avatar for nav33n
0
136
Member Avatar for nikhilkanna
Member Avatar for nav33n
0
62
Member Avatar for rohnni

FYI, Notice is not an error and can be turned off with different [url=http://in.php.net/manual/en/function.error-reporting.php]Error reporting [/url] values.. Edit: It is kind of an error, but can be ignored. (Doh!)

Member Avatar for cwarn23
0
234
Member Avatar for veledrom

[code=php] $q="SELECT id FROM login WHERE username='$username'"; $sql=mysql_query($q); if (@mysql_num_rows($sql)==1) { $arr=mysql_fetch_array($sql); $id=$arr["id"]; } [/code] :-/

Member Avatar for nav33n
0
75
Member Avatar for nealz

[code=mysql]select count(*) as total from user group by jobs[/code] ----------------------------- Total ------ Jobs ----------------------------- 10 ------> Unemployed 20 ------> Employed Cheers!

Member Avatar for nav33n
0
65
Member Avatar for danielagaba

You can have a field in your table to store the total questions answered by the user in bit format. For example, if there are 10 questions and the user has answered 4 of it, save, 1111000000 to the table. Then, when the user logs in next time, show only …

Member Avatar for nav33n
0
427
Member Avatar for emhmk1

[code=php] <?php //install2.php if(isset($_GET['unlink']) && $_GET['unlink']=="true") { unlink("install.php"); unlink("install2.php"); header("location: success.php"); } //rest of the code here echo "<a href='install2.php?unlink=true'>Click here to remove the installation files ! </a>"; ?> [/code] Works on local machine. I haven't tested it on server! If you want to do the same with a button, …

Member Avatar for nav33n
0
113
Member Avatar for queenc

In your dblayer.php, echo [url=http://in2.php.net/getcwd]current working directory[/url]. Depending on which directory you are in, you can use [b]../[/b] to go back one step to previous directory, [b]../../[/b] to go back 2 steps and so on.. ie., If the file is in public_html/common/dblayer.php , using [b]../[/b] will take you to the …

Member Avatar for almostbob
0
239
Member Avatar for theimben

Do you get any error ? And, you don't have session_start(); in this script :-/

Member Avatar for nav33n
0
105
Member Avatar for Roybut

You are doing it wrong.. [icode]$result = mysql_query($query);[/icode] This will execute the query and return the result resource. You have to then use mysql_fetch_array (mysql_fetch_row/mysql_fetch_assoc/mysql_fetch_object) ! Read it here.. [url]http://in.php.net/function.mysql-query[/url] [code=php] $query = "SELECT * FROM item WHERE item_id = '1'"; $result = mysql_query($query); $row = mysql_fetch_array($result); //if it returns …

Member Avatar for nav33n
0
116
Member Avatar for progurammaar

When adding the data to the table, use [url=http://in.php.net/nl2br]nl2br[/url] function (if you are using php).

Member Avatar for nav33n
0
274
Member Avatar for sam1

1. Yes. Since you know where you will be uploading the file, you can save the foldername as albumname 2. By using multiple [icode]<input type='file' >[/icode] tag I am not sure if the examples in these links work, but, this is how you do it. [url]http://www.phpeasystep.com/workshopview.php?id=2[/url] [url]http://www.plus2net.com/php_tutorial/php_multi_file_upload.php[/url]

Member Avatar for nav33n
0
264
Member Avatar for antwan1986

[code=php] <?php $con = mysql_connect("localhost","root"); mysql_select_db("test"); $q = "select * from table1"; $result = mysql_query($q); $i=0; while($row = mysql_fetch_array($result)) { $result_set[$i] = $row; $i++; } for($i=0;$i<count($result_set);$i++) { print "<pre>"; if($next_element < count($result_set)-1) { $next_element = $i+1; print "Next element in the array is: <br><br>"; print_r($result_set[$next_element]); } print "Now the array …

Member Avatar for pritaeas
0
125
Member Avatar for Stefano Mtangoo

[url]http://www.mssqlcity.com/FAQ/General/char_vs_varchar.htm[/url] Summary: If you specify column's datatype as char(20) and you enter a value, say, "test", mysql still uses 20 bytes.. But if the column's datatype is varchar, and you enter "test", it uses only 4 bytes.. The best place to use char is when you are 100% sure that …

Member Avatar for nav33n
0
99
Member Avatar for shadiadiph

No it wont! cwarn23 is appending a "|" after every error message. So, if there are 2 errors, the query string would look like, [quote] Name is a required field please complete and submit it again.| Please fill in a correct email address| [/quote] I personally don't prefer doing it …

Member Avatar for shadiadiph
0
131
Member Avatar for Stefano Mtangoo

Did you check the source ? [icode] $string = "<div id=\"$class\"> $words </div>"; [/icode] I just had everything in one script and it works fine. (Oh, I also replaced . with # of your css. [code=php] <?php function pop_boxes($words, $class) { $string = "<div id=\"$class\"> $words </div>"; print($string); } ?> …

Member Avatar for Stefano Mtangoo
0
82
Member Avatar for changeco
Member Avatar for nav33n
0
102
Member Avatar for marjan_m

Answer is Yes to both the questions. [code=php] <html> <body> <form name='test' method='post'> <input type='text' id='name' name='name'> <input type='text' id='age' name='age'> </form> <?php $value = 1; if($value == 1) { echo "<script>document.getElementById('age').focus();</script>"; echo "<script>document.getElementById('name').disabled=true;</script></script>"; } ?> </body> </html> [/code]

Member Avatar for marjan_m
0
98
Member Avatar for Stefano Mtangoo

[quote]and another issue: include("$path/...") ===> you are giving dynamically path to your pages, this is not secure. don't do that.[/quote] Could you please explain why ?

Member Avatar for Stefano Mtangoo
0
120
Member Avatar for ahmksssv
Member Avatar for nav33n
0
84
Member Avatar for queenc

[quote] if($filename!="NULL" || $filename!="FALSE" || $filename!="") [/quote] This must be [quote] if($filename!=NULL && $filename!=FALSE && $filename!="") [/quote] In your example, you are checking if variable filename value is NULL or FALSE (which is wrong). And, you should use logical operator "and" instead of "or".

Member Avatar for nav33n
0
127
Member Avatar for steve345

Are you sure it doesn't work ? I downloaded the script and it works just fine! See the attached screenshot..

Member Avatar for steve345
0
91
Member Avatar for emiola

2 errors. 1st one is on line 30. $message = $_POST('$SchoolName',.... 2nd error, there is no ; after mail function. Please check [url=http://in.php.net/manual/en/function.mail.php] this [/url] for the correct syntax of mail function! Edit: Also, this [quote] echo "Form not properly completed") [/quote] is not terminated by a semicolon and there …

Member Avatar for nav33n
0
143
Member Avatar for eawade

Well, thats because only the last value is stored in variable $val because of the while loop. You can 1. Put value of $row["name"]; to an array and iterate through that array in your select tag or 2. Use <option> tag in your while.

Member Avatar for nav33n
0
106
Member Avatar for millsy007

[code=mysql] update journey j, passengers p, shuttle s set j.occupancy=j.occupancy - 1 where p.journey_id = j.id and s.id = j.shuttle_id and s.id = 1 and p.passenger_name='bill gates' [/code] wouldn't this work ? Many people at my workplace avoid joins (they say its comparatively slower than normal queries).

Member Avatar for millsy007
0
79
Member Avatar for ahmksssv

Check mysql function [url=http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substring-index]substring_index [/url] Eg. [code=mysql] SELECT SUBSTRING_INDEX(columnname, "\n", 10 ) FROM table [/code]

Member Avatar for nav33n
0
119
Member Avatar for dmanw100

foreach($array as $value) simply means, for every element in the array, assign its value to $value. foreach($array as $key => $value) assigns the index of the array to $key and value of that index to $value. :S I hope I am not confusing you! This is almost similar to for …

Member Avatar for Stefano Mtangoo
0
190
Member Avatar for npandu_24
Member Avatar for cwarn23
0
103
Member Avatar for forzadraco

[quote] i want to remove all word from that string if that string have minimal three word'x'[/quote] I am not clear what you want. Do you want to search for xxx, if found, remove it ?

Member Avatar for nav33n
0
151
Member Avatar for lifeworks

While fetching, use str_replace to replace "<br />" with "". ie., [code=php] str_replace("<br />", "", $data); [/code]

Member Avatar for Rhyan
0
121

The End.