330 Posted Topics

Member Avatar for aveeva7

Pass the `$sku` to the sendMail function: `$this->sendMail($finalMessage, $sku);` then add the conditional around the email address, you could make it simple and make the `$sku` variable say `'lots_of_orders'` if he has over 10: $cut_sku = substr($sku, 0, 1); if($sku == 'lots_of_orders'){ $emailTemplate->setToEmail('[email protected]'); }elseif($cut_sku == '1'){ $emailTemplate->setToEmail('[email protected]'); }elseif($cut_sku == '2'){ …

Member Avatar for aveeva7
0
936
Member Avatar for Allan_8

In your conditional statement I spot to things wrong you are using the wrong reference to the variable it should be `$row['BILLED_TO_DATE_PERCENTAGE']`and also when doing a comparison you use `==` to test if 2 values match, using a single `=` tells PHP to set the variable to the following value, …

Member Avatar for Biiim
0
2K
Member Avatar for Сергей_7
Member Avatar for chloooo

Hi Chloooo, What you want to use is an array. var images = []; var imageDisplay = 0; images.push({title:'My Image Title 0', src:'myimage0.jpg'}); images.push({title:'My Image Title 1', src:'myimage1.jpg'}); images.push({title:'My Image Title 2', src:'myimage2.jpg'}); function displayImage(){ document.images["pic"].src = images[imageDisplay].src; document.images["pic"].alt = images[imageDisplay].title; imageDisplay++; if(imageDisplay > images.length-1){ imageDisplay = 0; } } …

Member Avatar for Biiim
0
862
Member Avatar for jonsan32

You can also output a pdf through PHP, you just need to set the header as a pdf: [headers for pdf download](https://stackoverflow.com/questions/20080341/correct-php-headers-for-pdf-file-download) (and just take off the dowload part). If you did that you would have more control over where the pdf jumps to on opening, for example you could …

Member Avatar for Biiim
0
981
Member Avatar for Varnisha Kalra

No. If you find wordpress is replacing your job as a web developer, you are not a web developer.

Member Avatar for Biiim
2
2K
Member Avatar for Kathy B

Hi Kathy, How I would debug this is to put`var_dump($_POST);exit;` at the top of file 2 so you can see what is actually being sent. Also with a redirect it is best to do it within PHP not with javascript: `header("Location: http://www.example.com/");exit;` Javascript is client-side so the user can disable …

Member Avatar for Biiim
0
1K
Member Avatar for tellysk

For the mysql import copy paste line 3-11 into a php file, update the file/table names I dont quite get how the mysql import works. For the csv export copy paste lines 16-103 into a php file, and update the file & table name at the top I should also …

Member Avatar for Anvesh_1
0
1K
Member Avatar for patrick1981

I've written some ajax that will do that, i'll dig it out and edit it for you. <script type='text/javascript'> function getXMLHTTPRequest() { var req = false; try { /* for Firefox */ req = new XMLHttpRequest(); } catch (err) { try { /* for some versions of IE */ req …

Member Avatar for rukverc
0
17K
Member Avatar for grant.baker

Pretty rough but you could pull the amount of duplicates and increment them in the php script $Next = mysql_query("SELECT `fields`,count(*) AS `numposts` FROM $logbook WHERE Date>='$Date' AND ID!='$ID' GROUP BY `date` ORDER BY Date, id LIMIT ".$numposts+1.",1"); $Prev = mysql_query("SELECT `fields`,count(*) AS `numposts` FROM $logbook WHERE Date<='$Date' AND ID!='$ID' …

Member Avatar for raybigto
0
3K
Member Avatar for duttydea

@wayko $array = array( 0=>array('fname'=>'john','sname'=>'smith','age'=>32) ,1=>array('fname'=>'Bill','sname'=>'Bailey','age'=>22) ,2=>array('fname'=>'Fred','sname'=>'Kruger','age'=>0) ); foreach($array as $v){ $sql = "INSERT INTO people (fname,sname,age) value ('{$v['fname']}','{$v['sname']}',{$v['age']})"; //execute $sql here or it will overwrite on loop mysql_query($sql); }

Member Avatar for diafol
0
2K
Member Avatar for Tko_1

if (($i = array_search($ip, $deny_ips)) !== FALSE){ // user is blocked: print "<CENTER> YOU HAVE BEEN BANNED ! </CENTER>"; exit; } Not sure if that will work, makes more sense to me like this: if (array_search($ip, $deny_ips) !== FALSE){ // user is blocked: print "<CENTER> YOU HAVE BEEN BANNED ! …

Member Avatar for Tko_1
0
2K
Member Avatar for muralibobby2015

I did a wedding ring site awhile ago, i did it by assigning each product the weight of the precious metal contained in it then having the price displayed on the page by doing: `$price = ($goldprice*$goldweight);` So i would get the `$goldprice` to be pulled from the xml file …

Member Avatar for diafol
4
1K
Member Avatar for Ritesh_4

<style type='text/css'> #myDiv{ box-shadow: 5px 5px 20px #cccccc;// x, y, blur, colour } </style> I forget which one is x and which is why but thats the format, some browsers might want their prefix still but should be standardised to the above now -webkit-box-shadow: 5px 5px 20px #cccccc; -moz-box-shadow: 5px …

Member Avatar for Ritesh_4
0
151
Member Avatar for mel01

It's the content of the top row making the first row expand to fit it, adding this shows the rows going to standard size #lmifp td { white-space:nowrap; } maybe make the td larger to fit the text and have `overflow:hidden;` would solve it but thats your say on what …

Member Avatar for JorgeM
0
2K
Member Avatar for davy_yg

<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([ ['date', 'Number of clicks per hari'], <?php $data = array( '1'=>array('date'=>'2013-01-16','numclicks'=>'6'), '2'=>array('date'=>'2013-01-17','numclicks'=>'9'), '3'=>array('date'=>'2013-01-18','numclicks'=>'5'), '4'=>array('date'=>'2013-01-19','numclicks'=>'12'), '5'=>array('date'=>'2013-01-20','numclicks'=>'10'), ); //$resultday = mysql_query("SELECT `date`,COUNT(idads) AS `numclicks` FROM adsmgt GROUP BY date") or die(mysql_error()); $i = 0; …

Member Avatar for davy_yg
0
147
Member Avatar for vizz

Don't know if your login is going to be public but for a public account creating site you want to hash the passwords so they arn't stored in a database and there's no reason you can't use hash for private uses. CREATE TABLE `users` ( `uid` int(5) NOT NULL AUTO_INCREMENT, …

Member Avatar for vizz
0
315
Member Avatar for OsaMasw

Left join does that well: SELECT * FROM `category` `c` LEFT JOIN `sub_category` `sc` ON `c`.`cat_id` = `sc`.`cat_id` WHERE `c`.`cat_id` IN(1,3,8) you can use group by's to count up how many times a field occurs too eg. how many subcats each category has SELECT `c`.`cat_id`,count(*) as `num_subcats` FROM `category` `c` …

Member Avatar for OsaMasw
0
2K
Member Avatar for davy_yg

INSERT INTO `table` (`field`,`field2`,`field3`) VALUES ('value1','value2',4); or expanding on the select query pritaeas posted, for different table structures INSERT INTO `table` (`fielda`,`fieldb`,`fieldc`) select `field1`,`field2`,`field3` FROM `table2`;

Member Avatar for TonyG_cyprus
0
171
Member Avatar for Farhad.idrees

you have a element on the page with the id 'list'? theres also an extra </script> tag in there but that might just be a copying error Since i didnt write the package and havn't used it i can only suggest using the javascript console to check for errors

Member Avatar for Farhad.idrees
0
235
Member Avatar for personalisedpen

my advice would be to get something you want to create or find someone you can create something for at a cheap price, then go do it and google each part you want to do: "how do i ..." "session not working" "date()" and read the info on them and …

Member Avatar for Draconyster
0
342
Member Avatar for MargateSteve

I'm having a look at it - looks like a challenge! indexes were missing on these - dropped the query from 90 seconds to 6 seconds for me CU.comp CU.user CG.comp CG.game P.user

Member Avatar for MargateSteve
1
295
Member Avatar for riseguim

Do you have a way of connecting into an admin mysql like phpmyadmin or by logging into the server? the mysql_connect() details must be incorrect `$con = mysql_connect('localhost','root','');` mysql_connect($host,$user,$pass); also i suggest using mysqli instead mysqli_connect($host,$user,$pass,$db); mysql_ is being phased out sometime in the future so may as well start …

Member Avatar for rsewak
0
389
Member Avatar for techyworld

in actionscript I would make it with an array formatted to be understandable eg. var grid = new Array(1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16, 17,18,19,20, 21,22,23,24); Once you see that format its much easier to grasp how to make it up, i just done random numbers here since you said afterwards you …

Member Avatar for Taywin
0
3K
Member Avatar for hudhasama

Theres no name attribute on any of the select boxes <select name='databasecol'> while($row = mysql_fetch_assoc()){//while looping through each database row echo "<input type='hidden' name='unqid'' value='{$row['unique_id']}'/>\r\n"; echo "<input type='hidden' name='form_submit' value='SUBMITTED'/>\r\n";//may want to create a random token instead to prever multi submitting //inputs name= db_field_name } //top of page if(ISSET($_POST['form_submit']) && …

Member Avatar for Biiim
0
119
Member Avatar for primzon

I didn't go to uni so i don't know that linguo, what is it you want? (SELECT id, place, idParentPlace, 1 AS hierarhic FROM places WHERE idParentPlace IS NULL) UNION (SELECT id, place, idParentPlace, idParentPlace + 1 FROM places WHERE idParentPlace IS NOT NULL) Maybe this is what you are …

Member Avatar for Biiim
0
218
Member Avatar for nunuaziz_

$result=mysqli_query($mysqli,"SELECT reserv_id,tableselect FROM reserve WHERE reserveDate = '". $date ."' AND reserveTime = '". $time ."'"); $reserves = array();//php $reserveJSArray = 'var reserveArray = {'; if($row = $result->fetch_array(MYSQLI_ASSOC)){ echo $row['tableselect']; $i = 0; if($t){ $reserves[$row['reserv_id']] = 1; //or if($i == 0){ $tmpJS = $row['reserve_id'].': = 1'; $i++; }else{ $tmpJS .= …

Member Avatar for broj1
0
1K
Member Avatar for earlxph8

Code sanity has been restored, bar the p tag's class name - I let that one through <style type='text/css'> .spanp{display: inline-block;margin:0;} .dotuline{display: inline-block;border-bottom-style: dotted;border-bottom-width:2px;margin:0;} .box{ width:700px;padding:30px;border:1px solid black;margin:1px;display:block;} </style> <div class="box" align="left"> <table width="100%" border="0"> <!--<?php //while($row = mysql_fetch_assoc($res)){?>--> <tr> <td width="45%" > <p class="spanp" style="width:20px">Alias:</p> <p class="dotuline"><?php echo $alias; …

Member Avatar for Biiim
0
343
Member Avatar for callumbagshaw

<?php //parse form and add inventory to system if(isset($_POST['productName'])){ $productName = mysql_real_escape_string($_POST['productName']); $price = mysql_real_escape_string($_POST['price']); $category = mysql_real_escape_string($_POST['category']); $description = mysql_real_escape_string($_POST['description']); //check if product name ios already in use echo 'Name:'.$productName."<br/>\r\n"; $query = "SELECT id FROM products WHERE productName = '$productName' LIMIT 1"; echo 'Query:'.$query."<br/>\r\n"; $sql = mysql_query($query) or die(mysql_error()); …

Member Avatar for callumbagshaw
0
148
Member Avatar for Tinnin

Most of the message is being echo'ed out not appended to the message var - plus theres back slashes around all the quotes $message = '<html> <head> <title>'.$subject.'</title> </head> <body> <table align="center" cellspacing="3" cellpadding="3" width="100"> <tr> <th align="left"><b>Player Name<b></td> <th align="left"><b>Number of Goals<b></td> </tr>'; while($row_GetCurMonthPlayerGoals = mysql_fetch_assoc($GetCurMonthPlayerGoals)) { $message .= …

Member Avatar for Tinnin
0
348
Member Avatar for sainigks

To confirm it I really doubt there will be any way to import a xls into mysql - microsoft has xls files saved in an encrypted format that you need a program to translate - I would do what Pritaeas says and you can make the top row using the …

Member Avatar for pritaeas
0
229
Member Avatar for dbalas

I put together a working example of using time() to convert datetime's into integar's: <?php $now = time(); $testTimes = array('test 1'=>time()+(60*60*16),'test 2'=>time()+(60*60*24*6),'test 3'=>time()-60*30);//test times - array(16 hours,6 days, 30 minutes ago); //$timetocheck = strtotime('2012-01-18 13:25:12');//to convert a string date or datetime into a time integar $triggerTime = 60*60*24*2;//seconds * …

Member Avatar for dbalas
0
364
Member Avatar for dartiss

*What I want to do is, if they press refresh on their browser, not process the data again. However, if they select the same item from the drop-down and submit it again then this should work. Is there a way to do this?* For that you can use some part …

Member Avatar for Biiim
0
155
Member Avatar for f4fjks

Heres an old ajax file i found and edited for you: daniweb_basic_ajax_example.php <html> <head> <script type='text/javascript'> function getXMLHTTPRequest() { var req = false; try { /* for Firefox */ req = new XMLHttpRequest(); } catch (err) { try { /* for some versions of IE */ req = new ActiveXObject("Msxml2.XMLHTTP"); …

Member Avatar for Biiim
0
284
Member Avatar for davy_yg

What a confusing thread to follow! Your first query is a group by - which is what you're after and you get the counts without any other data the second query has no group by on it - its just pulling all rows and concatting a var from the last …

Member Avatar for davy_yg
0
182
Member Avatar for silent lover

This code is correct: <?php include "connect.php"; $query = "SHOW TABLES FROM `my_database`"; if($res = mysql_query($query)){}else{die(mysql_error());} $selectedTable = 'table'; echo "<select name='venue'>"; while ($row = mysql_fetch_row($res)){ echo "<option value='{$row[0]}' "; if ($selectedTable == $row[0]){ echo " selected='selected'";//<-- added space } echo ">{$row[0]}</option>"; } echo "</select>"; ?> Working on it i …

Member Avatar for silent lover
0
2K
Member Avatar for code739

be impossible to get 100% of the data back, 2012-01-04 and 2012-04-01 both valid dates and no idea which format it was entered as, you could get the obvious ones though, i'd use a combo of substr() and locate() SELECT SUBSTR('2012-22-07',LOCATE('-',CURDATE())+1,2) AS `second_num`; SELECT SUBSTR('2012-22-07',LOCATE('-',CURDATE())+4,2) AS `third_num`; then you can …

Member Avatar for code739
0
225
Member Avatar for jayreis

Heres one i got: $.post("http://www.example.co.uk/test.php",{sid:sid,type:type}, function(data){ $('.jq_counttotal').html(data); } ); Looks like yours is missing the "what to do when got page" function buttons: { "Save": function() { $.post('../includes/additem.inc.php', $('#additemform').serialize(), function(data){ alert(data); } ); }, Cancel: function() { $( this ).dialog( "close" ); } }

Member Avatar for jayreis
0
254
Member Avatar for Amicallef1991
Member Avatar for gopi17

Looks like you need to give your uploads an id and that task table needs an id then you pass the task id into the upload or the upload id into the task and pull across the full path instead of just the filename. and then also make the form …

Member Avatar for Biiim
0
330
Member Avatar for techyworld

Maybe OTT but it was fun. heres an example of progress bar in JS <html> <head> <script type='text/javascript'> var barLength = 260; var progress = 0; var progressEnd = 200; var progressBarCurrent = 0; var tickSpeed = 300; function setProgressBar(obj,barLength,progress,progressEnd){ if(progress < 0){ obj.style.width = '0px'; }else{ var percentage = …

Member Avatar for Biiim
0
134
Member Avatar for davy_yg

<select name="batch" onchange="submit();"> <option value="-1" >-- Select Address --</option> <?php $result = mysql_query('SELECT `PO`,`namn` FROM PO ORDER BY PO ASC') or die(mysql_error()); //php arrays are case sensitive, the field was defined in caps //you can use SELECT `po` to make it lower case in the mysql pull //var_dump($result);//$result will be …

Member Avatar for broj1
0
225
Member Avatar for latooplat

Thats because ` $albums = Album::find_all();` returns an array public static function find_all() { return self::find_by_sql("SELECT * FROM ".self::$table_name); } public static function find_by_sql($sql="") { global $database; $result_set = $database->query($sql); $object_array = array(); while ($row = $database->fetch_array($result_set)) { $object_array[] = self::instantiate($row); } return $object_array; } You will want a starter …

Member Avatar for Biiim
0
209
Member Avatar for titosd

theres a way around ajax for non changing data - which is preloading the data. <script type='text/javascript'> var abcData = new Array(); <?php $data = array( '1'=>array('id'=>'1','description'=>'desc 1'), '2'=>array('id'=>'2','description'=>'desc 2'), '3'=>array('id'=>'3','description'=>'desc 3') ); foreach($data as $v){ echo "abcData[{$v['id']}] = 'option {$v['id']} data: {$v['description']}';\r\n"; } ?> function updateView(obj){ var target = …

Member Avatar for Biiim
0
182
Member Avatar for stutego

<form action="register.php" method="post"> action = the page/script to submit the data to on form submission method = the way in which the data is sent to the script Firstname: <input type="text" size=30 name="fname"><br> Lastname: <input type="text" size=30 name="lname"><br> method POST - will send the contents of "fname" and "lname" to …

Member Avatar for Biiim
0
220
Member Avatar for bibiki

[CODE=mysql]select * from `tablea` left join `tableb` on `tablea`.`id` = `tableb`.`id` left join `tablec` on `tablea`.`id` = `tablec`.`id`[/CODE] result set will have the fields of tableb & c attached as columns on the right of tablea matched up by the `id` fields matching.

Member Avatar for nduduzo
0
285
Member Avatar for mheoxe
Member Avatar for bavenbabu

> function getSize() { > if (isset($_SERVER["CONTENT_LENGTH"])){ > return (int)$_SERVER["CONTENT_LENGTH"]; > } > else { > throw new Exception('Getting content length is not supported.'); > } > } thats an error on this bit, check your php ini settings - sounds like that server variable isn't being set You may …

Member Avatar for peacepostman
0
737
Member Avatar for veledrom

sounds like you could play with this randstr function i got: function randStr($len = 6){ if(is_int($len) && $len > 0){ $string = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',$len)),0,$len); }else{ $string = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',6)),0,6); } return $string; } $id = randStr(10);

Member Avatar for Biiim
0
247
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

The End.