331 Posted Topics

Member Avatar for nathan.mackinnon1

setcookie("email", $email1); setcookie("pass", $pass1); setcookie("ID", $ID); should be: setcookie("email", $email1,time()+3600); setcookie("pass", $pass1,time()+3600); setcookie("ID", $ID,time()+3600); //setcookie(cookie name, cookie value, cookie expire unix timestamp); //time() = NOW in seconds since 1970, -3600 would make it expire an hour ago

Member Avatar for Biiim
0
317
Member Avatar for Khav

> appserv on windows note .htaccess doesn't work on IIS, it's an apache thing. Had me hating htaccess for months until i realised why i could never get it to work >Web Server: Application Server installs Internet Information Services (IIS) 7.0 appserv -> http://technet.microsoft.com/library/0f51315e-de4b-491f-8536-9aaea03ed73d IIS not support htaccess -> http://stackoverflow.com/questions/257936/htaccess-or-htpasswd-equivalent-on-iis

Member Avatar for Khav
0
324
Member Avatar for David2012

`$myvar = var_dump($study_class);`? to have better control use foreach() foreach($_POST['study_class'] as $key=>$value){//for each variable in the array $study_class //do the following ($key == the key of this array entry, $value == value of entry in array) echo $value."<br/>\r\n"; } $key will just be 0,1,2,3 etc in your code though

Member Avatar for David2012
0
268
Member Avatar for stupid guy

if (!(mysql_query($sql,$con)) || !(mysql_query($sql_pin,$con))) { if(mysql_errno()==1062) { $error_flag=1; echo mysql_error(); echo "error no:".mysql_errno(); die("error:".mysql_errno()); } $error_flag=1; } else $error_flag=0; If `mysql_query($sql,$con)` returns false OR `mysql_query($sql_pin,$con)` returns false then check if `mysql_errno()` is equal to 1062. If it is equal to 1062 set `$error_flag = 1;` and `echo mysql_error();` and `echo …

Member Avatar for soapyillusion
0
369
Member Avatar for azegurb

I formatted the js: $(document).ready(function() { $('#wait_1').hide(); $('#drop_1').change(function(){ $('#wait_2').hide(); $('#wait_2').show(); $('#wait_4').hide(); $('#result_2').hide(); $.get("func.php", { func: "drop_1", drop_var: $('#drop_1').val() }, function(response){ $('#result_1').fadeOut(); setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400); }); return false; }); }); function finishAjax(id, response) { $('#wait_1').hide(); $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } function finishAjax_tier_three(id, response) { $('#wait_3').hide(); $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } function finishAjax_tier_four(id, response) { $('#wait_5').hide(); …

Member Avatar for Biiim
0
186
Member Avatar for Sanchixx

Like Pritaeas says php is server side, you want a client side script to do that eg javascript: <script type='text/javascript'> var i = 0;//heres your $i function incNum(eid,amt){ i = i + amt; displayNum(eid); //alert(i); } function displayNum(eid){ var obj = document.getElementById(eid); obj.innerHTML = i;//innerHTML for div obj.value = i;//value …

Member Avatar for Biiim
0
197
Member Avatar for laura301019

Heres my take on it: <?php $ages = range(10,300,10); ?> <style> .divTable{ display:table; border-color: silver; border-style: solid; border-width: 2px; border-radius: 10px; padding: 5px; } .divTr{ display:table-row; } .divTd{ display:table-cell; padding:3px; vertical-align: middle; } </style> <div class='divTable'> <div class='divTr'> <div class='divTd'>Age</div> <div class='divTd'>Double</div> <div class='divTd'>Half</div> <div class='divTd'>age^2</div> <div class='divTd'>+10 - age/4</div> …

Member Avatar for Biiim
0
156
Member Avatar for mrhankey

url: "canvasSaveData.php", canvasSaveData.php <?php //check logged in? //include('app.php'); //if(loggedin){ //$_POST['image_data'] & $_POST['title'] & $_POST['author'] $Q = "INSERT into canvasdata (`fields`) VALUES ('$data')"; //run query ?> not used the jquery version of ajax so not sure how to get the page responseText

Member Avatar for glenn2407
0
172
Member Avatar for anu013

<input id='rate1' value='5' onchange="checkValues('rate1','rate2');"/> <input id='rate2' value='8' onchange="checkValues('rate1','rate2');"/> <script type='text/javascript'> function checkValues(eid1,eid2){ var obj1 = document.getElementById(eid1); var obj2 = document.getElementById(eid2); if(parseFloat(obj1.value) < parseFloat(obj2.value)){ obj1.style.backgroundColor = '#cc0000'; obj2.style.backgroundColor = '#00cc00'; }else if(parseFloat(obj1.value) > parseFloat(obj2.value)){ obj2.style.backgroundColor = '#cc0000'; obj1.style.backgroundColor = '#00cc00'; }else{ obj1.style.backgroundColor = '#cccc00'; obj2.style.backgroundColor = '#cccc00'; } } checkValues('rate1','rate2'); </script>

Member Avatar for anu013
0
307
Member Avatar for my3h

can use the google charts api, which creates a very nice interactive graph but might be bit steep a gradient to understand it: https://google-developers.appspot.com/chart/interactive/docs/gallery/piechart <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Task', 'Hours per Day'], ['Work', 11], ['Eat', 2], …

Member Avatar for Biiim
0
3K
Member Avatar for xbat

<select name='product'> <option value='1'>Car</option> <option value='2'>Bike</option> <option value='3'>Truck</option> <option value='4'>Motor bike</option> <option value='5'>Tractor</option> </select> <select name='qty'> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> <option value='4'>4</option> <option value='5'>5</option> </select> <?php //the process page if(ctype_digit($_POST['product']) && ctype_digit($_POST['qty'])){ $Q = "UPDATE `products` SET `instock` = `instock` - {$_POST['qty']} WHERE `prodid` = {$_POST['product']}"; } ?> …

Member Avatar for xbat
0
328
Member Avatar for ranjit_mahadik

I googled the echeck function sayali must be talking about: http://www.smartwebby.com/DHTML/email_validation.asp

Member Avatar for Biiim
0
106
Member Avatar for gurusubramaniam

**if you want to hide data you can hide it within flash**, html/javascript is always available to view - the right click disabling just annoys me, to put it politely. Means i have to go to the menu instead of right clicking - such an effort. Will prevent less technical …

Member Avatar for Biiim
0
570
Member Avatar for subrata_ushasi

Heres a basic example of what i think you're asking: <script type='text/javascript'> function addValue(eid,addtoeid){ var obj = document.getElementById(eid); var displayObj = document.getElementById(addtoeid); displayObj.innerHTML += obj.value+'<br/>'; obj.value = ''; obj.focus(); } </script> <input type='text' id='showText'/><a href='javascript:' onclick="addValue('showText','displayHTML');">Add</a><br/> <div id='displayHTML'></div>

Member Avatar for subrata_ushasi
0
176
Member Avatar for arctushar

i would echo out the queries ran: function memory($user,$ayat){ sqlconnection(); $user = mysql_real_escape_string($user); $ayat = mysql_real_escape_string($ayat); if((checkmemory($user,$ayat)==0) || !(checkmemory($user,$ayat)==0)){ $sql="INSERT INTO `mark` ( `user_id` , `ayat` ) VALUES ( '".$user."', '".$ayat."' )"; echo $sql; mysql_query($sql); return $sql; } } function checkmemory($user,$ayat){ sqlconnection(); $user = mysql_real_escape_string($user); $ayat = mysql_real_escape_string($ayat); $sqlmemory="SELECT * …

Member Avatar for Biiim
0
189
Member Avatar for naresh.giri.146

Akmozo's should work, the problem is ` while ($row = mysql_fetch_assoc($query))` as when it finds nothing, it won't loop

Member Avatar for Biiim
0
356
Member Avatar for aneeqtariq_143

echo "</tr>"; while($row = mysql_fetch_array($result)) { just before the while make it and increment on each loop echo "</tr>"; $current_record = 0; while($row = mysql_fetch_array($result)) { //$current_record++; this increments the value each loop later on

Member Avatar for broj1
0
128
Member Avatar for LastMitch

and the array is declared wrong: $futures = array( array( array("GC", "Gold", 1605) ,array("SI", "Silver", 27) ,array("PL", "Platinum", 1475) ,array("HG", "Copper", 3.48) ), array( array("CCS", "Corn", 707) ,array("SNS", "Soybeans", 1.525) ,array("WCS", "Wheat", 846) ), array( array("CJ", "Cocoa ", 2,335) ,array("KT", "Coffee", 183) ,array("TT", "Cotton", 70.56) ,array("YO", "Sugar #11", 21.95) ) …

Member Avatar for blocblue
0
364
Member Avatar for sri.

store it in a cookie, session or database each time the page is ran: <?php $_SESSION['page1opens']++; ?>

Member Avatar for sri.
0
5K
Member Avatar for tony.m3nsa

Can you view a plain text or html page on the hosting? if so Can you view a simple page with just `echo "hi";` in it? if so turn on `error_reporting(E_ALL);` at the top of your script Should narrow down the error a lot

Member Avatar for Biiim
0
177
Member Avatar for matanc244

<?php $con = mysql_connect("localhost","matanc_cmd","123123"); if (!$con){ die('Could not connect: ' . mysql_error()); } mysql_select_db("matanc_cms", $con); // check if the form was submitted // get the ID (cast it to integer if it is supposed to be integer) $id = (int) $_GET['id']; mysql_query("DELETE FROM content WHERE id='$id'"); mysql_close($con); ?> Looks good …

Member Avatar for Biiim
0
96
Member Avatar for napninjanx

$array = array(); you don't need to declare before hand either you can use: $array[] = $value;//add to end $array[2] = $value;//add/overwrite entry with key of 2 1, 3 and 4 are wrong in php, 4 is the javascript to declare an array and 2 is correct

Member Avatar for napninjanx
0
174
Member Avatar for 68thorby68

Some left join magic SELECT * FROM `zones` LEFT JOIN `zones_allowed` ON `zones`.`zone_no` = `zones_allowed`.`c_zone` LEFT JOIN `country_zones` ON `zones_allowed`.`d_zone` = `country_zones`.`zone` WHERE `zones_allowed`.`allowed` = 1 ORDER BY `zones`.`zone_no` ASC; <?php $Q = "SELECT `zones`.`zone_name`,`zones_allowed`.`d_zone`,`country_zones`.`id`,`country_zones`.`country` FROM `zones`" ." LEFT JOIN `zones_allowed` ON `zones`.`zone_no` = `zones_allowed`.`c_zone`" ." LEFT JOIN `country_zones` ON …

Member Avatar for 68thorby68
0
172
Member Avatar for mahdiyazdani

first the form input needs to be right: ><input type="checkbox" class="iphone" /><label class="fix">Remember me</label></p> should be something like: <input type="checkbox" name="rememberme" class="iphone" value="yes"/><label class="fix">Remember me</label></p> Then login script to set the cookie: <?php ob_start(); session_start(); error_reporting(0); include "../db.php"; $username=$_POST['username']; $password=md5($_POST['password']); $sql=mysql_query("select * from admin where user='$username' and pass='$password' "); $c=mysql_num_rows($sql); …

Member Avatar for mahdiyazdani
0
647
Member Avatar for xbat

Hows this work for you, not too sure what you're after - maybe its just the group by query also no idea what your table structure is so made a sample one. Will work in a file by itself <?php //use this to get the data from database //field_to_count is …

Member Avatar for xbat
0
162
Member Avatar for aristos32

Just tested this and it works for me: <?php var_dump($_POST); ?><html> <head> <script type="text/javascript"> function displayResult() { var table=document.getElementById("myTable"); var row=table.insertRow(0); var cell1=row.insertCell(0); var cell2=row.insertCell(1); cell1.innerHTML="New"; cell2.innerHTML="New"; var element = document.createElement("input"); element.type = 'text'; element.name = 'testname'; element.id = "testname"; cell1.appendChild(element); } </script> </head> <body> <form method=post> <table id="myTable" border="1"> …

Member Avatar for aristos32
0
293
Member Avatar for devianleong

> Always use salt + MD5 passwords sha is more secure than md5 - http://www.php.net/manual/en/function.sha1.php Also limit the privileges on the mysql user the site runs off - if the site doesnt need the drop command to function - don't allow it to I generally just remove/canonicalise single quotes, double …

Member Avatar for veedeoo
0
236
Member Avatar for DarkMonarch

Just needs a new form tag for every row: for($i=0; $i<count($data)-1; $i++){ $chaine .= "<tr>"; $data2 = explode(";", $data[$i]); for($j=0; $j<count($data2)-1; $j++) $chaine .= "<td>$data2[$j]</td>"; $chaine .= "<td> <form> <input type='hidden' name='empID' value='".$data2[0]."'> <input type='submit' name='oper' value='Supprimer'> <input type='submit' name='oper' value='Modifier'> </form> </td> </tr>"; } That isolates the inputs so …

Member Avatar for DarkMonarch
0
187
Member Avatar for Buppy

<?php $array = array("16.765"=>'1', "4.345"=>'2', "17.123"=>'3', "23.123"=>'4', "6.111"=>'5', "6.113"=>'6', "6.112"=>'7', "17.3"=>'8', "0"=>'9'); $array2 = array(); foreach($array as $k=>$v){ $array2[] = $k; } arsort($array2,SORT_NUMERIC); $array3 = array(); foreach($array2 as $v){ $array3[$v] = $array[$v]; } var_dump($array3); ?> Actually just tried ksort and array_reverse as metioned above and is much simpler: <?php $array …

Member Avatar for diafol
0
140
Member Avatar for SummerNight

$total = 0; $i = 0; foreach($usertotal as $k=>$v){ $total += $v; $i++; } $average = $total/$i; foreach($usertotal as $k=>$v){ $topay = $average-$v; if($topay == 0){ echo $users[$k].' has paid his share'."<br/>\r\n"; }elseif($topay >0){ echo $users[$k].' needs to pay: £'.$topay."<br/>\r\n"; }else{ echo $users[$k].' needsto recieve: £'.abs($topay)."<br/>\r\n"; } } The nice …

Member Avatar for Biiim
0
134
Member Avatar for hlamster

$tbl=array(); //$rowno=0;//quotes makes it a string, we want a number/integer while ($row = mysql_fetch_assoc($result)) { //$row is a associative array already, why bother redefining it //$tbl[$rowno] = $row; //you dont even need the $rowno if it starts from 0 and goes up by 1 each loop //arrays in php auto …

Member Avatar for Manda.Ravi
0
217
Member Avatar for vijukumar

Add into the top of link1 - `$secureArea = false;` and link 2 - `$secureArea = true;` then in auth.php: <? // Login & Session example by sde // auth.php // start session session_start(); // convert username and password from _POST or _SESSION if($_POST){// if($_POST['submit'] == 'Login'){ ? //doing this …

Member Avatar for Biiim
0
4K
Member Avatar for JameB

can likely replace reading with javascript, that can read files: http://www.javascripter.net/faq/reading2.htm I've only ever used the XMLHTTPrequest object in AJAX myself, it basically reads a file and returns it to javascript in a variable. Not sure how easy it is to get javascript to write to a file, id imagine …

Member Avatar for diafol
0
182
Member Avatar for showman13

I notice the first part includes a <tr> and <td> , maybe the hidden input isn't being created cause its in an invalid location? }else{ print"<input type=\"hidden\" name=\"accept\" value=\"".$acceptance."\">"; } to: }else{ echo "<tr><td>\r\n"; print"<input type=\"hidden\" name=\"accept\" value=\"".$acceptance."\">"; echo "</td></tr>"; } > acceptance If not i would follow up the …

Member Avatar for showman13
0
151
Member Avatar for wju2004

mysql_query($query); change to mysql_query($query) or die(mysql_error()); or if(mysql_query($query)){ //query success do something header('Location: http://www.google.co.uk'); }else{ //query fail do something }

Member Avatar for wju2004
0
228
Member Avatar for riahc3

could iframe it and store the javascript var in the parent: http://stackoverflow.com/questions/935127/how-to-access-parent-iframe-from-javascript I would database it personally so its not lost on page refresh. The page refreshing seems a little odd to me, surely it would go into a redirect loop if it refreshes on every load? have you made …

Member Avatar for riahc3
0
6K
Member Avatar for pgmarco

does header.php contain session_start();? also has the password been made with the sha() function and not been truncated? also i noticed a bracket missing: if($result) { if ( mysqli_num_rows($result) == 1 ) { $row = mysql_fecth_assoc($result); $_SESSION['user_id'] = $row['userid']; $_SESSION['user'] = $row['username']; $_SESSION['fname'] = $row['firstname']; $_SESSION['lname'] = $row['lastname']; setcookie('user', $row['username'], …

Member Avatar for pgmarco
0
325
Member Avatar for hwoarang69

$Q = "SELECT (SELECT image_name FROM user WHERE username = '$user') as `image_name`" .",`image_id`,`image`" ." FROM `images`" //." WHERE `user_id` = 1" ." ORDER BY RAND()" ." LIMIT 30"; $R = mysql_query($Q); if($R !== false){ while($row = mysql_fetch_assoc($R)){ echo $row['image_id']." printed<br/>\r\n"; } }else{ echo "query error: ".mysql_error(); } magic of …

Member Avatar for Biiim
0
146
Member Avatar for rayidi

>here i want to retreve the posts of a friend's friends where status = 'accepted'. I want in on single line mysql_query is it possible ? SELECT post FROM posts WHERE status = 'accepted' AND (to IN(SELECT user_id FROM friends WHERE iamallowedtosee = 1) OR from IN(SELECT user_id FROM friends …

Member Avatar for Biiim
0
193
Member Avatar for johns1982

could use: <script type='text/javascript'>showUser();</script> Just before body closes, you will need to set peter griffin and the all options selected for it to run as well(`<option value='1' SELECTED>Peter griffin</option>`). Or you could just put a mysql query into the php to pull the data you want to show on page …

Member Avatar for johns1982
0
688
Member Avatar for kratijain

> $rows = mysql_query("SELECT image FROM imagetable WHERE id='".$id."'"); > while($row=mysql_fetch_row($rows)) > { > header('Content-type: image/jpg'); > print "$row[0]" ; > } remove the header there, are you pulling more than 1 image? you can only display 1 image on a php page $rows = mysql_query("SELECT image FROM imagetable WHERE …

Member Avatar for kratijain
0
380
Member Avatar for mehrantahir

I actually work in emailing, you can only track: Read: user has clicked "show images" or just has the email set to show images default, meaning they could of just skimmed past it Click: user clicked a link in the email or some program has followed the link to check …

Member Avatar for mousecraft
0
263
Member Avatar for athulram

i just add another field onto the mysql database called "seourl" which has the value "intro-to-linux" then rather than doing a lookup on the id do a lookup on that seourl. you need a url rewrite to be able to make them urls you mentioned, such as with htaccess

Member Avatar for vibhaJ
0
189
Member Avatar for stephen_UK

value='$type' & value='$nt[types]' its cuting off anything after the space and using the next part as an attribute, as thats the delimiter for attributes in a html element

Member Avatar for moonknight33
0
209
Member Avatar for Heinz Stapff

> I need to know if it is better to update the whole row in phpmyadmin and copy the new query to echo the complete update or try to catch the 'sold' innerText' clientside and alter the button and select quantity options from there? always operate server-side, you want a …

Member Avatar for Biiim
0
125
Member Avatar for manzoor.ilahi77

$countries = array('IN'=>'India','PK'=>'Pakistan', 'UK'=>'United Kingdom','US'=>'United States'); echo "<form action='actionpage.php' method='post'>\r\n"; echo "<select name='country'>\r\n"; foreach($countries as $k=>$v){ echo "<option value='{$k}'>{$v}</option>\r\n"; } echo "</select>\r\n"; echo "</form>\r\n"; actionpage.php <?php $countries = array('IN'=>'India','PK'=>'Pakistan', 'UK'=>'United Kingdom','US'=>'United States'); echo $countries[$_POST['country']]; ?> if you're going to use it on many pages id put the array in it's …

Member Avatar for Biiim
0
227
Member Avatar for kakaliki
Member Avatar for sainigks

> echo "<option value='".$row['1']."'>".$row['1']."</option>"; the array index isn't a string its a integar: echo "<option value='".$row[1]."'>".$row[1]."</option>"; also just in case, index starts at 0 so the first column will be `$row[0]`

Member Avatar for Biiim
0
182
Member Avatar for vizz

thats done with htaccess and url rewrite http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html

Member Avatar for Biiim
0
45
Member Avatar for HasNor

maybe i got too into it but try this, it will auto make the csv and table based on the fields pulled in the mysql query - not tested it btw: <?php include 'connection/db_connect.php'; $n=0; $sql="SELECT r.reqid, r.misRefId, r.date_req, r.request_by, r.category, r.priority, r.detail, r.modSAP, r.req_symptom, r.approval, r.curPIC, r.status, r.dateclose, c.cat_id, …

Member Avatar for Biiim
0
3K

The End.